Skip to content

Commit

Permalink
add support for template inline alert
Browse files Browse the repository at this point in the history
  • Loading branch information
kmcfaul committed Feb 27, 2024
1 parent 1aff79d commit e7d84d2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/documentation-framework/scripts/md/parseMD.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ function toReactComponent(mdFilePath, source, buildMode) {
section: frontmatter.section || '',
subsection: frontmatter.subsection || '',
deprecated: frontmatter.deprecated || false,
template: frontmatter.template || false,
beta: frontmatter.beta || false,
demo: frontmatter.demo || false,
newImplementationLink: frontmatter.newImplementationLink || false,
Expand Down Expand Up @@ -295,6 +296,7 @@ function sourceMDFile(file, source, buildMode) {
...(pageData.hideNavItem && { hideNavItem: pageData.hideNavItem }),
...(pageData.beta && { beta: pageData.beta }),
...(pageData.deprecated && { deprecated: pageData.deprecated }),
...(pageData.template && { template: pageData.template }),
...(pageData.demo && { demo: pageData.demo }),
...(pageData.sortValue && { sortValue: pageData.sortValue }),
...(pageData.subsectionSortValue && { subsectionSortValue: pageData.subsectionSortValue })
Expand Down
7 changes: 7 additions & 0 deletions packages/documentation-framework/templates/mdx.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const MDXChildTemplate = ({
optIn,
beta,
deprecated,
template,
newImplementationLink,
functionDocumentation = []
} = Component.getPageData();
Expand Down Expand Up @@ -84,6 +85,12 @@ const MDXChildTemplate = ({
{' '}To learn more about the process, visit our <Link to="/get-started/about#major-release-cadence">about page</Link>.
</InlineAlert>
)}
{(template || source === 'react-template') && (
<InlineAlert title="Templates" variant="info">
{`This section showcases templates for the ${id} component. A template is a wrapped ${id} component use case that has built in logic with a streamlined API, and some limited customization.
For custom use cases that fall outside of a template's design, please use the ${id} component suite directly.`}
</InlineAlert>
)}
</React.Fragment>
);
// Create dynamic component for @reach/router
Expand Down

0 comments on commit e7d84d2

Please sign in to comment.