diff --git a/src/Breadcrumb/README.md b/src/Breadcrumb/README.md index 8f9665e827e..bd063bd2f11 100644 --- a/src/Breadcrumb/README.md +++ b/src/Breadcrumb/README.md @@ -1,5 +1,5 @@ --- -title: 'Breadcrumbs' +title: 'Breadcrumb' type: 'component' components: - Breadcrumb diff --git a/src/Button/button-group.mdx b/src/Button/button-group.mdx index 07c1d88d892..9ea7218d81d 100644 --- a/src/Button/button-group.mdx +++ b/src/Button/button-group.mdx @@ -1,5 +1,5 @@ --- -title: 'Button Group' +title: 'ButtonGroup' type: 'component' components: - ButtonGroup diff --git a/src/DataTable/dataviews.mdx b/src/DataTable/dataviews.mdx index ab72712afe4..a1cbe98ab7e 100644 --- a/src/DataTable/dataviews.mdx +++ b/src/DataTable/dataviews.mdx @@ -2,6 +2,10 @@ title: 'Data views' type: 'component' components: +- DataTable +- DataTableTable +- TableControlBar +- TableFooter - Table - TableCell - TableHeaderCell diff --git a/src/DataTable/tablefilters.mdx b/src/DataTable/tablefilters.mdx index 8e17ea966fb..a339c58aa98 100644 --- a/src/DataTable/tablefilters.mdx +++ b/src/DataTable/tablefilters.mdx @@ -1,5 +1,5 @@ --- -title: 'Table Filters' +title: 'TableFilters' type: 'component' components: - TextFilter diff --git a/src/Form/README.md b/src/Form/README.md index 169df227b4c..f295d3ef536 100644 --- a/src/Form/README.md +++ b/src/Form/README.md @@ -1,5 +1,5 @@ --- -title: 'Forms' +title: 'Form' type: 'component' components: - Form diff --git a/src/Form/input-group.mdx b/src/Form/input-group.mdx index d4bcf1e9a82..b19fd28b256 100644 --- a/src/Form/input-group.mdx +++ b/src/Form/input-group.mdx @@ -1,5 +1,5 @@ --- -title: 'Input Group' +title: 'InputGroup' type: 'component' categories: - Forms diff --git a/src/Overlay/README.md b/src/Overlay/README.md index 82d2ed8b4db..da86dc330c4 100644 --- a/src/Overlay/README.md +++ b/src/Overlay/README.md @@ -1,5 +1,5 @@ --- -title: 'Overlays' +title: 'Overlay' type: 'component' components: - Overlay diff --git a/src/PageBanner/README.md b/src/PageBanner/README.md index a28ca9f1857..b73325108e7 100644 --- a/src/PageBanner/README.md +++ b/src/PageBanner/README.md @@ -1,5 +1,5 @@ --- -title: 'Page Banner' +title: 'PageBanner' type: 'component' components: - PageBanner diff --git a/src/ProgressBar/README.md b/src/ProgressBar/README.md index 2a0ec266f8f..d2697a4c18b 100644 --- a/src/ProgressBar/README.md +++ b/src/ProgressBar/README.md @@ -1,5 +1,5 @@ --- -title: 'Progress Bar' +title: 'ProgressBar' type: 'component' components: - ProgressBar diff --git a/www/src/components/PageEditBtn.tsx b/www/src/components/PageEditBtn.tsx deleted file mode 100644 index 3da0e8dc05e..00000000000 --- a/www/src/components/PageEditBtn.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import React from 'react'; -import { Button } from '~paragon-react'; - -function PageEditBtn({ ...props }) { - const handlePageEditBtnClick = () => { - global.analytics.track('openedx.paragon.docs.page_edit.clicked'); - // TODO: further development of the CTA will add functionality. - }; - - return ( - - ); -} - -export default PageEditBtn; diff --git a/www/src/components/PageEditBtn/constants.js b/www/src/components/PageEditBtn/constants.js new file mode 100644 index 00000000000..ac326a2e07e --- /dev/null +++ b/www/src/components/PageEditBtn/constants.js @@ -0,0 +1,35 @@ +const BASE_PATH = 'https://github.com/openedx/paragon/edit/master/src'; + +const componentsNamesMap = { + 'AlertModal': 'Modal/alert-modal.mdx', + 'ButtonGroup': 'Button/button-group.mdx', + 'Data views': 'DataTable/dataviews.mdx', + 'Form.Autosuggest': 'Form/form-autosuggest.mdx', + 'Form.Checkbox': 'Form/form-checkbox.mdx', + 'Form.Control': 'Form/form-control.mdx', + 'Form.Control.Feedback': 'Form/form-control-feedback.mdx', + 'Form.Group': 'Form/form-group.mdx', + 'Form.Label': 'Form/form-label.mdx', + 'Form.Radio': 'Form/form-radio.mdx', + 'Form.Switch': 'Form/form-switch.mdx', + 'FullscreenModal': 'Modal/fullscreen-modal.mdx', + 'InputGroup': 'Form/input-group.mdx', + 'MarketingModal': 'Modal/marketing-modal.mdx', + 'ModalDialog': 'Modal/modal-dialog.mdx', + 'ModalLayer': 'Modal/modal-layer.mdx', + 'ModalPopup': 'Modal/modal-popup.mdx', + 'OverflowScroll': 'OverflowScroll/OverflowScroll.mdx', + 'SelectMenu': 'Menu/select-menu.md', + 'StandardModal': 'Modal/standard-modal.mdx', + 'TableControlBar': 'DataTable/tablecontrolbar.mdx', + 'TableFilters': 'DataTable/tablefilters.mdx', + 'TableFooter': 'DataTable/tablefooter.mdx', + 'useArrowKeyNavigation': 'hooks/useArrowKeyNavigation.mdx', + 'useIndexOfLastVisibleChild': 'hooks/useIndexOfLastVisibleChild.mdx', + 'useIsVisible': 'hooks/useIsVisible.mdx', + 'useOverflowScroll': 'OverflowScroll/useOverflowScroll.mdx', + 'useToggle': 'hooks/useToggle.mdx', + 'useWindowSize': 'hooks/useWindowSize.mdx', +}; + +export { BASE_PATH, componentsNamesMap }; diff --git a/www/src/components/PageEditBtn/index.tsx b/www/src/components/PageEditBtn/index.tsx new file mode 100644 index 00000000000..f807a858cbb --- /dev/null +++ b/www/src/components/PageEditBtn/index.tsx @@ -0,0 +1,35 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { Button, Hyperlink } from '~paragon-react'; +import { BASE_PATH, componentsNamesMap } from './constants'; + +function PageEditBtn({ componentTitle, ...props }) { + const pageEditUrl = componentsNamesMap[componentTitle] + ? `${BASE_PATH}/${componentsNamesMap[componentTitle]}` + : `${BASE_PATH}/${componentTitle}/README.md`; + + const handlePageEditBtnClick = () => { + global.analytics.track('openedx.paragon.docs.page_edit.clicked'); + }; + + return ( + + ); +} + +PageEditBtn.propTypes = { + componentTitle: PropTypes.string.isRequired, +}; + +export default PageEditBtn; diff --git a/www/src/templates/component-page-template.tsx b/www/src/templates/component-page-template.tsx index 5fc2badb5af..b649fc25b9b 100644 --- a/www/src/templates/component-page-template.tsx +++ b/www/src/templates/component-page-template.tsx @@ -99,6 +99,7 @@ export default function PageTemplate({ const usageInsightsUrl = 'usage-insights'; const sortedComponentNames = mdx.frontmatter?.components || []; + const componentTitle = mdx.frontmatter.title; const filteredComponentsUsageInsights = componentsUsageInsights.map(componentName => componentName.replace(/\./g, '')); const isUsageInsights = (sortedComponentNames as []).some(value => filteredComponentsUsageInsights.includes(value)); @@ -142,7 +143,7 @@ export default function PageTemplate({