UNPKG

@material-ui/lab

Version:

Material-UI Lab - Incubator for Material-UI React components.

66 lines (59 loc) 2.36 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties"; import * as React from 'react'; import PropTypes from 'prop-types'; import clsx from 'clsx'; import { capitalize } from '@material-ui/core/utils'; import { withStyles } from '@material-ui/core/styles'; import TimelineContext from '../Timeline/TimelineContext'; import TimelineItemContext from '../TimelineItem/TimelineItemContext'; export var styles = function styles() { return { /* Styles applied to the root element. */ root: { flex: 1, padding: '6px 16px' }, /* Styles applied to the root element if `align="right"`. */ alignRight: { textAlign: 'right' } }; }; var TimelineContent = /*#__PURE__*/React.forwardRef(function TimelineContent(props, ref) { var classes = props.classes, className = props.className, other = _objectWithoutProperties(props, ["classes", "className"]); var _React$useContext = React.useContext(TimelineContext), _React$useContext$ali = _React$useContext.align, align = _React$useContext$ali === void 0 ? 'left' : _React$useContext$ali; var _React$useContext2 = React.useContext(TimelineItemContext), _React$useContext2$cl = _React$useContext2.classes, contextClasses = _React$useContext2$cl === void 0 ? {} : _React$useContext2$cl; return /*#__PURE__*/React.createElement("div", _extends({ className: clsx(classes.root, contextClasses.content, classes["align".concat(capitalize(align))], className), ref: ref }, other)); }); process.env.NODE_ENV !== "production" ? TimelineContent.propTypes = { // ----------------------------- Warning -------------------------------- // | These PropTypes are generated from the TypeScript type definitions | // | To update them edit the d.ts file and run "yarn proptypes" | // ---------------------------------------------------------------------- /** * The content of the component. */ children: PropTypes.node, /** * Override or extend the styles applied to the component. * See [CSS API](#css) below for more details. */ classes: PropTypes.object, /** * @ignore */ className: PropTypes.string } : void 0; export default withStyles(styles, { name: 'MuiTimelineContent' })(TimelineContent);