-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docs): add utility examples (#1867)
* feat(docs and test harnesses): switch test property to tags that includes 'test' for search * fix(core): enum cannot be exported as a type * chore(deps): bump lerna, @types/node, eslint-plugin-jsdoc, angular, dompurify, @carbon/*, vitest, highlight.js, vue-tsc * fix(stackblitz): margins * feat(docs/utility): add utility examples * fix(docs/area/example): type error
- Loading branch information
1 parent
2b2ac7a
commit 026e12a
Showing
56 changed files
with
1,893 additions
and
841 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react' | ||
import * as ChartComponents from '@carbon/charts-react' | ||
import StackBlitzLauncher from './StackBlitzLauncher' | ||
import { filterByTag } from '../charts' | ||
|
||
interface ConfigExampleProps { | ||
tag: string | ||
} | ||
|
||
export default function ConfigExample({ tag }: ConfigExampleProps) { | ||
const examples = filterByTag(tag) | ||
|
||
return ( | ||
<> | ||
{examples.map((chart, chartIndex) => { | ||
const ChartComponent = ChartComponents[ | ||
chart.types.react as keyof typeof ChartComponents | ||
] as React.ComponentType<any> | ||
return ( | ||
<div key={chartIndex}> | ||
{chart.examples.map((example, exampleIndex) => ( | ||
<p key={exampleIndex} className="chart"> | ||
<ChartComponent data={example.data} options={example.options} /> | ||
<StackBlitzLauncher example={example} chartTypes={chart.types} /> | ||
</p> | ||
))} | ||
</div> | ||
) | ||
})} | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import PageHeader from './PageHeader' | ||
import ConfigExamples from './ConfigExamples' | ||
|
||
interface UtilityExampleProps { | ||
title: string | ||
overview: string | ||
tag: string | ||
} | ||
|
||
export default function UtilityExample({ title, overview, tag }: UtilityExampleProps) { | ||
return ( | ||
<> | ||
<PageHeader title={title} /> | ||
|
||
<h2>Overview</h2> | ||
|
||
<p>{overview}</p> | ||
|
||
<ConfigExamples tag={tag} /> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.