@@ -54,12 +54,12 @@ If a code example is needed with syntax highlighting:
5454type: code
5555---
5656
57- ```js
58- ---
59- type: code
60- ---
61- console.log("my js example comes here")
62- ```
57+ ```js
58+ ---
59+ type: code
60+ ---
61+ console.log("my js example comes here")
62+ ```
6363````
6464
6565The above code will display like this:
@@ -82,12 +82,12 @@ The `type: embed` will render the containing code into the page. It must be vali
8282type: code
8383---
8484
85- ```js
86- ---
87- type: embed
88- ---
89- <Button>InstUI button</Button>
90- ```
85+ ```js
86+ ---
87+ type: embed
88+ ---
89+ <Button>InstUI button</Button>
90+ ```
9191````
9292
9393The above code will display like this:
@@ -117,19 +117,19 @@ In the second example, a whole `component` is needed and it must be `rendered` w
117117type: code
118118---
119119
120- ```js
121- ---
122- type: example
123- ---
124- <div>
125- <Avatar name="Sarah Robinson" src={avatarSquare} margin="0 small 0 0" />
126- <Avatar name="Sarah Robinson" margin="0 small 0 0" />
127- <Avatar name="Sarah Robinson" renderIcon={<IconGroupLine />} margin="0 small 0 0" />
128- <Avatar name="Kyle Montgomery" src={avatarSquare} shape="rectangle" margin="0 small 0 0" />
129- <Avatar name="Kyle Montgomery" shape="rectangle" margin="0 small 0 0" />
130- <Avatar name="Kyle Montgomery" renderIcon={<IconGroupLine />} shape="rectangle" />
131- </div>
132- ```
120+ ```js
121+ ---
122+ type: example
123+ ---
124+ <div>
125+ <Avatar name="Sarah Robinson" src={avatarSquare} margin="0 small 0 0" />
126+ <Avatar name="Sarah Robinson" margin="0 small 0 0" />
127+ <Avatar name="Sarah Robinson" renderIcon={<IconGroupLine />} margin="0 small 0 0" />
128+ <Avatar name="Kyle Montgomery" src={avatarSquare} shape="rectangle" margin="0 small 0 0" />
129+ <Avatar name="Kyle Montgomery" shape="rectangle" margin="0 small 0 0" />
130+ <Avatar name="Kyle Montgomery" renderIcon={<IconGroupLine />} shape="rectangle" />
131+ </div>
132+ ```
133133````
134134
135135The above code will display like this:
@@ -139,12 +139,12 @@ The above code will display like this:
139139type: example
140140-- -
141141< div>
142- < Avatar name= " Sarah Robinson" src= {avatarSquare} margin= " 0 small 0 0" / >
143- < Avatar name= " Sarah Robinson" margin= " 0 small 0 0" / >
144- < Avatar name= " Sarah Robinson" renderIcon= {< IconGroupLine / > } margin= " 0 small 0 0" / >
145- < Avatar name= " Kyle Montgomery" src= {avatarSquare} shape= " rectangle" margin= " 0 small 0 0" / >
146- < Avatar name= " Kyle Montgomery" shape= " rectangle" margin= " 0 small 0 0" / >
147- < Avatar name= " Kyle Montgomery" renderIcon= {< IconGroupLine / > } shape= " rectangle" / >
142+ < Avatar name= " Sarah Robinson" src= {avatarSquare} margin= " 0 small 0 0" / >
143+ < Avatar name= " Sarah Robinson" margin= " 0 small 0 0" / >
144+ < Avatar name= " Sarah Robinson" renderIcon= {< IconGroupLine / > } margin= " 0 small 0 0" / >
145+ < Avatar name= " Kyle Montgomery" src= {avatarSquare} shape= " rectangle" margin= " 0 small 0 0" / >
146+ < Avatar name= " Kyle Montgomery" shape= " rectangle" margin= " 0 small 0 0" / >
147+ < Avatar name= " Kyle Montgomery" renderIcon= {< IconGroupLine / > } shape= " rectangle" / >
148148< / div>
149149```
150150
@@ -155,187 +155,76 @@ type: example
155155type: code
156156---
157157
158- ```js
159- ---
160- type: example
161- ---
162- class Example extends React.Component {
163- constructor(props) {
164- super(props);
165- this.state = {
166- selected: "",
167- colors: [
168- "#ffffff",
169- "#0CBF94",
170- "#0C89BF00",
171- "#BF0C6D",
172- "#BF8D0C",
173- "#ff0000",
174- "#576A66",
175- "#35423A",
176- "#35423F",
177- ],
178- };
179- }
180-
181- render() {
182- return (
183- <div>
184- <ColorPreset
185- label="Choose a color"
186- colors={this.state.colors}
187- selected={this.state.selected}
188- onSelect={(selected) => this.setState({ selected })}
189- />
190- </div>
191- );
192- }
193- }
194-
195-
196- render(<Example />);
197- ```
198- ````
199-
200- The above code will display like this:
201-
202158```js
203159---
204160type: example
205161---
206- class Example extends React .Component {
207- constructor (props ) {
208- super (props);
209- this .state = {
210- selected: " " ,
211- colors: [
212- " #ffffff" ,
213- " #0CBF94" ,
214- " #0C89BF00" ,
215- " #BF0C6D" ,
216- " #BF8D0C" ,
217- " #ff0000" ,
218- " #576A66" ,
219- " #35423A" ,
220- " #35423F" ,
221- ],
222- };
223- }
224-
225- render () {
226- return (
162+ const Example = () => {
163+ const [selected, setSelected] = useState("")
164+ const [colors] = useState([
165+ "#ffffff",
166+ "#0CBF94",
167+ "#0C89BF00",
168+ "#BF0C6D",
169+ "#BF8D0C",
170+ "#ff0000",
171+ "#576A66",
172+ "#35423A",
173+ "#35423F",
174+ ])
175+
176+ return (
227177 <div>
228- < ColorPreset
178+ <ColorPreset
229179 label="Choose a color"
230- colors= {this . state . colors }
231- selected= {this . state . selected }
232- onSelect= {(selected ) => this . setState ({ selected } )}
233- / >
180+ colors={colors}
181+ selected={selected}
182+ onSelect={(selected) => setSelected( selected)}
183+ />
234184 </div>
235- );
236- }
185+ )
237186}
238187
239- render (< Example / > );
188+ render(<Example />)
240189```
190+ ````
241191
242- ** _ Note:_ ** you can use ` funcional React ` as well.
243-
244- #### 4. Multi example
245-
246- If an example should be shown in ` class ` and ` function ` form as well, it needs to be written as a ` list ` with two items. The first item will be the ` class ` , the second the ` function ` .
192+ The above code will display like this:
247193
248- ```` md
194+ ``` js
249195-- -
250- type: code
196+ type: example
251197-- -
198+ const Example = () => {
199+ const [selected , setSelected ] = useState (" " )
200+ const [colors ] = useState ([
201+ " #ffffff" ,
202+ " #0CBF94" ,
203+ " #0C89BF00" ,
204+ " #BF0C6D" ,
205+ " #BF8D0C" ,
206+ " #ff0000" ,
207+ " #576A66" ,
208+ " #35423A" ,
209+ " #35423F" ,
210+ ])
211+
212+ return (
213+ < div>
214+ < ColorPreset
215+ label= " Choose a color"
216+ colors= {colors}
217+ selected= {selected}
218+ onSelect= {(selected ) => setSelected (selected)}
219+ / >
220+ < / div>
221+ )
222+ }
252223
253- - ```js
254- class Example extends React.Component {
255- constructor(props) {
256- super(props)
257- this.state = {
258- counter: 0
259- }
260- }
261-
262- render() {
263- return (
264- <div>
265- <Button
266- onClick={() => this.setState({ counter: this.state.counter + 1 })}
267- >
268- I was Clicked {this.state.counter} times
269- </Button>
270- </div>
271- )
272- }
273- }
274-
275- render(<Example />)
276- ```
277-
278- - ```js
279- const Example = () => {
280- const [counter, setCounter] = useState(0)
281-
282- return (
283- <div>
284- <Button onClick={() => setCounter(counter + 1)}>
285- I was Clicked {counter} times
286- </Button>
287- </div>
288- )
289- }
290-
291- render(<Example />)
292- ```
293- ````
294-
295- The above code will display like this:
224+ render (< Example / > )
225+ ```
296226
297- - ``` js
298- class Example extends React .Component {
299- constructor (props ) {
300- super (props)
301- this .state = {
302- counter: 0
303- }
304- }
305-
306- render () {
307- return (
308- < div>
309- < Button
310- onClick= {() => this .setState ({ counter: this .state .counter + 1 })}
311- >
312- I was Clicked {this .state .counter } times
313- < / Button>
314- < / div>
315- )
316- }
317- }
318-
319- render (< Example / > )
320- ```
321-
322- - ``` js
323- const Example = () => {
324- const [counter , setCounter ] = useState (0 )
325-
326- return (
327- < div>
328- < Button onClick= {() => setCounter (counter + 1 )}>
329- I was Clicked {counter} times
330- < / Button>
331- < / div>
332- )
333- }
334-
335- render (< Example / > )
336- ```
337-
338- ** _ Note:_ ** beacuse of this feature, code examples can not be displayed by ` lists `
227+ ** _ Note:_ ** you should use ` funcional React ` .
339228
340229#### 5. comment examples
341230
@@ -358,17 +247,17 @@ The other three can be postfixed after the language of the markdown code block:
358247---
359248type: code
360249---
361- ```js-code
362- // code here
363- ```
250+ ```js-code
251+ // code here
252+ ```
364253
365- ```js-embed
366- // code here
367- ```
254+ ```js-embed
255+ // code here
256+ ```
368257
369- ```js-example
370- // code here
371- ```
258+ ```js-example
259+ // code here
260+ ```
372261````
373262
374263The compiler will strip the postfix and calculate the language and type from it as well.
0 commit comments