Skip to content

Commit

Permalink
ready to be merged
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed May 6, 2018
1 parent 25e3bf3 commit 4a42ebf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 24 deletions.
21 changes: 2 additions & 19 deletions packages/material-ui/src/Tabs/TabIndicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,11 @@ export const styles = theme => ({
* @ignore - internal component.
*/
function TabIndicator(props) {
const { classes, className, color, tabIndicatorProps, style, ...other } = props;

const styleProps =
Object.keys(tabIndicatorProps).length !== 0
? {
...tabIndicatorProps,
...style,
}
: style;
const { classes, className, color, ...other } = props;

return (
<span
className={classNames(classes.root, classes[`color${capitalize(color)}`], className)}
style={styleProps}
{...other}
/>
);
Expand All @@ -57,15 +48,7 @@ TabIndicator.propTypes = {
* @ignore
* The color of the tab indicator.
*/
color: PropTypes.oneOf([PropTypes.string, PropTypes.oneOf(['secondary', 'primary'])]),
/**
* @ignore
*/
style: PropTypes.object,
/**
* Useful to extend or add custom style to component
*/
tabIndicatorProps: PropTypes.object,
color: PropTypes.oneOf(['primary', 'secondary']),
};

export default withStyles(styles)(TabIndicator);
2 changes: 2 additions & 0 deletions packages/material-ui/src/Tabs/Tabs.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react';
import { StandardProps } from '..';
import { ButtonBaseProps } from '../ButtonBase/ButtonBase';
import { TabIndicatorProps } from './TabIndicator';

export interface TabsProps extends StandardProps<ButtonBaseProps, TabsClassKey, 'onChange'> {
action?: (actions: TabsActions) => void;
Expand All @@ -12,6 +13,7 @@ export interface TabsProps extends StandardProps<ButtonBaseProps, TabsClassKey,
scrollable?: boolean;
ScrollButtonComponent?: React.ReactType;
scrollButtons?: 'auto' | 'on' | 'off';
TabIndicatorProps?: Partial<TabIndicatorProps>;
textColor?: 'secondary' | 'primary' | 'inherit' | string;
value: any;
width?: string;
Expand Down
9 changes: 4 additions & 5 deletions packages/material-ui/src/Tabs/Tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ class Tabs extends React.Component {
scrollable,
ScrollButtonComponent,
scrollButtons,
tabIndicatorProps,
TabIndicatorProps,
textColor,
theme,
value,
Expand All @@ -306,7 +306,7 @@ class Tabs extends React.Component {
style={this.state.indicatorStyle}
className={classes.indicator}
color={indicatorColor}
tabIndicatorProps={tabIndicatorProps}
{...TabIndicatorProps}
/>
);

Expand Down Expand Up @@ -419,9 +419,9 @@ Tabs.propTypes = {
*/
scrollButtons: PropTypes.oneOf(['auto', 'on', 'off']),
/**
* Determines a custom style for tab indicator
* Properties applied to the `TabIndicator` element.
*/
tabIndicatorProps: PropTypes.object,
TabIndicatorProps: PropTypes.object,
/**
* Determines the color of the `Tab`.
*/
Expand All @@ -445,7 +445,6 @@ Tabs.defaultProps = {
ScrollButtonComponent: TabScrollButton,
scrollButtons: 'auto',
textColor: 'inherit',
tabIndicatorProps: {},
};

export default withStyles(styles, { name: 'MuiTabs', withTheme: true })(Tabs);

0 comments on commit 4a42ebf

Please sign in to comment.