Completely updated React, fixed #11, (hopefully)

This commit is contained in:
2018-03-04 19:11:49 -05:00
parent 6e0afd6e2a
commit 34e5f5139a
13674 changed files with 333464 additions and 473223 deletions

View File

@@ -1,11 +1,10 @@
// @flow weak
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import withStyles from '../styles/withStyles';
import { capitalizeFirstLetter } from '../utils/helpers';
import { capitalize } from '../utils/helpers';
export const styles = (theme: Object) => ({
export const styles = theme => ({
root: {
position: 'absolute',
height: 2,
@@ -14,54 +13,24 @@ export const styles = (theme: Object) => ({
transition: theme.transitions.create(),
willChange: 'left, width',
},
colorAccent: {
backgroundColor: theme.palette.secondary.A200,
},
colorPrimary: {
backgroundColor: theme.palette.primary[500],
backgroundColor: theme.palette.primary.main,
},
colorSecondary: {
backgroundColor: theme.palette.secondary.main,
},
});
export type IndicatorStyle = {
left: number,
width: number,
};
export type ProvidedProps = {
classes: Object,
};
export type Props = {
/**
* Useful to extend the style applied to components.
*/
classes?: Object,
/**
* @ignore
*/
className?: string,
/**
* @ignore
* The color of the tab indicator.
*/
color: 'accent' | 'primary' | string,
/**
* @ignore
* The style of the root element.
*/
style: IndicatorStyle,
};
/**
* @ignore - internal component.
*/
function TabIndicator(props: ProvidedProps & Props) {
function TabIndicator(props) {
const { classes, className: classNameProp, color, style: styleProp } = props;
const colorPredefined = ['primary', 'accent'].indexOf(color) !== -1;
const colorPredefined = ['primary', 'secondary'].indexOf(color) !== -1;
const className = classNames(
classes.root,
{
[classes[`color${capitalizeFirstLetter(color)}`]]: colorPredefined,
[classes[`color${capitalize(color)}`]]: colorPredefined,
},
classNameProp,
);
@@ -73,7 +42,28 @@ function TabIndicator(props: ProvidedProps & Props) {
backgroundColor: color,
};
return <div className={className} style={style} />;
return <span className={className} style={style} />;
}
TabIndicator.propTypes = {
/**
* Useful to extend the style applied to components.
*/
classes: PropTypes.object.isRequired,
/**
* @ignore
*/
className: PropTypes.string,
/**
* @ignore
* The color of the tab indicator.
*/
color: PropTypes.oneOfType([PropTypes.string, PropTypes.oneOf(['primary', 'secondary'])]),
/**
* @ignore
* The style of the root element.
*/
style: PropTypes.object,
};
export default withStyles(styles, { name: 'MuiTabIndicator' })(TabIndicator);