Skip to content

Commit

Permalink
[docs] Link to the correct package on Joy component pages (#33439)
Browse files Browse the repository at this point in the history
  • Loading branch information
cherniavskii authored Jul 12, 2022
1 parent 97c53f2 commit 5069f1e
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 16 deletions.
2 changes: 1 addition & 1 deletion docs/data/joy/components/avatar/avatar.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The avatar component is usually seen for displaying user information in places s

{{"demo": "AvatarUsage.js", "hideToolbar": true}}

{{"component": "modules/components/ComponentLinkHeader.js"}}
{{"component": "modules/components/ComponentLinkHeader.js", "design": false}}

## Component

Expand Down
2 changes: 1 addition & 1 deletion docs/data/joy/components/badge/badge.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The badge component is most frequently used to signal status (online, offline, b

{{"demo": "BadgeUsage.js", "hideToolbar": true}}

{{"component": "modules/components/ComponentLinkHeader.js"}}
{{"component": "modules/components/ComponentLinkHeader.js", "design": false}}

## Component

Expand Down
2 changes: 1 addition & 1 deletion docs/data/joy/components/button/button.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Buttons communicate actions that users can take.

{{"demo": "ButtonUsage.js", "hideToolbar": true}}

{{"component": "modules/components/ComponentLinkHeader.js"}}
{{"component": "modules/components/ComponentLinkHeader.js", "design": false}}

## Component

Expand Down
2 changes: 1 addition & 1 deletion docs/data/joy/components/checkbox/checkbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ For toggling between on and off or single option selection, consider using a swi

{{"demo": "CheckboxUsage.js", "hideToolbar": true}}

{{"component": "modules/components/ComponentLinkHeader.js"}}
{{"component": "modules/components/ComponentLinkHeader.js", "design": false}}

## Component

Expand Down
2 changes: 1 addition & 1 deletion docs/data/joy/components/chip/chip.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The badge component is most frequently used to signal status (online, offline, b

{{"demo": "ChipUsage.js", "hideToolbar": true}}

{{"component": "modules/components/ComponentLinkHeader.js"}}
{{"component": "modules/components/ComponentLinkHeader.js", "design": false}}

## Component

Expand Down
2 changes: 1 addition & 1 deletion docs/data/joy/components/link/link.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ It accepts the same props as the [`Typography`](/joy-ui/react-typography/) compo

{{"demo": "LinkUsage.js", "hideToolbar": true}}

{{"component": "modules/components/ComponentLinkHeader.js"}}
{{"component": "modules/components/ComponentLinkHeader.js", "design": false}}

## Component

Expand Down
2 changes: 1 addition & 1 deletion docs/data/joy/components/radio/radio.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ For more in-depth about when to use each, visit [the NNg's documentation](https:

{{"demo": "RadioUsage.js", "hideToolbar": true}}

{{"component": "modules/components/ComponentLinkHeader.js"}}
{{"component": "modules/components/ComponentLinkHeader.js", "design": false}}

## Component

Expand Down
2 changes: 1 addition & 1 deletion docs/data/joy/components/sheet/sheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ It's a sibling to the [`Box`](/system/react-box/) component, and equivalent to M

{{"demo": "SheetUsage.js", "hideToolbar": true}}

{{"component": "modules/components/ComponentLinkHeader.js"}}
{{"component": "modules/components/ComponentLinkHeader.js", "design": false}}

## Component

Expand Down
2 changes: 1 addition & 1 deletion docs/data/joy/components/slider/slider.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Sliders are ideal for interface controls that benefit from a visual representati

{{"demo": "SliderUsage.js", "hideToolbar": true}}

{{"component": "modules/components/ComponentLinkHeader.js"}}
{{"component": "modules/components/ComponentLinkHeader.js", "design": false}}

## Component

Expand Down
2 changes: 1 addition & 1 deletion docs/data/joy/components/switch/switch.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ should be made clear from the corresponding inline label.

{{"demo": "SwitchUsage.js", "hideToolbar": true}}

{{"component": "modules/components/ComponentLinkHeader.js"}}
{{"component": "modules/components/ComponentLinkHeader.js", "design": false}}

## Component

Expand Down
2 changes: 1 addition & 1 deletion docs/data/material/components/tree-view/tree-view-pt.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Componente React de Visualização em Árvore
components: TreeView, TreeItem
githubLabel: 'component: tree view'
waiAria: 'https://www.w3.org/TR/wai-aria-practices/#TreeView'
packageName: '@material-ui/lab'
packageName: '@mui/lab'
---

# Visualização em árvore
Expand Down
19 changes: 14 additions & 5 deletions docs/src/modules/components/ComponentLinkHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,23 @@ const Root = styled('ul')(({ theme }) => ({
},
}));

const defaultPackageNames = {
'material-ui': '@mui/material',
'joy-ui': '@mui/joy',
base: '@mui/base',
system: '@mui/system',
};

export default function ComponentLinkHeader(props) {
const {
headers,
headers: { packageName = '@mui/material' },
options,
} = props;
const { headers, options } = props;
const t = useTranslate();

let packageName = props.headers.packageName;
if (!packageName) {
const { product } = props.headers;
packageName = defaultPackageNames[product] || '@mui/material';
}

return (
<Root>
{headers.githubLabel ? (
Expand Down

0 comments on commit 5069f1e

Please sign in to comment.