Skip to content

Fix broken extend links #2012

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
"category": "keyboard",
"description": "Used to add an inset when a keyboard is used and might hide part of the screen.",
"note": "This view is useful only for iOS.",
"extends": ["KeyboardTrackingView"],
"snippet": ["<KeyboardAwareInsetsView/>"]
"extends": ["keyboard/KeyboardTrackingView"],
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/incubatorScreens/IncubatorTextFieldScreen.tsx",
"snippet": ["<ScrollView>",
" <TextField/>",
" <TextField/>",
" <KeyboardAwareInsetsView/>",
"<ScrollView>"
]
}
9 changes: 7 additions & 2 deletions scripts/buildDocs.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ components.forEach(component => {
if (component.extendsLink) {
extendsText = `[${extendsText}](${component.extendsLink})`;
} else {
const extendedComponentName = _.last(_.split(extendsText, '/')); // Incubator/TextField -> TextField
extendsText = `[${extendedComponentName}](/docs/components/${extendsText})`;
extendsText = _.map(component.extends, generateExtendsLink).join(', ');
}
content += `:::info\n`;
content += `This component extends **${extendsText}** props.\n`;
Expand Down Expand Up @@ -110,3 +109,9 @@ function getComponentNameParts(componentName) {
return [parts[1], parts[0]];
}
}

function generateExtendsLink(extendsLink) {
const extendedComponentName = _.last(_.split(extendsLink, '/')); // Incubator/TextField -> TextField
const extendsText = `[${extendedComponentName}](/docs/components/${extendsLink})`;
Copy link
Collaborator

@Inbal-Tish Inbal-Tish Apr 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about instead of getting the extendsLink as "basic/TextField" we will build it using its category. Something like:
const extendsText = "[${extendsText}](/docs/components/${component.category}/${extendsLink})";
In that case we won't have to add the category prefix to each component's extends ("extends": ["basic/View"]) and leave it as it is. What do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The component.category is the not necessarily the category of the component it extends.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right... Ok. I guess there's no other way than...

return extendsText;
}
2 changes: 1 addition & 1 deletion src/components/actionBar/actionBar.api.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ActionBar",
"category": "basic",
"description": "Quick actions bar, each action support Button component props",
"extends": ["View"],
"extends": ["basic/View"],
"modifiers": ["margin", "padding"],
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/ActionBarScreen.tsx",
"images": ["https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/ActionBar/ActionBar.gif?raw=true"],
Expand Down
2 changes: 1 addition & 1 deletion src/components/actionSheet/actionSheet.api.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ActionSheet",
"category": "overlays",
"description": "Cross platform Action Sheet, with a support for native iOS solutions",
"extends": ["Dialog"],
"extends": ["overlays/Dialog"],
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/ActionSheetScreen.tsx",
"images": ["https://media.giphy.com/media/l0HUpXOR6RqB2ct5S/giphy.gif"],
"props": [
Expand Down
2 changes: 1 addition & 1 deletion src/components/animatedImage/animatedImage.api.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "AnimatedImage",
"category": "basic",
"description": "Image component that fades-in the image with animation once it's loaded",
"extends": ["Image"],
"extends": ["basic/Image"],
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/AnimatedImageScreen.js",
"images": ["https://media.giphy.com/media/l0HU7jj0ivEFyZIA0/giphy.gif"],
"props": [
Expand Down
2 changes: 1 addition & 1 deletion src/components/avatar/avatar.api.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/Avatar/Avarat_1.png?raw=true",
"https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/Avatar/Avarat_2.png?raw=true"
],
"extends": ["TouchableOpacity", "Image"],
"extends": ["basic/TouchableOpacity", "basic/Image"],
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/AvatarsScreen.tsx",
"props": [
{
Expand Down
2 changes: 1 addition & 1 deletion src/components/badge/badge.api.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Badge",
"category": "basic",
"description": "Round colored badge, typically used to show a number",
"extends": ["TouchableOpacity", "View"],
"extends": ["basic/TouchableOpacity", "basic/View"],
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/BadgesScreen.tsx",
"images": ["https://user-images.githubusercontent.com/33805983/34480753-df7a868a-efb6-11e7-9072-80f5c110a4f3.png"],
"props": [
Expand Down
2 changes: 1 addition & 1 deletion src/components/button/button.api.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Button",
"category": "basic",
"description": "Customizable button component that handles press events",
"extends": ["TouchableOpacity"],
"extends": ["basic/TouchableOpacity"],
"modifiers": ["margin", "background"],
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/ButtonsScreen.tsx",
"images": [
Expand Down
2 changes: 1 addition & 1 deletion src/components/card/card.api.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Card",
"category": "basic",
"description": "Customizable card component that handles press events",
"extends": ["TouchableOpacity"],
"extends": ["basic/TouchableOpacity"],
"modifiers": ["margin", "padding"],
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/CardsScreen.tsx",
"images": [
Expand Down
2 changes: 1 addition & 1 deletion src/components/card/cardImage.api.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Card.Image",
"category": "basic",
"description": "Inner component for the Card component (better be a direct child)",
"extends": ["Image"],
"extends": ["basic/Image"],
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/CardsScreen.tsx",
"props": [
{"name": "width", "type": "number", "description": "Width"},
Expand Down
2 changes: 1 addition & 1 deletion src/components/card/cardSection.api.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Card.Section",
"category": "basic",
"description": "Inner component for rendering content easily inside a Card component",
"extends": ["View"],
"extends": ["basic/View"],
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/CardsScreen.tsx",
"props": [
{
Expand Down
2 changes: 1 addition & 1 deletion src/components/checkbox/checkbox.api.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Checkbox",
"category": "form",
"description": "Checkbox component for toggling boolean value related to some context",
"extends": ["TouchableOpacity"],
"extends": ["basic/TouchableOpacity"],
"modifiers": ["margin", "background"],
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/CheckboxScreen.tsx",
"images": ["https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/Checkbox/Checkbox.gif?raw=true"],
Expand Down
2 changes: 1 addition & 1 deletion src/components/chipsInput/chipsInput.api.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ChipsInput",
"category": "form",
"description": "Chips input component",
"extends": ["TextField"],
"extends": ["incubator/TextField"],
"modifiers": ["typography"],
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/ChipsInputScreen.js",
"images": ["https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/ChipsInput/ChipsInput.gif?raw=true"],
Expand Down
2 changes: 1 addition & 1 deletion src/components/dateTimePicker/dateTimePicker.api.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"category": "form",
"description": "Date and Time Picker Component that wraps RNDateTimePicker for date and time modes. See: https://github.com/react-native-community/react-native-datetimepicker#react-native-datetimepicker",
"note": "DateTimePicker uses a native library. You MUST add and link the native library to both iOS and Android projects",
"extends": ["TextField"],
"extends": ["incubator/TextField"],
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/DateTimePickerScreen.js",
"images": [
"https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/DateTimePicker/DateTimePicker_iOS.gif?raw=true, https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/DateTimePicker/DateTimePicker_Android.gif?raw=true"
Expand Down