Skip to content

Commit e129f08

Browse files
committed
docs(many): remove class based examples
keep only functional examples remove code that rendered both rearrange components a bit: move ScreenReaderContent/...Content to utilites/a11y, move Options and Selectable to Utilities INSTUI-4753
1 parent 93f129b commit e129f08

File tree

65 files changed

+6349
-17024
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+6349
-17024
lines changed

docs/contributor-docs/writing-docs.md

Lines changed: 72 additions & 168 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ If a code example is needed with syntax highlighting:
5454
type: 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

6565
The 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
8282
type: 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

9393
The 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
117117
type: 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

135135
The above code will display like this:
@@ -155,50 +155,6 @@ type: example
155155
type: 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
---
204160
type: example
@@ -233,109 +189,57 @@ render() {
233189
/>
234190
</div>
235191
);
236-
}
237192
}
193+
}
194+
238195

239196
render(<Example />);
240197
```
198+
````
241199

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`.
200+
The above code will display like this:
247201

248-
````md
202+
```js
249203
---
250-
type: code
204+
type: example
251205
---
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+
}
252224

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-
225+
render() {
282226
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:
296-
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-
)
227+
<div>
228+
<ColorPreset
229+
label="Choose a color"
230+
colors={this.state.colors}
231+
selected={this.state.selected}
232+
onSelect={(selected) => this.setState({ selected })}
233+
/>
234+
</div>
235+
);
316236
}
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-
}
237+
}
334238

335-
render(<Example />)
336-
```
239+
render(<Example />);
240+
```
337241

338-
**_Note:_** beacuse of this feature, code examples can not be displayed by `lists`
242+
**_Note:_** you should use `funcional React`.
339243

340244
#### 5. comment examples
341245

@@ -358,17 +262,17 @@ The other three can be postfixed after the language of the markdown code block:
358262
---
359263
type: code
360264
---
361-
```js-code
362-
// code here
363-
```
265+
```js-code
266+
// code here
267+
```
364268
365-
```js-embed
366-
// code here
367-
```
269+
```js-embed
270+
// code here
271+
```
368272
369-
```js-example
370-
// code here
371-
```
273+
```js-example
274+
// code here
275+
```
372276
````
373277

374278
The compiler will strip the postfix and calculate the language and type from it as well.

0 commit comments

Comments
 (0)