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",

src/components/badge/badge.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Badge",
3-
"category": "basic",
3+
"category": "status",
44
"description": "Round colored badge, typically used to show a number",
55
"extends": ["basic/TouchableOpacity", "basic/View"],
66
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/BadgesScreen.tsx",

src/components/button/button.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Button",
3-
"category": "basic",
3+
"category": "controls",
44
"description": "Customizable button component that handles press events",
55
"extends": ["basic/TouchableOpacity"],
66
"modifiers": ["margin", "background"],

src/components/card/card.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Card",
3-
"category": "basic",
3+
"category": "layout",
44
"description": "Customizable card component that handles press events",
55
"extends": ["basic/TouchableOpacity"],
66
"modifiers": ["margin", "padding"],

src/components/card/cardImage.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Card.Image",
3-
"category": "basic",
3+
"category": "layout",
44
"description": "Inner component for the Card component (better be a direct child)",
55
"extends": ["basic/Image"],
66
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/CardsScreen.tsx",

src/components/card/cardSection.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Card.Section",
3-
"category": "basic",
3+
"category": "layout",
44
"description": "Inner component for rendering content easily inside a Card component",
55
"extends": ["basic/View"],
66
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/CardsScreen.tsx",

src/components/carousel/carousel.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Carousel",
3-
"category": "basic",
3+
"category": "layout",
44
"description": "Carousel for scrolling pages",
55
"extends": ["ScrollView"],
66
"extendsLink": ["https://reactnative.dev/docs/scrollview"],

src/components/checkbox/checkbox.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Checkbox",
3-
"category": "form",
3+
"category": "controls",
44
"description": "Checkbox component for toggling boolean value related to some context",
55
"extends": ["basic/TouchableOpacity"],
66
"modifiers": ["margin", "background"],

