Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Migrate Breadcrumbs demos to emotion #25302

Merged
Merged
51 changes: 8 additions & 43 deletions docs/src/pages/components/breadcrumbs/CustomSeparator.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,22 @@
import * as React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import Box from '@material-ui/core/Box';
import Breadcrumbs from '@material-ui/core/Breadcrumbs';
import Typography from '@material-ui/core/Typography';
import Link from '@material-ui/core/Link';
import NavigateNextIcon from '@material-ui/icons/NavigateNext';

const useStyles = makeStyles((theme) => ({
root: {
'& > * + *': {
marginTop: theme.spacing(2),
},
},
}));

function handleClick(event) {
event.preventDefault();
console.info('You clicked a breadcrumb.');
}

export default function CustomSeparator() {
const classes = useStyles();

return (
<div className={classes.root}>
<Box
sx={{
// TODO Replace with Stack
'& > :not(style) + :not(style)': { mt: 2 },
}}
>
<Breadcrumbs separator="›" aria-label="breadcrumb">
<Link color="inherit" href="/" onClick={handleClick}>
Material-UI
Expand All @@ -36,35 +30,6 @@ export default function CustomSeparator() {
</Link>
<Typography color="textPrimary">Breadcrumb</Typography>
</Breadcrumbs>
<Breadcrumbs separator="-" aria-label="breadcrumb">
<Link color="inherit" href="/" onClick={handleClick}>
Material-UI
</Link>
<Link
color="inherit"
href="/getting-started/installation/"
onClick={handleClick}
>
Core
</Link>
<Typography color="textPrimary">Breadcrumb</Typography>
</Breadcrumbs>
<Breadcrumbs
separator={<NavigateNextIcon fontSize="small" />}
aria-label="breadcrumb"
>
<Link color="inherit" href="/" onClick={handleClick}>
Material-UI
</Link>
<Link
color="inherit"
href="/getting-started/installation/"
onClick={handleClick}
>
Core
</Link>
<Typography color="textPrimary">Breadcrumb</Typography>
</Breadcrumbs>
</div>
</Box>
);
}
53 changes: 8 additions & 45 deletions docs/src/pages/components/breadcrumbs/CustomSeparator.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,22 @@
import * as React from 'react';
import { makeStyles, Theme, createStyles } from '@material-ui/core/styles';
import Box from '@material-ui/core/Box';
import Breadcrumbs from '@material-ui/core/Breadcrumbs';
import Typography from '@material-ui/core/Typography';
import Link from '@material-ui/core/Link';
import NavigateNextIcon from '@material-ui/icons/NavigateNext';

const useStyles = makeStyles((theme: Theme) =>
createStyles({
root: {
'& > * + *': {
marginTop: theme.spacing(2),
},
},
}),
);

function handleClick(event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) {
event.preventDefault();
console.info('You clicked a breadcrumb.');
}

export default function CustomSeparator() {
const classes = useStyles();

return (
<div className={classes.root}>
<Box
sx={{
// TODO Replace with Stack
'& > :not(style) + :not(style)': { mt: 2 },
}}
>
<Breadcrumbs separator="›" aria-label="breadcrumb">
<Link color="inherit" href="/" onClick={handleClick}>
Material-UI
Expand All @@ -38,35 +30,6 @@ export default function CustomSeparator() {
</Link>
<Typography color="textPrimary">Breadcrumb</Typography>
</Breadcrumbs>
<Breadcrumbs separator="-" aria-label="breadcrumb">
<Link color="inherit" href="/" onClick={handleClick}>
Material-UI
</Link>
<Link
color="inherit"
href="/getting-started/installation/"
onClick={handleClick}
>
Core
</Link>
<Typography color="textPrimary">Breadcrumb</Typography>
</Breadcrumbs>
<Breadcrumbs
separator={<NavigateNextIcon fontSize="small" />}
aria-label="breadcrumb"
>
<Link color="inherit" href="/" onClick={handleClick}>
Material-UI
</Link>
<Link
color="inherit"
href="/getting-started/installation/"
onClick={handleClick}
>
Core
</Link>
<Typography color="textPrimary">Breadcrumb</Typography>
</Breadcrumbs>
</div>
</Box>
);
}
35 changes: 35 additions & 0 deletions docs/src/pages/components/breadcrumbs/CustomSeparatorDash.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import * as React from 'react';
import Box from '@material-ui/core/Box';
import Breadcrumbs from '@material-ui/core/Breadcrumbs';
import Typography from '@material-ui/core/Typography';
import Link from '@material-ui/core/Link';

function handleClick(event) {
event.preventDefault();
console.info('You clicked a breadcrumb.');
}

export default function CustomSeparatorDash() {
return (
<Box
sx={{
// TODO Replace with Stack
'& > :not(style) + :not(style)': { mt: 2 },
}}
>
<Breadcrumbs separator="-" aria-label="breadcrumb">
<Link color="inherit" href="/" onClick={handleClick}>
Material-UI
</Link>
<Link
color="inherit"
href="/getting-started/installation/"
onClick={handleClick}
>
Core
</Link>
<Typography color="textPrimary">Breadcrumb</Typography>
</Breadcrumbs>
</Box>
);
}
35 changes: 35 additions & 0 deletions docs/src/pages/components/breadcrumbs/CustomSeparatorDash.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import * as React from 'react';
import Box from '@material-ui/core/Box';
import Breadcrumbs from '@material-ui/core/Breadcrumbs';
import Typography from '@material-ui/core/Typography';
import Link from '@material-ui/core/Link';

function handleClick(event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) {
event.preventDefault();
console.info('You clicked a breadcrumb.');
}

export default function CustomSeparatorDash() {
return (
<Box
sx={{
// TODO Replace with Stack
'& > :not(style) + :not(style)': { mt: 2 },
}}
>
<Breadcrumbs separator="-" aria-label="breadcrumb">
<Link color="inherit" href="/" onClick={handleClick}>
Material-UI
</Link>
<Link
color="inherit"
href="/getting-started/installation/"
onClick={handleClick}
>
Core
</Link>
<Typography color="textPrimary">Breadcrumb</Typography>
</Breadcrumbs>
</Box>
);
}
39 changes: 39 additions & 0 deletions docs/src/pages/components/breadcrumbs/CustomSeparatorIcon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import * as React from 'react';
import Box from '@material-ui/core/Box';
import Breadcrumbs from '@material-ui/core/Breadcrumbs';
import Typography from '@material-ui/core/Typography';
import Link from '@material-ui/core/Link';
import NavigateNextIcon from '@material-ui/icons/NavigateNext';

function handleClick(event) {
event.preventDefault();
console.info('You clicked a breadcrumb.');
}

export default function CustomSeparatorIcon() {
return (
<Box
sx={{
// TODO Replace with Stack
'& > :not(style) + :not(style)': { mt: 2 },
}}
>
<Breadcrumbs
separator={<NavigateNextIcon fontSize="small" />}
aria-label="breadcrumb"
>
<Link color="inherit" href="/" onClick={handleClick}>
Material-UI
</Link>
<Link
color="inherit"
href="/getting-started/installation/"
onClick={handleClick}
>
Core
</Link>
<Typography color="textPrimary">Breadcrumb</Typography>
</Breadcrumbs>
</Box>
);
}
39 changes: 39 additions & 0 deletions docs/src/pages/components/breadcrumbs/CustomSeparatorIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import * as React from 'react';
import Box from '@material-ui/core/Box';
import Breadcrumbs from '@material-ui/core/Breadcrumbs';
import Typography from '@material-ui/core/Typography';
import Link from '@material-ui/core/Link';
import NavigateNextIcon from '@material-ui/icons/NavigateNext';

function handleClick(event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) {
event.preventDefault();
console.info('You clicked a breadcrumb.');
}

export default function CustomSeparatorIcon() {
return (
<Box
sx={{
// TODO Replace with Stack
'& > :not(style) + :not(style)': { mt: 2 },
}}
>
<Breadcrumbs
separator={<NavigateNextIcon fontSize="small" />}
aria-label="breadcrumb"
>
<Link color="inherit" href="/" onClick={handleClick}>
Material-UI
</Link>
<Link
color="inherit"
href="/getting-started/installation/"
onClick={handleClick}
>
Core
</Link>
<Typography color="textPrimary">Breadcrumb</Typography>
</Breadcrumbs>
</Box>
);
}
30 changes: 15 additions & 15 deletions docs/src/pages/components/breadcrumbs/CustomizedBreadcrumbs.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import * as React from 'react';
import { emphasize, withStyles } from '@material-ui/core/styles';
import { emphasize, experimentalStyled as styled } from '@material-ui/core/styles';
import Breadcrumbs from '@material-ui/core/Breadcrumbs';
import Chip from '@material-ui/core/Chip';
import HomeIcon from '@material-ui/icons/Home';
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';

const StyledBreadcrumb = withStyles((theme) => ({
root: {
backgroundColor: theme.palette.grey[100],
height: theme.spacing(3),
color: theme.palette.grey[800],
fontWeight: theme.typography.fontWeightRegular,
'&:hover, &:focus': {
backgroundColor: theme.palette.grey[300],
},
'&:active': {
boxShadow: theme.shadows[1],
backgroundColor: emphasize(theme.palette.grey[300], 0.12),
},
const StyledBreadcrumb = styled(Chip)(({ theme }) => ({
backgroundColor: theme.palette.grey[100],
height: theme.spacing(3),
color: theme.palette.grey[800],
fontWeight: theme.typography.fontWeightRegular,
'&:hover, &:focus': {
backgroundColor: theme.palette.grey[300],
},
}))(Chip); // TypeScript only: need a type cast here because https://github.com/Microsoft/TypeScript/issues/26591
'&:active': {
boxShadow: theme.shadows[1],
backgroundColor: emphasize(theme.palette.grey[300], 0.12),
},
}));

// TypeScript only: need a type cast here because https://github.com/Microsoft/TypeScript/issues/26591

function handleClick(event) {
event.preventDefault();
Expand Down
28 changes: 13 additions & 15 deletions docs/src/pages/components/breadcrumbs/CustomizedBreadcrumbs.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
import * as React from 'react';
import { emphasize, withStyles, Theme } from '@material-ui/core/styles';
import { emphasize, experimentalStyled as styled } from '@material-ui/core/styles';
import Breadcrumbs from '@material-ui/core/Breadcrumbs';
import Chip from '@material-ui/core/Chip';
import HomeIcon from '@material-ui/icons/Home';
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';

const StyledBreadcrumb = withStyles((theme: Theme) => ({
root: {
backgroundColor: theme.palette.grey[100],
height: theme.spacing(3),
color: theme.palette.grey[800],
fontWeight: theme.typography.fontWeightRegular,
'&:hover, &:focus': {
backgroundColor: theme.palette.grey[300],
},
'&:active': {
boxShadow: theme.shadows[1],
backgroundColor: emphasize(theme.palette.grey[300], 0.12),
},
const StyledBreadcrumb = styled(Chip)(({ theme }) => ({
backgroundColor: theme.palette.grey[100],
height: theme.spacing(3),
color: theme.palette.grey[800],
fontWeight: theme.typography.fontWeightRegular,
'&:hover, &:focus': {
backgroundColor: theme.palette.grey[300],
},
}))(Chip) as typeof Chip; // TypeScript only: need a type cast here because https://github.com/Microsoft/TypeScript/issues/26591
'&:active': {
boxShadow: theme.shadows[1],
backgroundColor: emphasize(theme.palette.grey[300], 0.12),
},
})) as typeof Chip; // TypeScript only: need a type cast here because https://github.com/Microsoft/TypeScript/issues/26591

function handleClick(event: React.MouseEvent<Element, MouseEvent>) {
event.preventDefault();
Expand Down
Loading