Skip to content

Commit 3155f8d

Browse files
docsite - add "note" entry (wix#2244)
* apis - move to "note" attribute * buidDocs script - add component's "note" and prop's "note" content to render * Don't render if there's no "note" entry * fix FloatingButton docs Co-authored-by: Ethan Sharabi <1780255+ethanshar@users.noreply.github.com>
1 parent 35f70df commit 3155f8d

File tree

8 files changed

+30
-18
lines changed

8 files changed

+30
-18
lines changed

lib/components/Keyboard/KeyboardInput/keyboardAccessoryView.api.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
{
1616
"name": "kbInputRef",
1717
"type": "any",
18-
"description": "The reference to the actual text input (or the keyboard may not reset when instructed to, etc.).\niOS only.",
19-
"required": true
18+
"description": "The reference to the actual text input (or the keyboard may not reset when instructed to, etc.).",
19+
"required": true,
20+
"note": "iOS only"
2021
},
2122
{
2223
"name": "kbComponent",

lib/components/Keyboard/KeyboardTracking/KeyboardTrackingView/keyboardTrackingView.api.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,56 +27,56 @@
2727
{
2828
"name": "revealKeyboardInteractive",
2929
"type": "boolean",
30-
"description": "Show the keyboard on a negative scroll\niOS only.",
30+
"description": "Show the keyboard on a negative scroll.",
3131
"note": "iOS only",
3232
"default": "false"
3333
},
3434
{
3535
"name": "manageScrollView",
3636
"type": "boolean",
37-
"description": "Set to false to turn off inset management and manage it yourself\niOS only.",
37+
"description": "Set to false to turn off inset management and manage it yourself.",
3838
"note": "iOS only",
3939
"default": "true"
4040
},
4141
{
4242
"name": "requiresSameParentToManageScrollView",
4343
"type": "boolean",
44-
"description": "Set to true manageScrollView is set to true and still does not work,\nit means that the ScrollView found is the wrong one and you'll have\nto have the KeyboardAccessoryView and the ScrollView as siblings\nand set this to true\niOS only.",
44+
"description": "Set to true manageScrollView is set to true and still does not work,\nit means that the ScrollView found is the wrong one and you'll have\nto have the KeyboardAccessoryView and the ScrollView as siblings\nand set this to true.",
4545
"note": "iOS only",
4646
"default": "false"
4747
},
4848
{
4949
"name": "allowHitsOutsideBounds",
5050
"type": "boolean",
51-
"description": "Allow hitting sub-views that are placed beyond the view bounds\niOS only.",
51+
"description": "Allow hitting sub-views that are placed beyond the view bounds.",
5252
"note": "iOS only",
5353
"default": "false"
5454
},
5555
{
5656
"name": "addBottomView",
5757
"type": "boolean",
58-
"description": "Add a view beneath the KeyboardAccessoryView\niOS only.",
58+
"description": "Add a view beneath the KeyboardAccessoryView.",
5959
"note": "iOS only",
6060
"default": "false"
6161
},
6262
{
6363
"name": "bottomViewColor",
6464
"type": "string",
65-
"description": "The bottom view's color\niOS only.",
65+
"description": "The bottom view's color.",
6666
"note": "iOS only",
6767
"default": "white"
6868
},
6969
{
7070
"name": "useSafeArea",
7171
"type": "boolean",
72-
"description": "Whether or not to handle SafeArea\niOS only.",
72+
"description": "Whether or not to handle SafeArea.",
7373
"note": "iOS only",
7474
"default": "true"
7575
},
7676
{
7777
"name": "usesBottomTabs",
7878
"type": "boolean",
79-
"description": "Whether or not to include bottom tab bar inset\niOS only.",
79+
"description": "Whether or not to include bottom tab bar inset.",
8080
"note": "iOS only",
8181
"default": "false"
8282
},

scripts/buildDocs.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ components.forEach(component => {
8282
content += `:::\n`;
8383
}
8484

85+
if (component.note) {
86+
content += `:::note\n`;
87+
content += `${component.note}\n`;
88+
content += `:::\n`;
89+
}
90+
8591
/* Images */
8692
content +=
8793
`<div style={{display: 'flex', flexDirection: 'row', overflowX: 'auto', maxHeight: '500px', alignItems: 'center'}}>`;
@@ -102,7 +108,10 @@ components.forEach(component => {
102108
/* Props */
103109
content += `## API\n`;
104110
_.sortBy(component.props, p => p.name)?.forEach(prop => {
105-
content += `### ${prop.name}\n`;
111+
content += `### ${prop.name} \n`;
112+
if (prop.note) {
113+
content += `#### ${prop.note} \n`;
114+
}
106115
content += `${prop.description} \n`;
107116
// content += `<span style={{color: 'grey'}}>${_.escape(prop.type)}</span>\n\n`;
108117
content += `\`${prop.type} \` \n\n`;

src/components/card/card.api.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
"description": "Whether the card should have shadow or not",
2727
"default": "true"
2828
},
29-
{"name": "elevation", "type": "number", "description": "Elevation value (Android only)"},
30-
{"name": "enableBlur", "type": "boolean", "description": "Enable blur effect (iOS only)"},
29+
{"name": "elevation", "type": "number", "description": "Elevation value", "note": "Android only"},
30+
{"name": "enableBlur", "type": "boolean", "description": "Enable blur effect", "note": "iOS only"},
3131
{
3232
"name": "blurOptions",
3333
"type": "object",

src/components/floatingButton/floatingButton.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"name": "testID",
2424
"type": "string",
2525
"description": "The test id for e2e tests",
26-
"note": "<TestID> - the floatingButton container\n<TestID>.button - the floatingButton main button\n<TestID>.secondaryButton - the floatingButton secondaryButton"
26+
"note": "Use `testID.button` for the main button or `testID.secondaryButton` for the secondary"
2727
}
2828
],
2929
"snippet": [

src/components/modal/api/modal.api.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
{
1111
"name": "enableModalBlur",
1212
"type": "boolean",
13-
"description": "Blurs the modal background when transparent (iOS only)"
13+
"description": "Blurs the modal background when transparent",
14+
"note": "iOS only"
1415
},
1516
{
1617
"name": "blurView",
@@ -32,7 +33,8 @@
3233
{
3334
"name": "useGestureHandlerRootView",
3435
"type": "boolean",
35-
"description": "Should add a GestureHandlerRootView (Android only)"
36+
"description": "Should add a GestureHandlerRootView",
37+
"note": "Android only"
3638
}
3739
],
3840
"snippet": [

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"default": "Picker.modes.FORM"
3333
},
3434
{"name": "selectionLimit", "type": "number", "description": "Limit the number of selected items"},
35-
{"name": "enableModalBlur", "type": "boolean", "description": "Adds blur effect to picker modal (iOS only)"},
35+
{"name": "enableModalBlur", "type": "boolean", "description": "Adds blur effect to picker modal", "note": "iOS only"},
3636
{
3737
"name": "renderPicker",
3838
"type": "(selectedItem, itemLabel) => void",

src/incubator/toast/toast.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
{"name": "messageStyle", "type": "StyleProp<TextStyle>", "description": "Toast message style"},
1212
{"name": "centerMessage", "type": "boolean", "description": "Should message be centered in the toast"},
1313
{"name": "zIndex", "type": "number", "description": "Custom zIndex for toast"},
14-
{"name": "elevation", "type": "number", "description": "Custom elevation (Android only)"},
14+
{"name": "elevation", "type": "number", "description": "Custom elevation", "note": "Android only"},
1515
{
1616
"name": "action",
1717
"type": "ButtonProps",

0 commit comments

Comments
 (0)