Skip to content

Commit fae1b39

Browse files
authored
Docs/basic components (#3669)
* Add empty hero section to basic components * Improve Picker snippet code
1 parent ce59e98 commit fae1b39

File tree

4 files changed

+75
-21
lines changed

4 files changed

+75
-21
lines changed

src/components/picker/api/picker.api.json

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,31 @@
107107
{"name": "customLoaderElement", "type": "ReactNode", "description": "Custom loader element"}
108108
],
109109
"snippet": [
110-
"<Picker",
111-
" value={2$1}",
112-
" placeholder={'Placeholder'$2}",
113-
" onChange={() => console.log('changed')$3}",
114-
" trailingAccessory={<Icon source={Assets.icons.demo.chevronDown}/>}",
115-
" items={[{label: 'Item 1', value: 1}, {label: 'Item 2', value: 2},{label: 'Item 3', value: 3}]}",
116-
">",
117-
"</Picker>"
110+
"function Example(props) {",
111+
" const [value, setValue] = useState(undefined);",
112+
"",
113+
" const FILTERS = [",
114+
" {value: 1, label: 'All'},",
115+
" {value: 2, label: 'Accessories'},",
116+
" {value: 3, label: 'Outwear'},",
117+
" {value: 4, label: 'Footwear'},",
118+
" {value: 5, label: 'Swimwear'},",
119+
" {value: 6, label: 'Tops'}",
120+
" ];",
121+
"",
122+
" return (",
123+
" <View flex padding-s5>",
124+
" <Picker",
125+
" value={value}",
126+
" preset='outline'",
127+
" placeholder={'Select filter'}",
128+
" label={'filter'}",
129+
" onChange={setValue}",
130+
" items={FILTERS}",
131+
" />",
132+
" </View>",
133+
" );",
134+
"}"
118135
],
119136
"docs": {
120137
"hero": {

src/components/text/text.api.json

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,22 @@
2525
{"name": "recorderTag", "type": "'mask' | 'unmask'", "description": "Recorder Tag"},
2626
{"name": "animated", "type": "boolean", "description": "Use Animated.Text as a container"}
2727
],
28-
"snippet": ["<Text text30$1>Text goes here$2</Text>"]
28+
"snippet": [
29+
"<View flex center gap-s2>",
30+
"<Text text30$1>Text30</Text>",
31+
"<Text text40 red30>Red</Text>",
32+
"<Text text60 uppercase>uppercase</Text>",
33+
"<Text text60 underline>underline</Text>",
34+
"<Text text70 highlightString='be' highlightStyle={{color: Colors.$textPrimary, fontWeight: 'bold'}}>To be, or not to be</Text>",
35+
"</View>"
36+
],
37+
"docs": {
38+
"hero": {
39+
"title": "Text",
40+
"description": "An enhanced version of React Native's Text component providing additional features and modifiers support",
41+
"type": "hero",
42+
"layout": "horizontal",
43+
"content": [{}]
44+
}
45+
}
2946
}

src/components/touchableOpacity/touchableOpacity.api.json

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,19 @@
3535
}
3636
],
3737
"snippet": [
38+
"<View flex center>",
3839
"<TouchableOpacity onPress={() => console.log('pressed')$1}>",
39-
" <Text text40>Click Me!</Text>",
40-
"</TouchableOpacity>"
41-
]
40+
" <Text text40>Touchable</Text>",
41+
"</TouchableOpacity>",
42+
"</View>"
43+
],
44+
"docs": {
45+
"hero": {
46+
"title": "TouchableOpacity",
47+
"description": "An enhanced version of React Native's TouchableOpacity component providing additional features and modifiers support",
48+
"type": "hero",
49+
"layout": "horizontal",
50+
"content": [{}]
51+
}
52+
}
4253
}

src/components/view/view.api.json

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,22 @@
2626
{"name": "style", "type": "ViewStyle", "description": "Custom style"}
2727
],
2828
"snippet": [
29-
"<View row gap-s5 centerV>",
30-
" <View style={{width: 200, height: 200}} bg-purple40 centerH>",
31-
" <View style={{width: 60, height: 60}} bg-green20/>",
32-
" </View>",
33-
" <View style={{width: 150, height: 150}} bg-orange30 bottom right>",
34-
" <View style={{width: 50, height: 50}} bg-yellow40 br100 margin-s2/>",
35-
" </View>",
36-
"</View>"
37-
]
29+
"<View row gap-s5 centerV>",
30+
" <View style={{width: 200, height: 200}} bg-purple40 centerH>",
31+
" <View style={{width: 60, height: 60}} bg-green20/>",
32+
" </View>",
33+
" <View style={{width: 150, height: 150}} bg-orange30 bottom right>",
34+
" <View style={{width: 50, height: 50}} bg-yellow40 br100 margin-s2/>",
35+
" </View>",
36+
"</View>"
37+
],
38+
"docs": {
39+
"hero": {
40+
"title": "View",
41+
"description": "An enhanced version of React Native's View component providing additional features and modifiers support",
42+
"type": "hero",
43+
"layout": "horizontal",
44+
"content": [{}]
45+
}
46+
}
3847
}

0 commit comments

Comments
 (0)