diff --git a/docs/src/components/ComponentDoc/ComponentProps/ComponentProps.tsx b/docs/src/components/ComponentDoc/ComponentProps/ComponentProps.tsx
index da59ef9873..9279eaf686 100644
--- a/docs/src/components/ComponentDoc/ComponentProps/ComponentProps.tsx
+++ b/docs/src/components/ComponentDoc/ComponentProps/ComponentProps.tsx
@@ -6,7 +6,7 @@ import { getComponentGroup } from 'docs/src/utils'
import ComponentTableProps from '../ComponentPropsTable'
import ComponentPropsComponents from './ComponentPropsComponents'
import ComponentPropsDescription from './ComponentPropsDescription'
-import { ICSSInJSStyle, Flex, Checkbox } from '@stardust-ui/react'
+import { ICSSInJSStyle, Flex } from '@stardust-ui/react'
const propsContainerStyle: ICSSInJSStyle = { overflowX: 'auto' }
@@ -14,12 +14,17 @@ export default class ComponentProps extends React.Component
{
static propTypes = {
displayName: PropTypes.string.isRequired,
props: PropTypes.arrayOf(PropTypes.object).isRequired,
+ defaultComponentProp: PropTypes.string,
+ onPropComponentSelected: PropTypes.func,
}
componentWillMount() {
- const { displayName } = this.props
+ const { displayName, defaultComponentProp } = this.props
- this.setState({ componentGroup: getComponentGroup(displayName) })
+ this.setState({
+ componentGroup: getComponentGroup(displayName),
+ activeDisplayName: defaultComponentProp || displayName,
+ })
}
componentWillReceiveProps({ displayName: next }) {
@@ -33,15 +38,9 @@ export default class ComponentProps extends React.Component {
}
}
- handleComponentClick = (e, { name }) => {
- this.setState({ activeDisplayName: name })
- }
-
- handleToggle = () => {
- const { displayName } = this.props
- const { activeDisplayName } = this.state
-
- this.setState({ activeDisplayName: activeDisplayName ? false : displayName })
+ handleSelectedChange = (e, props) => {
+ this.setState({ activeDisplayName: props.value })
+ _.invoke(this.props, 'onPropComponentSelected', e, props)
}
render() {
@@ -55,11 +54,10 @@ export default class ComponentProps extends React.Component {
-
diff --git a/docs/src/components/ComponentDoc/ComponentProps/ComponentPropsComponents.tsx b/docs/src/components/ComponentDoc/ComponentProps/ComponentPropsComponents.tsx
index c019f1c94f..4f228f8104 100644
--- a/docs/src/components/ComponentDoc/ComponentProps/ComponentPropsComponents.tsx
+++ b/docs/src/components/ComponentDoc/ComponentProps/ComponentPropsComponents.tsx
@@ -1,36 +1,30 @@
import * as _ from 'lodash'
import * as PropTypes from 'prop-types'
import * as React from 'react'
-import { Menu, tabListBehavior } from '@stardust-ui/react'
+import { Dropdown, Header, Flex } from '@stardust-ui/react'
const ComponentPropsComponents: any = ({
activeDisplayName,
displayNames,
- onItemClick,
+ onSelectedChange,
parentDisplayName,
}) => {
if (displayNames.length < 2) return null
- const items: Object[] = _.map(displayNames, displayName => ({
- key: displayName,
- active: activeDisplayName === displayName,
- content:
- displayName === parentDisplayName
- ? displayName
- : displayName.replace(parentDisplayName, `${parentDisplayName}.`),
- name: displayName,
- onClick: onItemClick,
- styles: { paddingTop: '0px' },
- }))
-
+ const items: Object[] = _.map(displayNames, displayName =>
+ displayName === parentDisplayName
+ ? displayName
+ : displayName.replace(parentDisplayName, `${parentDisplayName}`),
+ )
return (
-
+
+
+
+
)
}
diff --git a/docs/src/components/ComponentDoc/ComponentUsage.tsx b/docs/src/components/ComponentDoc/ComponentUsage.tsx
new file mode 100755
index 0000000000..864a6b069b
--- /dev/null
+++ b/docs/src/components/ComponentDoc/ComponentUsage.tsx
@@ -0,0 +1,45 @@
+import * as PropTypes from 'prop-types'
+import * as React from 'react'
+import * as _ from 'lodash'
+
+import { usageIndexContext } from 'docs/src/utils'
+
+interface ComponentUsageProps {
+ displayName: string
+}
+
+export function containsUsage(displayName: string) {
+ return !!getUsageElement(displayName)
+}
+
+function getUsageElement(displayName: string) {
+ const indexPath = _.find(usageIndexContext.keys(), path =>
+ new RegExp(`\/${displayName}\/Usage\/index\.tsx$`).test(path),
+ )
+ if (!indexPath) {
+ return null
+ }
+
+ const UsageElement = React.createElement(usageIndexContext(indexPath).default) as any
+ if (!UsageElement) {
+ return null
+ }
+
+ return UsageElement
+}
+
+export class ComponentUsage extends React.Component {
+ static propTypes = {
+ displayName: PropTypes.string.isRequired,
+ }
+
+ render() {
+ const { displayName } = this.props
+ const UsageElement = getUsageElement(displayName)
+ if (!UsageElement) {
+ return null
+ }
+
+ return UsageElement
+ }
+}
diff --git a/docs/src/components/DocsRoot.tsx b/docs/src/components/DocsRoot.tsx
index 7bf1f82820..d0e1097eab 100644
--- a/docs/src/components/DocsRoot.tsx
+++ b/docs/src/components/DocsRoot.tsx
@@ -5,7 +5,8 @@ import * as React from 'react'
import ComponentDoc from '../components/ComponentDoc'
import PageNotFound from '../views/PageNotFound'
import componentInfoContext from '../utils/componentInfoContext'
-import DocsBehaviorRoot from './DocsBehaviorRoot'
+import { containsUsage } from './ComponentDoc/ComponentUsage'
+import { containsAccessibility } from './ComponentDoc/ComponentDocAccessibility'
class DocsRoot extends React.Component {
static propTypes = {
@@ -13,22 +14,39 @@ class DocsRoot extends React.Component {
match: PropTypes.shape({
params: PropTypes.shape({
name: PropTypes.string.isRequired,
- type: PropTypes.string.isRequired,
+ tab: PropTypes.string.isRequired,
}),
}),
}
state = {}
+ getNonEmptyTabs(info) {
+ const tabs = ['Definition']
+
+ if (containsUsage(info.displayName)) {
+ tabs.push('Usage')
+ }
+
+ tabs.push('Props')
+
+ if (containsAccessibility(info)) {
+ tabs.push('Accessibility')
+ }
+
+ return tabs
+ }
+
render() {
const { match } = this.props
const displayName = _.startCase(match.params.name).replace(/ /g, '')
if (match.params.type === 'behaviors') {
- return
+ return null
}
const info = componentInfoContext.byDisplayName[displayName]
+ const tabs = this.getNonEmptyTabs(info)
- if (info) return
+ if (info) return
return
}
diff --git a/docs/src/components/Sidebar/Sidebar.tsx b/docs/src/components/Sidebar/Sidebar.tsx
index ffd0b9ebfc..5cde4d39d9 100644
--- a/docs/src/components/Sidebar/Sidebar.tsx
+++ b/docs/src/components/Sidebar/Sidebar.tsx
@@ -51,8 +51,16 @@ class Sidebar extends React.Component {
}
findActiveCategoryIndex = (at: string, sections: ShorthandValue[]): number => {
+ let newAt = at
+ if (at.startsWith('/components')) {
+ newAt = newAt.replace(/[^\/]*$/, '')
+ }
+ if (newAt[newAt.length - 1] === '/') {
+ newAt = newAt.substr(0, newAt.length - 1)
+ }
+
return _.findIndex(sections, (section: ShorthandValue) => {
- return _.find((section as any).items, item => item.title.to === at)
+ return _.find((section as any).items, item => item.title.to.startsWith(newAt))
})
}
diff --git a/docs/src/examples/components/Accordion/BestPractices/index.tsx b/docs/src/examples/components/Accordion/BestPractices/index.tsx
deleted file mode 100644
index 9a93773334..0000000000
--- a/docs/src/examples/components/Accordion/BestPractices/index.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import * as React from 'react'
-
-import AccordionBestPractices from './AccordionBestPractices'
-import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'
-
-const BestPractices = () => (
-
-
-
-)
-
-export default BestPractices
diff --git a/docs/src/examples/components/Accordion/Usage/index.tsx b/docs/src/examples/components/Accordion/Usage/index.tsx
index 480e46eccc..263c86033a 100644
--- a/docs/src/examples/components/Accordion/Usage/index.tsx
+++ b/docs/src/examples/components/Accordion/Usage/index.tsx
@@ -3,7 +3,7 @@ import ComponentExample from 'docs/src/components/ComponentDoc/ComponentExample'
import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'
const Usage = () => (
-
+
(
<>
-
-
>
)
diff --git a/docs/src/examples/components/Alert/BestPractices/index.tsx b/docs/src/examples/components/Alert/BestPractices/index.tsx
deleted file mode 100644
index 9509d8c786..0000000000
--- a/docs/src/examples/components/Alert/BestPractices/index.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import * as React from 'react'
-
-import AlertBestPractices from './AlertBestPractices'
-import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'
-
-const BestPractices = () => (
-
-
-
-)
-
-export default BestPractices
diff --git a/docs/src/examples/components/Alert/index.tsx b/docs/src/examples/components/Alert/index.tsx
index 0ade5705a1..c184793bbf 100644
--- a/docs/src/examples/components/Alert/index.tsx
+++ b/docs/src/examples/components/Alert/index.tsx
@@ -3,11 +3,9 @@ import * as React from 'react'
import Rtl from './Rtl'
import Types from './Types'
import Variations from './Variations'
-import BestPractices from './BestPractices'
const AlertExamples = () => (
<>
-
diff --git a/docs/src/examples/components/Avatar/Usage/index.tsx b/docs/src/examples/components/Avatar/Usage/index.tsx
index 4fce4a8bfc..ba2698a499 100644
--- a/docs/src/examples/components/Avatar/Usage/index.tsx
+++ b/docs/src/examples/components/Avatar/Usage/index.tsx
@@ -3,7 +3,7 @@ import ComponentExample from 'docs/src/components/ComponentDoc/ComponentExample'
import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'
const Usage = () => (
-
+
(
<>
-
>
)
diff --git a/docs/src/examples/components/Button/BestPractices/index.tsx b/docs/src/examples/components/Button/BestPractices/index.tsx
deleted file mode 100644
index bfa0bef58a..0000000000
--- a/docs/src/examples/components/Button/BestPractices/index.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import * as React from 'react'
-
-import ButtonBestPractices from './ButtonBestPractices'
-import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'
-
-const BestPractices = () => (
-
-
-
-)
-
-export default BestPractices
diff --git a/docs/src/examples/components/Button/Types/index.tsx b/docs/src/examples/components/Button/Types/index.tsx
index b2fe655fa6..29861bfc8f 100644
--- a/docs/src/examples/components/Button/Types/index.tsx
+++ b/docs/src/examples/components/Button/Types/index.tsx
@@ -24,11 +24,6 @@ const Types = () => (
description="A button can be formatted differently if it indicate that it contains only an icon."
examplePath="components/Button/Types/ButtonExampleIconOnly"
/>
-
)
diff --git a/docs/src/examples/components/Button/Types/ButtonExampleContentAndIcon.shorthand.steps.ts b/docs/src/examples/components/Button/Usage/ButtonExampleContentAndIcon.shorthand.steps.ts
similarity index 100%
rename from docs/src/examples/components/Button/Types/ButtonExampleContentAndIcon.shorthand.steps.ts
rename to docs/src/examples/components/Button/Usage/ButtonExampleContentAndIcon.shorthand.steps.ts
diff --git a/docs/src/examples/components/Button/Types/ButtonExampleContentAndIcon.shorthand.tsx b/docs/src/examples/components/Button/Usage/ButtonExampleContentAndIcon.shorthand.tsx
similarity index 100%
rename from docs/src/examples/components/Button/Types/ButtonExampleContentAndIcon.shorthand.tsx
rename to docs/src/examples/components/Button/Usage/ButtonExampleContentAndIcon.shorthand.tsx
diff --git a/docs/src/examples/components/Button/Types/ButtonExampleContentAndIcon.tsx b/docs/src/examples/components/Button/Usage/ButtonExampleContentAndIcon.tsx
similarity index 100%
rename from docs/src/examples/components/Button/Types/ButtonExampleContentAndIcon.tsx
rename to docs/src/examples/components/Button/Usage/ButtonExampleContentAndIcon.tsx
diff --git a/docs/src/examples/components/Button/Usage/index.tsx b/docs/src/examples/components/Button/Usage/index.tsx
index 05ad093ecc..1ad904f416 100644
--- a/docs/src/examples/components/Button/Usage/index.tsx
+++ b/docs/src/examples/components/Button/Usage/index.tsx
@@ -4,7 +4,12 @@ import ComponentExample from 'docs/src/components/ComponentDoc/ComponentExample'
import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'
const Usage = () => (
-
+
+
(
<>
-
-
>
diff --git a/docs/src/examples/components/Dialog/BestPractices/index.tsx b/docs/src/examples/components/Dialog/BestPractices/index.tsx
deleted file mode 100644
index c419eb27ce..0000000000
--- a/docs/src/examples/components/Dialog/BestPractices/index.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import * as React from 'react'
-
-import DialogBestPractices from './DialogBestPractices'
-import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'
-
-const BestPractices = () => (
-
-
-
-)
-
-export default BestPractices
diff --git a/docs/src/examples/components/Dialog/Usage/index.tsx b/docs/src/examples/components/Dialog/Usage/index.tsx
index 02343499ab..c9a96b7a16 100644
--- a/docs/src/examples/components/Dialog/Usage/index.tsx
+++ b/docs/src/examples/components/Dialog/Usage/index.tsx
@@ -4,7 +4,7 @@ import ComponentExample from 'docs/src/components/ComponentDoc/ComponentExample'
import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'
const DialogUsageExamples = () => (
-
+
(
<>
-
-
>
)
diff --git a/docs/src/examples/components/Dropdown/BestPractices/index.tsx b/docs/src/examples/components/Dropdown/BestPractices/index.tsx
deleted file mode 100644
index 3079a39bfb..0000000000
--- a/docs/src/examples/components/Dropdown/BestPractices/index.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import * as React from 'react'
-
-import DropdownBestPractices from './DropdownBestPractices'
-import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'
-
-const BestPractices = () => (
-
-
-
-)
-
-export default BestPractices
diff --git a/docs/src/examples/components/Dropdown/Usage/index.tsx b/docs/src/examples/components/Dropdown/Usage/index.tsx
index 1f36099ebc..d5f18fd3f6 100644
--- a/docs/src/examples/components/Dropdown/Usage/index.tsx
+++ b/docs/src/examples/components/Dropdown/Usage/index.tsx
@@ -3,7 +3,7 @@ import ComponentExample from 'docs/src/components/ComponentDoc/ComponentExample'
import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'
const Usage = () => (
-
+
(
<>
-
-
>
diff --git a/docs/src/examples/components/Embed/Usage/index.tsx b/docs/src/examples/components/Embed/Usage/index.tsx
index d5060e1e49..0a91cf2988 100644
--- a/docs/src/examples/components/Embed/Usage/index.tsx
+++ b/docs/src/examples/components/Embed/Usage/index.tsx
@@ -4,7 +4,7 @@ import ComponentExample from 'docs/src/components/ComponentDoc/ComponentExample'
import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'
const Usage = () => (
-
+
(
<>
-
>
)
diff --git a/docs/src/examples/components/Form/BestPractices/index.tsx b/docs/src/examples/components/Form/BestPractices/index.tsx
deleted file mode 100644
index b6e4a661b6..0000000000
--- a/docs/src/examples/components/Form/BestPractices/index.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import * as React from 'react'
-
-import FormBestPractices from './FormBestPractices'
-import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'
-
-const BestPractices = () => (
-
-
-
-)
-
-export default BestPractices
diff --git a/docs/src/examples/components/Form/index.tsx b/docs/src/examples/components/Form/index.tsx
index 3eaacdad08..cd13e449c0 100644
--- a/docs/src/examples/components/Form/index.tsx
+++ b/docs/src/examples/components/Form/index.tsx
@@ -1,12 +1,10 @@
import * as React from 'react'
-import BestPractices from './BestPractices'
import Rtl from './Rtl'
import Types from './Types'
const FormExamples = () => (
-
diff --git a/docs/src/examples/components/Grid/BestPractices/index.tsx b/docs/src/examples/components/Grid/BestPractices/index.tsx
deleted file mode 100644
index 9165aea0de..0000000000
--- a/docs/src/examples/components/Grid/BestPractices/index.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import * as React from 'react'
-
-import GridBestPractices from './GridBestPractices'
-import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'
-
-const BestPractices = () => (
-
-
-
-)
-
-export default BestPractices
diff --git a/docs/src/examples/components/Grid/index.tsx b/docs/src/examples/components/Grid/index.tsx
index 0f039d3bdc..ffb33f0460 100644
--- a/docs/src/examples/components/Grid/index.tsx
+++ b/docs/src/examples/components/Grid/index.tsx
@@ -2,7 +2,6 @@ import * as React from 'react'
import { Alert } from '@stardust-ui/react'
import { Link } from 'react-router-dom'
-import BestPractices from './BestPractices'
import Rtl from './Rtl'
import Types from './Types'
import Variations from './Variations'
@@ -16,7 +15,6 @@ const GridExamples = () => (
-
diff --git a/docs/src/examples/components/Icon/BestPractices/index.tsx b/docs/src/examples/components/Icon/BestPractices/index.tsx
deleted file mode 100644
index 8b41354c77..0000000000
--- a/docs/src/examples/components/Icon/BestPractices/index.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import * as React from 'react'
-
-import IconBestPractices from './IconBestPractices'
-import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'
-
-const BestPractices = () => (
-
-
-
-)
-
-export default BestPractices
diff --git a/docs/src/examples/components/Icon/Usage/index.tsx b/docs/src/examples/components/Icon/Usage/index.tsx
index edce4e6461..318e8a6fa8 100644
--- a/docs/src/examples/components/Icon/Usage/index.tsx
+++ b/docs/src/examples/components/Icon/Usage/index.tsx
@@ -3,7 +3,7 @@ import ComponentExample from 'docs/src/components/ComponentDoc/ComponentExample'
import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'
const Usage = () => (
-
+
(
diff --git a/docs/src/examples/components/Input/BestPractices/index.tsx b/docs/src/examples/components/Input/BestPractices/index.tsx
deleted file mode 100644
index 7a793b66ef..0000000000
--- a/docs/src/examples/components/Input/BestPractices/index.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import * as React from 'react'
-
-import InputBestPractices from './InputBestPractices'
-import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'
-
-const BestPractices = () => (
-
-
-
-)
-
-export default BestPractices
diff --git a/docs/src/examples/components/Input/index.tsx b/docs/src/examples/components/Input/index.tsx
index 1fa6887169..8204c345b0 100644
--- a/docs/src/examples/components/Input/index.tsx
+++ b/docs/src/examples/components/Input/index.tsx
@@ -1,13 +1,11 @@
import * as React from 'react'
-import BestPractices from './BestPractices'
import Rtl from './Rtl'
import Types from './Types'
import Variations from './Variations'
const InputExamples = () => (
-
diff --git a/docs/src/examples/components/Loader/Usage/index.tsx b/docs/src/examples/components/Loader/Usage/index.tsx
index ee9faf1d7a..66e81cd0b0 100644
--- a/docs/src/examples/components/Loader/Usage/index.tsx
+++ b/docs/src/examples/components/Loader/Usage/index.tsx
@@ -4,7 +4,7 @@ import ComponentExample from 'docs/src/components/ComponentDoc/ComponentExample'
import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'
const LoaderUsageExamples = () => (
-
+
(
<>
-
>
diff --git a/docs/src/examples/components/Menu/BestPractices/index.tsx b/docs/src/examples/components/Menu/BestPractices/index.tsx
deleted file mode 100644
index 5b7156b301..0000000000
--- a/docs/src/examples/components/Menu/BestPractices/index.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import * as React from 'react'
-
-import MenuBestPractices from './MenuBestPractices'
-import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'
-
-const BestPractices = () => (
-
-
-
-)
-
-export default BestPractices
diff --git a/docs/src/examples/components/Menu/Usages/MenuExampleTabList.shorthand.tsx b/docs/src/examples/components/Menu/Usage/MenuExampleTabList.shorthand.tsx
similarity index 100%
rename from docs/src/examples/components/Menu/Usages/MenuExampleTabList.shorthand.tsx
rename to docs/src/examples/components/Menu/Usage/MenuExampleTabList.shorthand.tsx
diff --git a/docs/src/examples/components/Menu/Usages/MenuExampleToolbar.shorthand.steps.ts b/docs/src/examples/components/Menu/Usage/MenuExampleToolbar.shorthand.steps.ts
similarity index 100%
rename from docs/src/examples/components/Menu/Usages/MenuExampleToolbar.shorthand.steps.ts
rename to docs/src/examples/components/Menu/Usage/MenuExampleToolbar.shorthand.steps.ts
diff --git a/docs/src/examples/components/Menu/Usages/MenuExampleToolbar.shorthand.tsx b/docs/src/examples/components/Menu/Usage/MenuExampleToolbar.shorthand.tsx
similarity index 100%
rename from docs/src/examples/components/Menu/Usages/MenuExampleToolbar.shorthand.tsx
rename to docs/src/examples/components/Menu/Usage/MenuExampleToolbar.shorthand.tsx
diff --git a/docs/src/examples/components/Menu/Usages/MenuExampleWithSubmenu.shorthand.steps.ts b/docs/src/examples/components/Menu/Usage/MenuExampleWithSubmenu.shorthand.steps.ts
similarity index 100%
rename from docs/src/examples/components/Menu/Usages/MenuExampleWithSubmenu.shorthand.steps.ts
rename to docs/src/examples/components/Menu/Usage/MenuExampleWithSubmenu.shorthand.steps.ts
diff --git a/docs/src/examples/components/Menu/Usages/MenuExampleWithSubmenu.shorthand.tsx b/docs/src/examples/components/Menu/Usage/MenuExampleWithSubmenu.shorthand.tsx
similarity index 100%
rename from docs/src/examples/components/Menu/Usages/MenuExampleWithSubmenu.shorthand.tsx
rename to docs/src/examples/components/Menu/Usage/MenuExampleWithSubmenu.shorthand.tsx
diff --git a/docs/src/examples/components/Menu/Usages/MenuExampleWithSubmenuControlled.shorthand.tsx b/docs/src/examples/components/Menu/Usage/MenuExampleWithSubmenuControlled.shorthand.tsx
similarity index 100%
rename from docs/src/examples/components/Menu/Usages/MenuExampleWithSubmenuControlled.shorthand.tsx
rename to docs/src/examples/components/Menu/Usage/MenuExampleWithSubmenuControlled.shorthand.tsx
diff --git a/docs/src/examples/components/Menu/Usages/MenuExampleWithTooltip.shorthand.steps.ts b/docs/src/examples/components/Menu/Usage/MenuExampleWithTooltip.shorthand.steps.ts
similarity index 100%
rename from docs/src/examples/components/Menu/Usages/MenuExampleWithTooltip.shorthand.steps.ts
rename to docs/src/examples/components/Menu/Usage/MenuExampleWithTooltip.shorthand.steps.ts
diff --git a/docs/src/examples/components/Menu/Usages/MenuExampleWithTooltip.shorthand.tsx b/docs/src/examples/components/Menu/Usage/MenuExampleWithTooltip.shorthand.tsx
similarity index 100%
rename from docs/src/examples/components/Menu/Usages/MenuExampleWithTooltip.shorthand.tsx
rename to docs/src/examples/components/Menu/Usage/MenuExampleWithTooltip.shorthand.tsx
diff --git a/docs/src/examples/components/Menu/Usages/index.tsx b/docs/src/examples/components/Menu/Usage/index.tsx
similarity index 74%
rename from docs/src/examples/components/Menu/Usages/index.tsx
rename to docs/src/examples/components/Menu/Usage/index.tsx
index 24587dda21..93d1a3ea52 100644
--- a/docs/src/examples/components/Menu/Usages/index.tsx
+++ b/docs/src/examples/components/Menu/Usage/index.tsx
@@ -3,27 +3,27 @@ import { Link } from 'react-router-dom'
import ComponentExample from 'docs/src/components/ComponentDoc/ComponentExample'
import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'
-const Usages = () => (
-
+const Usage = () => (
+
(
tooltip
>
}
- examplePath="components/Menu/Usages/MenuExampleWithTooltip"
+ examplePath="components/Menu/Usage/MenuExampleWithTooltip"
/>
)
-export default Usages
+export default Usage
diff --git a/docs/src/examples/components/Menu/index.tsx b/docs/src/examples/components/Menu/index.tsx
index 6881ba1aea..9a90ade790 100644
--- a/docs/src/examples/components/Menu/index.tsx
+++ b/docs/src/examples/components/Menu/index.tsx
@@ -1,21 +1,17 @@
import * as React from 'react'
-import BestPractices from './BestPractices'
import Rtl from './Rtl'
import Types from './Types'
import Slots from './Slots'
import States from './States'
import Variations from './Variations'
-import Usages from './Usages'
const MenuExamples = () => (
-
-
)
diff --git a/docs/src/examples/components/MenuButton/Usage/index.tsx b/docs/src/examples/components/MenuButton/Usage/index.tsx
index 21d5b8687d..5cc2a8e24f 100644
--- a/docs/src/examples/components/MenuButton/Usage/index.tsx
+++ b/docs/src/examples/components/MenuButton/Usage/index.tsx
@@ -4,7 +4,7 @@ import ComponentExample from 'docs/src/components/ComponentDoc/ComponentExample'
import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'
const Usage = () => (
-
+
(
<>
-
>
diff --git a/docs/src/examples/components/Popup/BestPractices/index.tsx b/docs/src/examples/components/Popup/BestPractices/index.tsx
deleted file mode 100644
index 5671cbc025..0000000000
--- a/docs/src/examples/components/Popup/BestPractices/index.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import * as React from 'react'
-
-import PopupBestPractices from './PopupBestPractices'
-import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'
-
-const BestPractices = () => (
-
-
-
-)
-
-export default BestPractices
diff --git a/docs/src/examples/components/Popup/Usage/index.tsx b/docs/src/examples/components/Popup/Usage/index.tsx
index bc43350695..3ccb7950cb 100644
--- a/docs/src/examples/components/Popup/Usage/index.tsx
+++ b/docs/src/examples/components/Popup/Usage/index.tsx
@@ -4,7 +4,7 @@ import ComponentExample from 'docs/src/components/ComponentDoc/ComponentExample'
import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'
const Usage = () => (
-
+
(
<>
-
-
>
)
diff --git a/docs/src/examples/components/Provider/Usage/index.tsx b/docs/src/examples/components/Provider/Usage/index.tsx
index a51dcfaf5c..1822823f8a 100644
--- a/docs/src/examples/components/Provider/Usage/index.tsx
+++ b/docs/src/examples/components/Provider/Usage/index.tsx
@@ -4,7 +4,7 @@ import ComponentExample from 'docs/src/components/ComponentDoc/ComponentExample'
import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'
const Usage = () => (
-
+
(
<>
-
>
)
diff --git a/docs/src/examples/components/Reaction/BestPractices/index.tsx b/docs/src/examples/components/Reaction/BestPractices/index.tsx
deleted file mode 100644
index 1e29ee3aab..0000000000
--- a/docs/src/examples/components/Reaction/BestPractices/index.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import * as React from 'react'
-
-import ReactionBestPractices from './ReactionBestPractices'
-import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'
-
-const BestPractices = () => (
-
-
-
-)
-
-export default BestPractices
diff --git a/docs/src/examples/components/Reaction/index.tsx b/docs/src/examples/components/Reaction/index.tsx
index aad23dab16..9943f19e0d 100644
--- a/docs/src/examples/components/Reaction/index.tsx
+++ b/docs/src/examples/components/Reaction/index.tsx
@@ -1,12 +1,10 @@
import * as React from 'react'
-import BestPractices from './BestPractices'
import Rtl from './Rtl'
import Types from './Types'
const ReactionExamples = () => (
<>
-
>
diff --git a/docs/src/examples/components/Slider/BestPractices/index.tsx b/docs/src/examples/components/Slider/BestPractices/index.tsx
deleted file mode 100644
index 3411575bc1..0000000000
--- a/docs/src/examples/components/Slider/BestPractices/index.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import * as React from 'react'
-
-import SliderBestPractices from './SliderBestPractices'
-import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'
-
-const BestPractices = () => (
-
-
-
-)
-
-export default BestPractices
diff --git a/docs/src/examples/components/Slider/Usage/index.tsx b/docs/src/examples/components/Slider/Usage/index.tsx
index 75df8a8636..0455309146 100644
--- a/docs/src/examples/components/Slider/Usage/index.tsx
+++ b/docs/src/examples/components/Slider/Usage/index.tsx
@@ -3,7 +3,7 @@ import ComponentExample from 'docs/src/components/ComponentDoc/ComponentExample'
import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'
const Usage = () => (
-
+
(
<>
-
-
>
)
diff --git a/docs/src/examples/components/Status/BestPractices/index.tsx b/docs/src/examples/components/Status/BestPractices/index.tsx
deleted file mode 100644
index 5e31ba6c85..0000000000
--- a/docs/src/examples/components/Status/BestPractices/index.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import * as React from 'react'
-
-import StatusBestPractices from './StatusBestPractices'
-import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'
-
-const BestPractices = () => (
-
-
-
-)
-
-export default BestPractices
diff --git a/docs/src/examples/components/Status/index.tsx b/docs/src/examples/components/Status/index.tsx
index 40e76dc865..6178c34bb5 100644
--- a/docs/src/examples/components/Status/index.tsx
+++ b/docs/src/examples/components/Status/index.tsx
@@ -1,12 +1,10 @@
import * as React from 'react'
-import BestPractices from './BestPractices'
import Types from './Types'
import Variations from './Variations'
const StatusExamples = () => (
-
diff --git a/docs/src/examples/components/Text/BestPractices/index.tsx b/docs/src/examples/components/Text/BestPractices/index.tsx
deleted file mode 100644
index a1a75a92f2..0000000000
--- a/docs/src/examples/components/Text/BestPractices/index.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import * as React from 'react'
-
-import TextBestPractices from './TextBestPractices'
-import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'
-
-const BestPractices = () => (
-
-
-
-)
-
-export default BestPractices
diff --git a/docs/src/examples/components/Text/index.tsx b/docs/src/examples/components/Text/index.tsx
index 978a2f0660..7640a28062 100644
--- a/docs/src/examples/components/Text/index.tsx
+++ b/docs/src/examples/components/Text/index.tsx
@@ -1,6 +1,5 @@
import * as React from 'react'
-import BestPractices from './BestPractices'
import Rtl from './Rtl'
import States from './States'
import Types from './Types'
@@ -8,7 +7,6 @@ import Variations from './Variations'
const TextExamples = () => (
<>
-
diff --git a/docs/src/examples/components/Toolbar/Usage/index.tsx b/docs/src/examples/components/Toolbar/Usage/index.tsx
index cd67449aaf..74ceb4401c 100644
--- a/docs/src/examples/components/Toolbar/Usage/index.tsx
+++ b/docs/src/examples/components/Toolbar/Usage/index.tsx
@@ -4,7 +4,7 @@ import ComponentExample from 'docs/src/components/ComponentDoc/ComponentExample'
import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'
const Usage = () => (
-
+
(
<>
-
>
)
diff --git a/docs/src/examples/components/Tooltip/BestPractices/index.tsx b/docs/src/examples/components/Tooltip/BestPractices/index.tsx
deleted file mode 100644
index b502484028..0000000000
--- a/docs/src/examples/components/Tooltip/BestPractices/index.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import * as React from 'react'
-
-import TooltipBestPractices from '././TooltipBestPractices'
-import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'
-
-const BestPractices = () => (
-
-
-
-)
-
-export default BestPractices
diff --git a/docs/src/examples/components/Tooltip/Usage/index.tsx b/docs/src/examples/components/Tooltip/Usage/index.tsx
index 93c4e114b6..620f76a281 100644
--- a/docs/src/examples/components/Tooltip/Usage/index.tsx
+++ b/docs/src/examples/components/Tooltip/Usage/index.tsx
@@ -4,7 +4,7 @@ import ComponentExample from 'docs/src/components/ComponentDoc/ComponentExample'
import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'
const Usage = () => (
-
+
(
<>
-
-
>
)
diff --git a/docs/src/routes.tsx b/docs/src/routes.tsx
index 3573e5c96b..f3fcfc5480 100644
--- a/docs/src/routes.tsx
+++ b/docs/src/routes.tsx
@@ -1,9 +1,10 @@
import * as React from 'react'
-import { BrowserRouter, Route, Switch } from 'react-router-dom'
+import { BrowserRouter, Route, Switch, Redirect } from 'react-router-dom'
import ExternalExampleLayout from './components/ExternalExampleLayout'
import DocsLayout from './components/DocsLayout'
import DocsRoot from './components/DocsRoot'
+import DocsBehaviorRoot from './components/DocsBehaviorRoot'
import MarkdownPage from 'docs/src/components/MarkdownPage'
import * as Composition from './pages/Composition.mdx'
@@ -47,7 +48,13 @@ const Routes = () => (
-
+
+ }
+ />
+
diff --git a/docs/src/utils/exampleContexts.ts b/docs/src/utils/exampleContexts.ts
index 4121e1e141..04d0572594 100644
--- a/docs/src/utils/exampleContexts.ts
+++ b/docs/src/utils/exampleContexts.ts
@@ -3,6 +3,20 @@
*/
export const exampleIndexContext = require.context('docs/src/examples/', true, /index.tsx$/)
+/**
+ * The Webpack Context for doc site usage groups.
+ */
+export const usageIndexContext = require.context('docs/src/examples', true, /Usage\/index.tsx$/)
+
+/**
+ * The Webpack Context for doc site example groups.
+ */
+export const exampleBestPracticesContext = require.context(
+ 'docs/src/examples/',
+ true,
+ /BestPractices.tsx$/,
+)
+
/**
* The Webpack Context for component playgrounds.
*/
diff --git a/docs/src/utils/index.tsx b/docs/src/utils/index.tsx
index 8ddd177e53..f524569d5c 100644
--- a/docs/src/utils/index.tsx
+++ b/docs/src/utils/index.tsx
@@ -1,6 +1,8 @@
export { default as componentInfoContext } from './componentInfoContext'
export {
exampleIndexContext,
+ usageIndexContext,
+ exampleBestPracticesContext,
examplePlaygroundContext,
exampleSourcesContext,
} from './exampleContexts'