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] Separate ButtonGroup and Fab pages from Button page #19381

Merged
merged 3 commits into from
Jan 26, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/pages/api/button-group.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,5 @@ If that's not sufficient, you can check the [implementation of the component](ht

## Demos

- [Buttons](/components/buttons/)
- [Button Group](/components/button-group/)

1 change: 1 addition & 0 deletions docs/pages/api/button.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,6 @@ You can take advantage of this behavior to [target nested components](/guides/ap

## Demos

- [Button Group](/components/button-group/)
- [Buttons](/components/buttons/)

2 changes: 1 addition & 1 deletion docs/pages/api/fab.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,5 @@ You can take advantage of this behavior to [target nested components](/guides/ap

## Demos

- [Buttons](/components/buttons/)
- [Floating Action Button](/components/floating-action-button/)

1 change: 0 additions & 1 deletion docs/pages/api/zoom.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,5 @@ You can take advantage of this behavior to [target nested components](/guides/ap

## Demos

- [Buttons](/components/buttons/)
- [Transitions](/components/transitions/)

14 changes: 14 additions & 0 deletions docs/pages/components/button-group.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';

const req = require.context('docs/src/pages/components/button-group', false, /\.(md|js|tsx)$/);
const reqSource = require.context(
'!raw-loader!../../src/pages/components/button-group',
false,
/\.(js|tsx)$/,
);
const reqPrefix = 'pages/components/button-group';

export default function Page() {
return <MarkdownDocs req={req} reqSource={reqSource} reqPrefix={reqPrefix} />;
}
18 changes: 18 additions & 0 deletions docs/pages/components/floating-action-button.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';

const req = require.context(
'docs/src/pages/components/floating-action-button',
false,
/\.(md|js|tsx)$/,
);
const reqSource = require.context(
'!raw-loader!../../src/pages/components/floating-action-button',
false,
/\.(js|tsx)$/,
);
const reqPrefix = 'pages/components/floating-action-button';

export default function Page() {
return <MarkdownDocs req={req} reqSource={reqSource} reqPrefix={reqPrefix} />;
}
2 changes: 2 additions & 0 deletions docs/src/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ const pages = [
subheader: '/components/inputs',
children: [
{ pathname: '/components/buttons' },
{ pathname: '/components/button-group' },
{ pathname: '/components/checkboxes' },
{ pathname: '/components/floating-action-button' },
{ pathname: '/components/pickers', title: 'Date / Time' },
{ pathname: '/components/radio-buttons' },
{ pathname: '/components/selects' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const useStyles = makeStyles(theme => ({
},
}));

export default function GroupedButtons() {
export default function BasicButtonGroup() {
const classes = useStyles();

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const useStyles = makeStyles((theme: Theme) =>
}),
);

export default function GroupedButtons() {
export default function BasicButtonGroup() {
const classes = useStyles();

return (
Expand Down
51 changes: 51 additions & 0 deletions docs/src/pages/components/button-group/GroupOrientation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import React from 'react';
import Button from '@material-ui/core/Button';
import ButtonGroup from '@material-ui/core/ButtonGroup';
import { makeStyles } from '@material-ui/core/styles';

const useStyles = makeStyles(theme => ({
root: {
display: 'flex',
'& > *': {
margin: theme.spacing(1),
},
},
}));

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

return (
<div className={classes.root}>
<ButtonGroup
orientation="vertical"
color="primary"
aria-label="vertical outlined primary button group"
>
<Button>One</Button>
<Button>Two</Button>
<Button>Three</Button>
</ButtonGroup>
<ButtonGroup
orientation="vertical"
color="primary"
aria-label="vertical contained primary button group"
variant="contained"
>
<Button>One</Button>
<Button>Two</Button>
<Button>Three</Button>
</ButtonGroup>
<ButtonGroup
orientation="vertical"
color="primary"
aria-label="vertical contained primary button group"
variant="text"
>
<Button>One</Button>
<Button>Two</Button>
<Button>Three</Button>
</ButtonGroup>
</div>
);
}
51 changes: 51 additions & 0 deletions docs/src/pages/components/button-group/GroupOrientation.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import React from 'react';
import Button from '@material-ui/core/Button';
import ButtonGroup from '@material-ui/core/ButtonGroup';
import { makeStyles } from '@material-ui/core/styles';

const useStyles = makeStyles(theme => ({
root: {
display: 'flex',
'& > *': {
margin: theme.spacing(1),
},
},
}));

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

return (
<div className={classes.root}>
<ButtonGroup
orientation="vertical"
color="primary"
aria-label="vertical outlined primary button group"
>
<Button>One</Button>
<Button>Two</Button>
<Button>Three</Button>
</ButtonGroup>
<ButtonGroup
orientation="vertical"
color="primary"
aria-label="vertical contained primary button group"
variant="contained"
>
<Button>One</Button>
<Button>Two</Button>
<Button>Three</Button>
</ButtonGroup>
<ButtonGroup
orientation="vertical"
color="primary"
aria-label="vertical contained primary button group"
variant="text"
>
<Button>One</Button>
<Button>Two</Button>
<Button>Three</Button>
</ButtonGroup>
</div>
);
}
26 changes: 26 additions & 0 deletions docs/src/pages/components/button-group/button-group.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: ButtonGroup React component
components: Button, ButtonGroup
---

# Button group

<p class="description">The ButtonGroup component can be used to group related buttons.</p>

## Basic button group

{{"demo": "pages/components/button-group/BasicButtonGroup.js"}}

### Group sizes and colors

{{"demo": "pages/components/button-group/GroupSizesColors.js"}}

### Group orientation

{{"demo": "pages/components/button-group/GroupOrientation.js"}}

### Split Button

ButtonGroup can also be used to create a split button. The dropdown can change the button action (as in this example), or be used to immediately trigger a related action.

{{"demo": "pages/components/button-group/SplitButton.js"}}
40 changes: 0 additions & 40 deletions docs/src/pages/components/buttons/ButtonSizes.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import Button from '@material-ui/core/Button';
import Fab from '@material-ui/core/Fab';
import IconButton from '@material-ui/core/IconButton';
import AddIcon from '@material-ui/icons/Add';
import DeleteIcon from '@material-ui/icons/Delete';
import NavigationIcon from '@material-ui/icons/Navigation';
import ArrowDownwardIcon from '@material-ui/icons/ArrowDownward';

const useStyles = makeStyles(theme => ({
Expand Down Expand Up @@ -55,43 +52,6 @@ export default function ButtonSizes() {
Large
</Button>
</div>
<div>
<Fab size="small" color="secondary" aria-label="add" className={classes.margin}>
<AddIcon />
</Fab>
<Fab size="medium" color="secondary" aria-label="add" className={classes.margin}>
<AddIcon />
</Fab>
<Fab color="secondary" aria-label="add" className={classes.margin}>
<AddIcon />
</Fab>
</div>
<div>
<Fab
variant="extended"
size="small"
color="primary"
aria-label="add"
className={classes.margin}
>
<NavigationIcon className={classes.extendedIcon} />
Extended
</Fab>
<Fab
variant="extended"
size="medium"
color="primary"
aria-label="add"
className={classes.margin}
>
<NavigationIcon className={classes.extendedIcon} />
Extended
</Fab>
<Fab variant="extended" color="primary" aria-label="add" className={classes.margin}>
<NavigationIcon className={classes.extendedIcon} />
Extended
</Fab>
</div>
<div>
<IconButton aria-label="delete" className={classes.margin} size="small">
<ArrowDownwardIcon fontSize="inherit" />
Expand Down
40 changes: 0 additions & 40 deletions docs/src/pages/components/buttons/ButtonSizes.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import React from 'react';
import { createStyles, Theme, makeStyles } from '@material-ui/core/styles';
import Button from '@material-ui/core/Button';
import Fab from '@material-ui/core/Fab';
import IconButton from '@material-ui/core/IconButton';
import AddIcon from '@material-ui/icons/Add';
import DeleteIcon from '@material-ui/icons/Delete';
import NavigationIcon from '@material-ui/icons/Navigation';
import ArrowDownwardIcon from '@material-ui/icons/ArrowDownward';

const useStyles = makeStyles((theme: Theme) =>
Expand Down Expand Up @@ -57,43 +54,6 @@ export default function ButtonSizes() {
Large
</Button>
</div>
<div>
<Fab size="small" color="secondary" aria-label="add" className={classes.margin}>
<AddIcon />
</Fab>
<Fab size="medium" color="secondary" aria-label="add" className={classes.margin}>
<AddIcon />
</Fab>
<Fab color="secondary" aria-label="add" className={classes.margin}>
<AddIcon />
</Fab>
</div>
<div>
<Fab
variant="extended"
size="small"
color="primary"
aria-label="add"
className={classes.margin}
>
<NavigationIcon className={classes.extendedIcon} />
Extended
</Fab>
<Fab
variant="extended"
size="medium"
color="primary"
aria-label="add"
className={classes.margin}
>
<NavigationIcon className={classes.extendedIcon} />
Extended
</Fab>
<Fab variant="extended" color="primary" aria-label="add" className={classes.margin}>
<NavigationIcon className={classes.extendedIcon} />
Extended
</Fab>
</div>
<div>
<IconButton aria-label="delete" className={classes.margin} size="small">
<ArrowDownwardIcon fontSize="inherit" />
Expand Down
17 changes: 0 additions & 17 deletions docs/src/pages/components/buttons/GroupOrientation.js

This file was deleted.

17 changes: 0 additions & 17 deletions docs/src/pages/components/buttons/GroupOrientation.tsx

This file was deleted.

Loading