Skip to content

Commit

Permalink
add type for button only
Browse files Browse the repository at this point in the history
  • Loading branch information
siriwatknp committed Jun 9, 2021
1 parent bd1cca6 commit b48e204
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 22 deletions.
2 changes: 1 addition & 1 deletion docs/pages/api-docs/button.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"color": {
"type": {
"name": "union",
"description": "'inherit'<br>&#124;&nbsp;'primary'<br>&#124;&nbsp;'secondary'<br>&#124;&nbsp;'default'<br>&#124;&nbsp;'success'<br>&#124;&nbsp;'error'<br>&#124;&nbsp;'info'<br>&#124;&nbsp;'warning'<br>&#124;&nbsp;string"
"description": "'inherit'<br>&#124;&nbsp;'primary'<br>&#124;&nbsp;'secondary'<br>&#124;&nbsp;'success'<br>&#124;&nbsp;'error'<br>&#124;&nbsp;'info'<br>&#124;&nbsp;'warning'<br>&#124;&nbsp;string"
},
"default": "'primary'"
},
Expand Down
6 changes: 4 additions & 2 deletions packages/material-ui/src/Button/Button.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as React from 'react';
import { DistributiveOmit, OverridableStringUnion } from '@material-ui/types';
import { SxProps } from '@material-ui/system';
import { PropTypes } from '..';
import { Theme } from '../styles';
import { ExtendButtonBase, ExtendButtonBaseTypeMap } from '../ButtonBase';
import { OverrideProps, OverridableComponent, OverridableTypeMap } from '../OverridableComponent';
Expand Down Expand Up @@ -30,7 +29,10 @@ export type ButtonTypeMap<
* The color of the component. It supports those theme colors that make sense for this component.
* @default 'primary'
*/
color?: OverridableStringUnion<PropTypes.Color, ButtonPropsColorOverrides>;
color?: OverridableStringUnion<
'inherit' | 'primary' | 'secondary' | 'success' | 'error' | 'info' | 'warning',
ButtonPropsColorOverrides
>;
/**
* If `true`, the component is disabled.
* @default false
Expand Down
11 changes: 1 addition & 10 deletions packages/material-ui/src/Button/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,16 +385,7 @@ Button.propTypes /* remove-proptypes */ = {
* @default 'primary'
*/
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([
PropTypes.oneOf([
'inherit',
'primary',
'secondary',
'default',
'success',
'error',
'info',
'warning',
]),
PropTypes.oneOf(['inherit', 'primary', 'secondary', 'success', 'error', 'info', 'warning']),
PropTypes.string,
]),
/**
Expand Down
10 changes: 1 addition & 9 deletions packages/material-ui/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,7 @@ export interface Color {
export namespace PropTypes {
// keeping the type structure for backwards compat
// eslint-disable-next-line @typescript-eslint/no-shadow, @typescript-eslint/no-unused-vars
type Color =
| 'inherit'
| 'primary'
| 'secondary'
| 'default'
| 'success'
| 'error'
| 'info'
| 'warning';
type Color = 'inherit' | 'primary' | 'secondary' | 'default';
}

// From index.js
Expand Down

0 comments on commit b48e204

Please sign in to comment.