src/components/chip/chip.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Chip",
3-
"category": "basic",
3+
"category": "controls",
44
"description": "Chip component",
55
"extends": ["TouchableOpacity", "View"],
66
"extendsLink": [

src/components/connectionStatusBar/connectionStatusBar.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ConnectionStatusBar",
3-
"category": "basic",
3+
"category": "status",
44
"description": "Top bar to show a 'no internet' connection status",
55
"note": [
66
"Run on real device for best results",

src/components/drawer/drawer.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Drawer",
3-
"category": "basic",
3+
"category": "lists",
44
"description": "Drawer Component",
55
"note": "If your app works with RNN, your screen must be wrapped with gestureHandlerRootHOC from 'react-native-gesture-handler'. see: https://kmagiera.github.io/react-native-gesture-handler/docs/getting-started.html#with-wix-react-native-navigation-https-githubcom-wix-react-native-navigation",
66
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/DrawerScreen.tsx",

src/components/expandableSection/expandableSection.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ExpandableSection",
3-
"category": "basic",
3+
"category": "infra",
44
"description": "Component to render expanded section below or above the SectionHeader",
55
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/ExpandableSectionScreen.tsx",
66
"images": [

src/components/fader/fader.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Fader",
3-
"category": "layoutsAndTemplates",
3+
"category": "infra",
44
"description": "A gradient fading overlay to render on top of overflowing content (like scroll component)",
55
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/FaderScreen.tsx",
66
"images": ["https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/Fader/Fader.gif?raw=true"],

src/components/gridList/gridList.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "GridList",
3-
"category": "layoutsAndTemplates",
3+
"category": "lists",
44
"description": "An auto-generated grid list that calculate item size according to given props",
55
"extends": ["FlatList"],
66
"extendsLink": ["https://reactnative.dev/docs/flatlist"],

src/components/gridListItem/gridListItem.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "GridListItem",
3-
"category": "layoutsAndTemplates",
3+
"category": "lists",
44
"description": "A single grid view/list item component",
55
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/GridViewScreen.tsx",
66
"props": [

src/components/gridView/gridView.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "GridView",
3-
"category": "layoutsAndTemplates",
3+
"category": "lists",
44
"description": "An auto-generated grid view that calculate item size according to given props",
55
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/GridViewScreen.tsx",
66
"props": [

src/components/icon/icon.api.json

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

src/components/image/image.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Image",
3-
"category": "basic",
3+
"category": "media",
44
"description": "Image wrapper with extra functionality like source transform and assets support",
55
"extends": ["Image"],
66
"extendsLink": ["https://reactnative.dev/docs/image"],

src/components/listItem/listItem.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ListItem",
3-
"category": "basic",
3+
"category": "lists",
44
"description": "List item component to render inside a List component",
55
"extends": ["TouchableOpacity"],
66
"extendsLink": ["https://reactnative.dev/docs/touchableopacity"],

src/components/listItem/listItemPart.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ListItem.Part",
3-
"category": "basic",
3+
"category": "lists",
44
"description": "A sub ListItem component for layout-ing inside a ListItem",
55
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/BasicListScreen.tsx",
66
"images": ["https://media.giphy.com/media/l1IBjHowyPcOTWAY8/giphy.gif"],

src/components/loaderScreen/loaderScreen.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "LoaderScreen",
3-
"category": "layoutsAndTemplates",
3+
"category": "layout",
44
"description": "Component that shows a full screen with an activity indicator",
55
"extends": ["ActivityIndicator"],
66
"extendsLink": ["https://reactnative.dev/docs/activityindicator"],

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Modal",
3-
"category": "layoutsAndTemplates",
3+
"category": "overlays",
44
"description": "Component that present content on top of the invoking screen",
55
"extends": ["Modal"],
66
"extendsLink": ["https://reactnative.dev/docs/modal"],

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Modal.TopBar",
3-
"category": "layoutsAndTemplates",
3+
"category": "overlays",
44
"description": "Modal.TopBar, inner component for configuring the Modal component's title, buttons and statusBar",
55
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/ModalScreen.tsx",
66
"images": ["https://media.giphy.com/media/3oFzmfSX8KgvctI4Ks/giphy.gif"],

src/components/overlay/overlay.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Overlay",
3-
"category": "basic",
3+
"category": "infra",
44
"description": "Overlay view with types",
55
"extends": ["Image"],
66
"extendsLink": ["https://reactnative.dev/docs/image"],

src/components/pageControl/pageControl.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "PageControl",
3-
"category": "basic",
3+
"category": "navigation",
44
"description": "Page indicator, typically used in paged scroll-views",
55
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/PageControlScreen.tsx",
66
"images": ["https://user-images.githubusercontent.com/1780255/107114259-2e278d00-686d-11eb-866c-59f3d410d6c3.gif"],

src/components/progressBar/progressBar.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ProgressBar",
3-
"category": "basic",
3+
"category": "status",
44
"description": "Progress bar",
55
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/ProgressBarScreen.tsx",
66
"props": [

src/components/progressiveImage/progressiveImage.api.json

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

src/components/radioButton/radioButton.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "RadioButton",
3-
"category": "form",
3+
"category": "controls",
44
"description": "A Radio Button component, should be wrapped with a RadioGroup",
55
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/RadioButtonScreen.js",
66
"images": [

src/components/radioGroup/radioGroup.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "RadioGroup",
3-
"category": "form",
3+
"category": "controls",
44
"description": "Wrap a group of Radio Buttons to automatically control their selection",
55
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/RadioButtonScreen.js",
66
"images": [

src/components/skeletonView/skeletonView.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "SkeletonView",
3-
"category": "layoutsAndTemplates",
3+
"category": "status",
44
"description": "Allows showing a temporary skeleton view while your real view is loading",
55
"modifiers": ["margin"],
66
"note": "Requires installing the 'react-native-shimmer-placeholder' and 'react-native-linear-gradient' libraries",

0 commit comments

Comments
 (0)