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

[Snackbar] Fix anchorOrigin types #12316

Merged
merged 3 commits into from
Jul 28, 2018
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { StandardProps } from '..';
import { TypographyProps } from '../Typography';

export interface DialogContentTextProps
extends StandardProps<TypographyProps, DialogContentTextClassKey> {}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is not related to this PR. It was changed automatically by Prettier.

extends StandardProps<TypographyProps, DialogContentTextClassKey> {}

export type DialogContentTextClassKey = 'root';

Expand Down
4 changes: 2 additions & 2 deletions packages/material-ui/src/Snackbar/Snackbar.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { SnackbarContentProps } from '../SnackbarContent';
import { TransitionHandlerProps, TransitionProps } from '../transitions/transition';

export type SnackbarOrigin = {
horizontal: 'left' | 'center' | 'right' | number;
vertical: 'top' | 'center' | 'bottom' | number;
horizontal: 'left' | 'center' | 'right';
vertical: 'top' | 'center' | 'bottom';
};

export interface SnackbarProps
Expand Down
8 changes: 2 additions & 6 deletions packages/material-ui/src/Snackbar/Snackbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,8 @@ Snackbar.propTypes = {
* The anchor of the `Snackbar`.
*/
anchorOrigin: PropTypes.shape({
horizontal: PropTypes.oneOfType([
PropTypes.number,
PropTypes.oneOf(['left', 'center', 'right']),
]).isRequired,
vertical: PropTypes.oneOfType([PropTypes.number, PropTypes.oneOf(['top', 'center', 'bottom'])])
.isRequired,
horizontal: PropTypes.oneOf(['left', 'center', 'right']).isRequired,
vertical: PropTypes.oneOf(['top', 'center', 'bottom']).isRequired,
}),
/**
* The number of milliseconds to wait before automatically calling the
Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui/test/typescript/components.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ const DialogTest = () => {
</List>
</div>
<DialogContent>
<DialogContentText variant='body2' color='primary'>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. This change is not related to this PR. It was changed automatically by Prettier.

<DialogContentText variant="body2" color="primary">
Some text
</DialogContentText>
</DialogContent>
Expand Down
2 changes: 1 addition & 1 deletion pages/api/snackbar.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ title: Snackbar API
| Name | Type | Default | Description |
|:-----|:-----|:--------|:------------|
| <span class="prop-name">action</span> | <span class="prop-type">node |   | The action to display. |
| <span class="prop-name">anchorOrigin</span> | <span class="prop-type">{ horizontal: union:&nbsp;number&nbsp;&#124;<br>&nbsp;enum:&nbsp;'left'&nbsp;&#124;<br>&nbsp;'center'&nbsp;&#124;<br>&nbsp;'right'<br><br>, vertical: union:&nbsp;number&nbsp;&#124;<br>&nbsp;enum:&nbsp;'top'&nbsp;&#124;<br>&nbsp;'center'&nbsp;&#124;<br>&nbsp;'bottom'<br><br> } | <span class="prop-default">{ vertical: 'bottom', horizontal: 'center',}</span> | The anchor of the `Snackbar`. |
| <span class="prop-name">anchorOrigin</span> | <span class="prop-type">{ horizontal: enum:&nbsp;'left'&nbsp;&#124;<br>&nbsp;'center'&nbsp;&#124;<br>&nbsp;'right'<br>, vertical: enum:&nbsp;'top'&nbsp;&#124;<br>&nbsp;'center'&nbsp;&#124;<br>&nbsp;'bottom'<br> } | <span class="prop-default">{ vertical: 'bottom', horizontal: 'center',}</span> | The anchor of the `Snackbar`. |
| <span class="prop-name">autoHideDuration</span> | <span class="prop-type">number |   | The number of milliseconds to wait before automatically calling the `onClose` function. `onClose` should then set the state of the `open` prop to hide the Snackbar. This behavior is disabled by default with the `null` value. |
| <span class="prop-name">children</span> | <span class="prop-type">element |   | If you wish the take control over the children of the component you can use this property. When used, you replace the `SnackbarContent` component with the children. |
| <span class="prop-name">classes</span> | <span class="prop-type">object |   | Override or extend the styles applied to the component. See [CSS API](#css-api) below for more details. |
Expand Down