Skip to content

Commit 2cf3fd8

Browse files
committed
Create bricks code compatible with React Server Components
1 parent b68e468 commit 2cf3fd8

File tree

5 files changed

+30
-21
lines changed

5 files changed

+30
-21
lines changed

CHANGELOG.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Change Log
22

3-
All notable changes to the "react-bricks-snippets" extension will be documented in this file.
3+
## 0.0.3
44

5-
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
5+
- Initial release
66

7-
## [Unreleased]
7+
## 0.1.0
88

9-
- Initial release
9+
- Bricks code compatible with React Server Components

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2022 React Bricks (F2 .net engineering s.r.l.)
1+
Copyright 2024 React Bricks (F2 .net engineering s.r.l.)
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
44

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ You can easily create a project using the React Bricks CLI:
3030

3131
## Release Notes
3232

33-
### 0.0.1
33+
### 0.0.1 - 0.0.3
3434

3535
Initial release
36+
37+
### 0.0.4
38+
39+
Bricks code compatible with React Server Components

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "react-bricks-snippets",
3-
"version": "0.0.3",
4-
"publisher": "ReactBricks",
3+
"version": "0.0.4",
4+
"publisher": "React Bricks",
55
"displayName": "React Bricks Snippets",
66
"description": "React Bricks code snippets (TypeScript)",
77
"repository": {
@@ -11,6 +11,7 @@
1111
"license": "SEE LICENSE IN LICENSE",
1212
"keywords": [
1313
"react bricks",
14+
"reactbricks",
1415
"react",
1516
"bricks",
1617
"react cms"

snippets/typescript.code-snippets

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,29 @@
33
"prefix": "brick",
44
"body": [
55
"import React from 'react'",
6-
"import { Text, RichText, Image, File, Repeater, types } from 'react-bricks/frontend'",
6+
"import { types, Text } from 'react-bricks/${2|frontend,rsc|}'",
77
"",
8-
"interface Props {",
9-
"\t",
8+
"interface ${1:${TM_FILENAME_BASE}}Props {",
9+
"\ttitle: types.TextValue",
1010
"}",
1111
"",
12-
"const ${1:${TM_FILENAME_BASE}}: types.Brick<Props> = (props) => {",
12+
"const ${1:${TM_FILENAME_BASE}}: types.Brick<${1:${TM_FILENAME_BASE}}Props> = ({ title }) => {",
1313
"\treturn (",
1414
"\t\t<div>",
1515
"\t\t\t<Text",
1616
"\t\t\t\tpropName=\"title\"",
17-
"\t\t\t\tplaceholder=\"Title...\"",
18-
"\t\t\t\trenderBlock={({ children }) => (<span>{children}</span>)}",
17+
"\t\t\t\tvalue={title}",
18+
"\t\t\t\tplaceholder=\"Type a title...\"",
19+
"\t\t\t\trenderBlock={({ children }) => (<h1>{children}</h1>)}",
1920
"\t\t\t/>$0",
2021
"\t\t</div>",
2122
"\t)",
2223
"}",
2324
"",
2425
"${1:${TM_FILENAME_BASE}}.schema = {",
25-
"\tname: '${1:${TM_FILENAME_BASE}}',",
26+
"\t$LINE_COMMENT Unique brick name",
27+
"\tname: '${TM_FILENAME_BASE/(.*)/${1:/downcase}/}',",
2628
"\tlabel: '${1:${TM_FILENAME_BASE}}',",
27-
"\t$LINE_COMMENT category: '',",
28-
"\t$LINE_COMMENT tags: [],",
2929
"",
3030
"\t$LINE_COMMENT Defaults when a new brick is added",
3131
"\tgetDefaultProps: () => ({",
@@ -47,7 +47,7 @@
4747
"{",
4848
"\tname: '${1:name}',",
4949
"\tlabel: '${2:Label}',",
50-
"\ttype: types.SideEditPropType.${3|Text,Textarea,Number,Date,Boolean,Select,Range,Image,Custom|},",
50+
"\ttype: types.SideEditPropType.${3|Text,Textarea,Number,Date,Boolean,Select,Autocomplete,Range,Image,Relationship,Custom|},",
5151
"}"
5252
],
5353
"description": "Creates a React Bricks' Brick `sideEditProp`"
@@ -69,8 +69,9 @@
6969
"body": [
7070
"<Text",
7171
"\tpropName=\"${1:text}\"",
72+
"\tvalue={${1:text}}",
7273
"\tplaceholder=\"Type a ${1:text}...\"",
73-
"\trenderBlock={({ children \\}) => ${2:(<span>{children\\}</span>)}}",
74+
"\trenderBlock={({ children }) => ${2:(<span>{children\\}</span>)}}",
7475
"/>"
7576
],
7677
"description": "Add a React Bricks <Text> component"
@@ -80,8 +81,9 @@
8081
"body": [
8182
"<RichText",
8283
"\tpropName=\"${1:text}\"",
84+
"\tvalue={${1:text}}",
8385
"\tplaceholder=\"Type a ${1:text}...\"",
84-
"\trenderBlock={({ children \\}) => (${2:<span>{children\\}</span>})}",
86+
"\trenderBlock={({ children }) => (${2:<span>{children\\}</span>})}",
8587
"\tallowedFeatures={[types.RichTextFeatures.${3:Bold}]}",
8688
"/>"
8789
],
@@ -92,6 +94,7 @@
9294
"body": [
9395
"<Image",
9496
"\tpropName=\"${1:image}\"",
97+
"\tsource={${1:image}}",
9598
"\talt=\"${2:altText}\"",
9699
"\tmaxWidth={${3:300}}",
97100
"\taspectRatio={${4:1}}",
@@ -104,6 +107,7 @@
104107
"body": [
105108
"<File",
106109
"\tpropName=\"${1:file}\"",
110+
"\tsource={${1:file}}",
107111
"\tallowedExtensions={[${2:'.pdf'}]}",
108112
"\trenderBlock={({ name, url, size }) => (",
109113
"\t\t<a href={url}>",
@@ -116,7 +120,7 @@
116120
},
117121
"React Bricks Repeater": {
118122
"prefix": "Repeater",
119-
"body": ["<Repeater propName=\"${1:propName}\" />"],
123+
"body": ["<Repeater propName=\"${1:items}\" items={${1:items}} />"],
120124
"description": "Add React Bricks <Repeater> component"
121125
}
122126
}

0 commit comments

Comments
 (0)