diff --git a/src/Button/button-group.mdx b/src/Button/button-group.mdx index 07c1d88d89..9ea7218d81 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 ab72712afe..a1cbe98ab7 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 8e17ea966f..a339c58aa9 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 169df227b4..f295d3ef53 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 d4bcf1e9a8..b19fd28b25 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 82d2ed8b4d..da86dc330c 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 a28ca9f185..b73325108e 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 2a0ec266f8..d2697a4c18 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/LeaveFeedback.tsx b/www/src/components/LeaveFeedback.tsx index aa08e0cff4..de42cb9133 100644 --- a/www/src/components/LeaveFeedback.tsx +++ b/www/src/components/LeaveFeedback.tsx @@ -22,7 +22,6 @@ function LeaveFeedback({ isNavLink, ...props }: LeaveFeedbackProps) { onClick={handleLinkFeedbackClick} href={FEEDBACK_URL} target="_blank" - rel="noopener noreferrer" {...props} > {leaveFeedbackLinkTitle} diff --git a/www/src/components/PageEditBtn/index.tsx b/www/src/components/PageEditBtn/index.tsx new file mode 100644 index 0000000000..a158090389 --- /dev/null +++ b/www/src/components/PageEditBtn/index.tsx @@ -0,0 +1,54 @@ +import React, { AnchorHTMLAttributes } from 'react'; +import PropTypes from 'prop-types'; +import { Button, Hyperlink, Nav } from '~paragon-react'; + +export interface PageEditBtnProps extends Partial> { + githubEditPath: string, + isNavLink?: boolean; +} + +function PageEditBtn({ githubEditPath, isNavLink, ...props }: PageEditBtnProps) { + const pageEditLinkTitle = 'Edit this page'; + + const handlePageEditBtnClick = () => { + global.analytics.track('openedx.paragon.docs.page_edit.clicked'); + }; + + if (isNavLink) { + return ( + + {pageEditLinkTitle} + + ); + } + + return ( + + ); +} + +PageEditBtn.propTypes = { + githubEditPath: PropTypes.string.isRequired, + isNavLink: PropTypes.bool, +}; + +PageEditBtn.defaultProps = { + isNavLink: false, +}; + +export default PageEditBtn; diff --git a/www/src/components/PageLayout.tsx b/www/src/components/PageLayout.tsx index 06ec4d65df..932eaf4fe2 100644 --- a/www/src/components/PageLayout.tsx +++ b/www/src/components/PageLayout.tsx @@ -17,6 +17,7 @@ import { Sticky, useMediaQuery, breakpoints, + Stack, } from '~paragon-react'; import ComponentsList from './ComponentsList'; import Header from './header'; @@ -26,6 +27,7 @@ import Toc from './Toc'; import { SettingsContext } from '../context/SettingsContext'; import LeaveFeedback from './LeaveFeedback'; import AutoToc from './AutoToc'; +import PageEditBtn from './PageEditBtn'; if (process.env.NODE_ENV === 'development') { /* eslint-disable-next-line global-require */ @@ -40,6 +42,7 @@ export interface ILayout { tocData: Array, tab?: string, isAutoToc?: boolean, + githubEditPath?: string, } function Layout({ @@ -50,6 +53,7 @@ function Layout({ tocData, isAutoToc, tab, + githubEditPath, }: ILayout) { const isMobile = useMediaQuery({ maxWidth: breakpoints.extraLarge.minWidth }); const { settings } = useContext(SettingsContext); @@ -88,7 +92,12 @@ function Layout({ {children}
- + + {isMdx && ( + + )} + +
+ {isMdx && ( + + + + )}
, componentsUsageInsights: string[], + githubEditPath: string, } } @@ -50,7 +54,7 @@ export type ShortCodesTypes = { export default function PageTemplate({ data: { mdx, components: componentNodes }, - pageContext: { scssVariablesData, componentsUsageInsights }, + pageContext: { scssVariablesData, componentsUsageInsights, githubEditPath }, }: IPageTemplate) { const isMobile = useMediaQuery({ maxWidth: breakpoints.large.maxWidth }); const [showMinimizedTitle, setShowMinimizedTitle] = useState(false); @@ -127,6 +131,7 @@ export default function PageTemplate({ showMinimizedTitle={showMinimizedTitle} isMdx tocData={getTocData()} + githubEditPath={githubEditPath} > {/* eslint-disable-next-line react/jsx-pascal-case */} @@ -137,10 +142,24 @@ export default function PageTemplate({

{mdx.frontmatter.notes}

)} -
-

{mdx.frontmatter.title}

- -
+ +

+ {mdx.frontmatter.title} +

+ + + + +
{mdx.body} diff --git a/www/utils/createPages.js b/www/utils/createPages.js index e28cf61e57..394fbea1e0 100644 --- a/www/utils/createPages.js +++ b/www/utils/createPages.js @@ -29,6 +29,7 @@ async function createPages(graphql, actions, reporter) { components } slug + fileAbsolutePath } } } @@ -47,6 +48,7 @@ async function createPages(graphql, actions, reporter) { for (const { node } of components) { const componentDir = node.slug.split('/')[0]; const variablesPath = path.resolve(__dirname, `../../src/${componentDir}/_variables.scss`); + const githubEditPath = `https://github.com/openedx/paragon/edit/master/src${node.fileAbsolutePath.split('src')[1]}`; let scssVariablesData = {}; if (fs.existsSync(variablesPath)) { @@ -67,6 +69,7 @@ async function createPages(graphql, actions, reporter) { components: node.frontmatter.components || [], scssVariablesData, componentsUsageInsights: Object.keys(componentsUsage), + githubEditPath, }, }); }