Completely updated React, fixed #11, (hopefully)
This commit is contained in:
95
goTorrentWebUI/node_modules/material-ui/es/Card/CardHeader.js
generated
vendored
95
goTorrentWebUI/node_modules/material-ui/es/Card/CardHeader.js
generated
vendored
@@ -1,25 +1,27 @@
|
||||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||
|
||||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
||||
|
||||
// @inheritedComponent CardContent
|
||||
|
||||
import _extends from 'babel-runtime/helpers/extends';
|
||||
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
|
||||
import React from 'react';
|
||||
|
||||
import PropTypes from 'prop-types';
|
||||
import classNames from 'classnames';
|
||||
import withStyles from '../styles/withStyles';
|
||||
import Typography from '../Typography';
|
||||
import CardContent from './CardContent';
|
||||
|
||||
export const styles = theme => ({
|
||||
root: {
|
||||
display: 'flex',
|
||||
alignItems: 'center'
|
||||
alignItems: 'center',
|
||||
padding: theme.spacing.unit * 2
|
||||
},
|
||||
avatar: {
|
||||
flex: '0 0 auto',
|
||||
marginRight: theme.spacing.unit * 2
|
||||
},
|
||||
action: {
|
||||
flex: '0 0 auto',
|
||||
alignSelf: 'flex-start',
|
||||
marginTop: theme.spacing.unit * -1,
|
||||
marginRight: theme.spacing.unit * -2
|
||||
},
|
||||
content: {
|
||||
flex: '1 1 auto'
|
||||
},
|
||||
@@ -28,18 +30,20 @@ export const styles = theme => ({
|
||||
});
|
||||
|
||||
function CardHeader(props) {
|
||||
const { avatar, classes, className: classNameProp, subheader, title } = props,
|
||||
other = _objectWithoutProperties(props, ['avatar', 'classes', 'className', 'subheader', 'title']);
|
||||
|
||||
const className = classNames(classes.root, classNameProp);
|
||||
|
||||
// Adjustments that depend on the presence of an avatar
|
||||
const titleType = avatar ? 'body2' : 'headline';
|
||||
const subheaderType = avatar ? 'body2' : 'body1';
|
||||
const {
|
||||
action,
|
||||
avatar,
|
||||
classes,
|
||||
className: classNameProp,
|
||||
component: Component,
|
||||
subheader,
|
||||
title
|
||||
} = props,
|
||||
other = _objectWithoutProperties(props, ['action', 'avatar', 'classes', 'className', 'component', 'subheader', 'title']);
|
||||
|
||||
return React.createElement(
|
||||
CardContent,
|
||||
_extends({ className: className }, other),
|
||||
Component,
|
||||
_extends({ className: classNames(classes.root, classNameProp) }, other),
|
||||
avatar && React.createElement(
|
||||
'div',
|
||||
{ className: classes.avatar },
|
||||
@@ -50,21 +54,66 @@ function CardHeader(props) {
|
||||
{ className: classes.content },
|
||||
React.createElement(
|
||||
Typography,
|
||||
{ type: titleType, component: 'span', className: classes.title },
|
||||
{
|
||||
variant: avatar ? 'body2' : 'headline',
|
||||
component: 'span',
|
||||
className: classes.title
|
||||
},
|
||||
title
|
||||
),
|
||||
React.createElement(
|
||||
subheader && React.createElement(
|
||||
Typography,
|
||||
{
|
||||
type: subheaderType,
|
||||
variant: avatar ? 'body2' : 'body1',
|
||||
component: 'span',
|
||||
color: 'secondary',
|
||||
color: 'textSecondary',
|
||||
className: classes.subheader
|
||||
},
|
||||
subheader
|
||||
)
|
||||
),
|
||||
action && React.createElement(
|
||||
'div',
|
||||
{ className: classes.action },
|
||||
action
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
CardHeader.propTypes = process.env.NODE_ENV !== "production" ? {
|
||||
/**
|
||||
* The action to display in the card header.
|
||||
*/
|
||||
action: PropTypes.node,
|
||||
/**
|
||||
* The Avatar for the Card Header.
|
||||
*/
|
||||
avatar: PropTypes.node,
|
||||
/**
|
||||
* Useful to extend the style applied to components.
|
||||
*/
|
||||
classes: PropTypes.object.isRequired,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className: PropTypes.string,
|
||||
/**
|
||||
* The component used for the root node.
|
||||
* Either a string to use a DOM element or a component.
|
||||
*/
|
||||
component: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
||||
/**
|
||||
* The content of the component.
|
||||
*/
|
||||
subheader: PropTypes.node,
|
||||
/**
|
||||
* The content of the Card Title.
|
||||
*/
|
||||
title: PropTypes.node
|
||||
} : {};
|
||||
|
||||
CardHeader.defaultProps = {
|
||||
component: 'div'
|
||||
};
|
||||
|
||||
export default withStyles(styles, { name: 'MuiCardHeader' })(CardHeader);
|
Reference in New Issue
Block a user