Skip to content

Commit 6940940

Browse files
authored
Changed sidebar.js and buildDocs.js script according to the new categ… (#2133)
* Changed sidebar.js and buildDocs.js script according to the new categories. Changed the .api.json files to the new structure * Changed checkbox, radioButton, radioGroup, slider,switch catgories * Changed chip, badge, modal, fader, pageCarousel, modalTopBar catgories
1 parent c3873fd commit 6940940

File tree

57 files changed

+83
-69
lines changed

Some content is hidden

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

57 files changed

+83
-69
lines changed

docuilib/sidebars.js

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,20 @@
1010
*/
1111

1212
const componentsCategories = {
13-
Basic: 'basic',
14-
Form: 'form',
15-
Overlays: 'overlays',
16-
Layout: 'layoutsAndTemplates',
17-
Keyboard: 'keyboard',
18-
Incubator: 'incubator'
13+
// foundation: 'Foundation',
14+
// assets: 'Assets',
15+
navigation: 'Navigation',
16+
layout: 'Layout',
17+
controls: 'Controls',
18+
status: 'Status',
19+
media: 'Media',
20+
lists: 'Lists',
21+
form: 'Form',
22+
dateTime: 'Date & Time',
23+
overlays: 'Overlays',
24+
charts: 'Charts',
25+
incubator: 'Incubator',
26+
infra: 'Infra'
1927
};
2028

2129
module.exports = {
@@ -50,15 +58,16 @@ module.exports = {
5058
type: 'category',
5159
label: 'Components',
5260
collapsible: false,
53-
items: ['Basic', 'Form', 'Overlays', 'Layout', 'Keyboard', 'Incubator'].map(category => {
61+
// items: ['Basic', 'Lists', 'Form', 'Overlays', 'Layout', 'Keyboard', 'Incubator'].map(category => {
62+
items: Object.keys(componentsCategories).map(category => {
5463
return {
5564
type: 'category',
56-
label: category,
65+
label: componentsCategories[category],
5766
collapsed: false,
5867
items: [
5968
{
6069
type: 'autogenerated',
61-
dirName: `components/${componentsCategories[category]}`
70+
dirName: `components/${category}`
6271
}
6372
]
6473
};

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "KeyboardAccessoryView",
3-
"category": "keyboard",
3+
"category": "infra",
44
"description": "View that allows replacing the default keyboard with other components",
55
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/nativeComponentScreens/keyboardAccessory/KeyboardAccessoryViewScreen.js",
66
"images": [

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "KeyboardRegistry",
3-
"category": "keyboard",
3+
"category": "infra",
44
"description": "used for registering keyboards and performing certain actions on the keyboards.",
55
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/nativeComponentScreens/keyboardAccessory/demoKeyboards.js",
66
"props": [

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "KeyboardTrackingView",
3-
"category": "keyboard",
3+
"category": "infra",
44
"description": "A UI component that enables 'keyboard tracking' for this view and it's sub-views.\nWould typically be used when you have a TextField or TextInput inside this view.",
55
"note": "This view is useful only for iOS.",
66
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/nativeComponentScreens/KeyboardTrackingViewScreen.js",

lib/components/Keyboard/KeyboardTracking/keyboardAwareInsetsView.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "KeyboardAwareInsetsView",
3-
"category": "keyboard",
3+
"category": "infra",
44
"description": "Used to add an inset when a keyboard is used and might hide part of the screen.",
55
"note": "This view is useful only for iOS.",
66
"extends": ["keyboard/KeyboardTrackingView"],

scripts/buildDocs.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const childProcess = require('child_process');
33
const fs = require('fs');
44

55
const COMPONENTS_DOCS_DIR = './docs/components';
6+
const VALID_CATEGORIES = ['foundation', 'assets', 'navigation', 'layout', 'controls', 'status', 'media', 'lists', 'form', 'dateTime', 'overlays', 'charts', 'incubator', 'infra'];
67

78
const result = childProcess.execSync('find ./src ./lib/components -name "*api.json"');
89
const apiFiles = result.toString().trim().split('\n');
@@ -25,6 +26,10 @@ components.forEach(component => {
2526
const isParentComponent = parentComponents.includes(componentName);
2627
const isIncubatorComponent = component.category === 'incubator';
2728

29+
if (!VALID_CATEGORIES.includes(component.category)) {
30+
console.error(`${componentName} has invalid category "${component.category}"`);
31+
}
32+
2833
let content = '';
2934

3035
/* Markdown Front Matter */
@@ -40,7 +45,7 @@ components.forEach(component => {
4045
/* General */
4146
content += `${component.description} \n`;
4247
content += `[(code example)](${component.example})\n`;
43-
48+
4449
if (component.extends) {
4550
let extendsText = component.extends?.join(', ');
4651
if (component.extendsLink) {
@@ -66,8 +71,8 @@ components.forEach(component => {
6671
}
6772

6873
/* Images */
69-
content +=
70-
`<div style={{display: 'flex', flexDirection: 'row', overflowX: 'auto', maxHeight: '500px', alignItems: 'center'}}>`;
74+
content +=
75+
`<div style={{display: 'flex', flexDirection: 'row', overflowX: 'auto', maxHeight: '500px', alignItems: 'center'}}>`;
7176
component.images?.forEach(image => {
7277
content += `<img style={{maxHeight: '420px'}} src={'${image}'}/>`;
7378
content += '\n\n';
@@ -95,10 +100,10 @@ components.forEach(component => {
95100
const dirPath = `${COMPONENTS_DOCS_DIR}/${component.category}${componentParentDir}`;
96101

97102
if (!fs.existsSync(dirPath)) {
98-
fs.mkdirSync(dirPath, {recursive: true});
103+
fs.mkdirSync(dirPath, { recursive: true });
99104
}
100105

101-
fs.writeFileSync(`${dirPath}/${component.name}.md`, content, {encoding: 'utf8'});
106+
fs.writeFileSync(`${dirPath}/${component.name}.md`, content, { encoding: 'utf8' });
102107
});
103108

104109
function getComponentNameParts(componentName) {

src/components/actionBar/actionBar.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ActionBar",
3-
"category": "basic",
3+
"category": "controls",
44
"description": "Quick actions bar, each action support Button component props",
55
"extends": ["basic/View"],
66
"modifiers": ["margin", "padding"],

src/components/animatedImage/animatedImage.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "AnimatedImage",
3-
"category": "basic",
3+
"category": "media",
44
"description": "Image component that fades-in the image with animation once it's loaded",
55
"extends": ["basic/Image"],
66
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/AnimatedImageScreen.js",

src/components/animatedScanner/animatedScanner.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "AnimatedScanner",
3-
"category": "basic",
3+
"category": "media",
44
"description": "description",
55
"extends": ["Animated.View"],
66
"extendsLink": ["https://reactnative.dev/docs/animated"],

src/components/avatar/avatar.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Avatar",
3-
"category": "basic",
3+
"category": "media",
44
"description": "Avatar component for displaying user profile images",
55
"images": [
66
"https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/Avatar/Avarat_1.png?raw=true",

0 commit comments

Comments
 (0)