|
| 1 | +{ |
| 2 | + "React Bricks TypeScript Brick": { |
| 3 | + "prefix": "brick", |
| 4 | + "body": [ |
| 5 | + "import React from 'react'", |
| 6 | + "import { Text, RichText, Image, File, Repeater, types } from 'react-bricks/frontend'", |
| 7 | + "", |
| 8 | + "interface Props {", |
| 9 | + "\t", |
| 10 | + "}", |
| 11 | + "", |
| 12 | + "const ${1:${TM_FILENAME_BASE}}: types.Brick<Props> = (props) => {", |
| 13 | + "\treturn (", |
| 14 | + "\t\t<div>", |
| 15 | + "\t\t\t<Text", |
| 16 | + "\t\t\t\tpropName=\"title\"", |
| 17 | + "\t\t\t\tplaceholder=\"Title...\"", |
| 18 | + "\t\t\t\trenderBlock={({ children }) => (<span>{children}</span>)}", |
| 19 | + "\t\t\t/>$0", |
| 20 | + "\t\t</div>", |
| 21 | + "\t)", |
| 22 | + "}", |
| 23 | + "", |
| 24 | + "${1:${TM_FILENAME_BASE}}.schema = {", |
| 25 | + "\tname: '${1:${TM_FILENAME_BASE}}',", |
| 26 | + "\tlabel: '${1:${TM_FILENAME_BASE}}',", |
| 27 | + "\t$LINE_COMMENT category: '',", |
| 28 | + "\t$LINE_COMMENT tags: [],", |
| 29 | + "", |
| 30 | + "\t$LINE_COMMENT Defaults when a new brick is added", |
| 31 | + "\tgetDefaultProps: () => ({", |
| 32 | + "\t\ttitle: 'Thick as a brick',", |
| 33 | + "\t}),", |
| 34 | + "", |
| 35 | + "\t$LINE_COMMENT Sidebar Edit controls for props", |
| 36 | + "\tsideEditProps: [],", |
| 37 | + "}", |
| 38 | + "", |
| 39 | + "export default ${1:${TM_FILENAME_BASE}}", |
| 40 | + "" |
| 41 | + ], |
| 42 | + "description": "Creates a React Bricks TypeScript brick" |
| 43 | + }, |
| 44 | + "React Bricks sideEditProp": { |
| 45 | + "prefix": "sideEditProp", |
| 46 | + "body": [ |
| 47 | + "{", |
| 48 | + "\tname: '${1:name}',", |
| 49 | + "\tlabel: '${2:Label}',", |
| 50 | + "\ttype: types.SideEditPropType.${3|Text,Textarea,Number,Date,Boolean,Select,Range,Image,Custom|},", |
| 51 | + "}" |
| 52 | + ], |
| 53 | + "description": "Creates a React Bricks' Brick `sideEditProp`" |
| 54 | + }, |
| 55 | + "React Bricks selectOptions": { |
| 56 | + "prefix": "selectOptions", |
| 57 | + "body": [ |
| 58 | + "selectOptions: {", |
| 59 | + "\tdisplay: types.OptionsDisplay.${1|Select,Radio,Color|},", |
| 60 | + "\toptions: [", |
| 61 | + "\t\t{ value: '${2:value}', label: '${3:Label}' },", |
| 62 | + "\t]", |
| 63 | + "}" |
| 64 | + ], |
| 65 | + "description": "Creates `selectOptions` for a select `sideEditProp`" |
| 66 | + }, |
| 67 | + "React Bricks Text": { |
| 68 | + "prefix": "Text", |
| 69 | + "body": [ |
| 70 | + "<Text", |
| 71 | + "\tpropName=\"${1:text}\"", |
| 72 | + "\tplaceholder=\"Type a ${1:text}...\"", |
| 73 | + "\trenderBlock={({ children \\}) => ${2:(<span>{children\\}</span>)}}", |
| 74 | + "/>" |
| 75 | + ], |
| 76 | + "description": "Add a React Bricks <Text> component" |
| 77 | + }, |
| 78 | + "React Bricks RichText": { |
| 79 | + "prefix": "RichText", |
| 80 | + "body": [ |
| 81 | + "<RichText", |
| 82 | + "\tpropName=\"${1:text}\"", |
| 83 | + "\tplaceholder=\"Type a ${1:text}...\"", |
| 84 | + "\trenderBlock={({ children \\}) => (${2:<span>{children\\}</span>})}", |
| 85 | + "\tallowedFeatures={[types.RichTextFeatures.${3:Bold}]}", |
| 86 | + "/>" |
| 87 | + ], |
| 88 | + "description": "Add a React Bricks <RichText> component" |
| 89 | + }, |
| 90 | + "React Bricks Image": { |
| 91 | + "prefix": "Image", |
| 92 | + "body": [ |
| 93 | + "<Image", |
| 94 | + "\tpropName=\"${1:image}\"", |
| 95 | + "\talt=\"${2:altText}\"", |
| 96 | + "\tmaxWidth={${3:300}}", |
| 97 | + "\taspectRatio={${4:1}}", |
| 98 | + "/>" |
| 99 | + ], |
| 100 | + "description": "Add a React Bricks <Image> component" |
| 101 | + }, |
| 102 | + "React Bricks File": { |
| 103 | + "prefix": "File", |
| 104 | + "body": [ |
| 105 | + "<File", |
| 106 | + "\tpropName=\"${1:file}\"", |
| 107 | + "\tallowedExtensions={[${2:'.pdf'}]}", |
| 108 | + "\trenderBlock={({ name, url, size }) => (", |
| 109 | + "\t\t<a href={url}>", |
| 110 | + "\t\t\t{name}, {size / 1000}KB", |
| 111 | + "\t\t</a>", |
| 112 | + "\t)}", |
| 113 | + "/>" |
| 114 | + ], |
| 115 | + "description": "Add React Bricks <File> component" |
| 116 | + }, |
| 117 | + "React Bricks Repeater": { |
| 118 | + "prefix": "Repeater", |
| 119 | + "body": ["<Repeater propName=\"${1:propName}\" />"], |
| 120 | + "description": "Add React Bricks <Repeater> component" |
| 121 | + } |
| 122 | +} |
0 commit comments