UNPKG

2.07 kBJavaScriptView Raw
1import _extends from "@babel/runtime/helpers/esm/extends";
2import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3import * as React from 'react';
4import PropTypes from 'prop-types';
5import clsx from 'clsx';
6import { capitalize } from '@material-ui/core/utils';
7import { withStyles } from '@material-ui/core/styles';
8import TimelineContext from '../Timeline/TimelineContext';
9import TimelineItemContext from '../TimelineItem/TimelineItemContext';
10export const styles = () => ({
11 /* Styles applied to the root element. */
12 root: {
13 flex: 1,
14 padding: '6px 16px'
15 },
16
17 /* Styles applied to the root element if `align="right"`. */
18 alignRight: {
19 textAlign: 'right'
20 }
21});
22const TimelineContent = /*#__PURE__*/React.forwardRef(function TimelineContent(props, ref) {
23 const {
24 classes,
25 className
26 } = props,
27 other = _objectWithoutPropertiesLoose(props, ["classes", "className"]);
28
29 const {
30 align = 'left'
31 } = React.useContext(TimelineContext);
32 const {
33 classes: contextClasses = {}
34 } = React.useContext(TimelineItemContext);
35 return /*#__PURE__*/React.createElement("div", _extends({
36 className: clsx(classes.root, contextClasses.content, classes[`align${capitalize(align)}`], className),
37 ref: ref
38 }, other));
39});
40process.env.NODE_ENV !== "production" ? TimelineContent.propTypes = {
41 // ----------------------------- Warning --------------------------------
42 // | These PropTypes are generated from the TypeScript type definitions |
43 // | To update them edit the d.ts file and run "yarn proptypes" |
44 // ----------------------------------------------------------------------
45
46 /**
47 * The content of the component.
48 */
49 children: PropTypes.node,
50
51 /**
52 * Override or extend the styles applied to the component.
53 * See [CSS API](#css) below for more details.
54 */
55 classes: PropTypes.object,
56
57 /**
58 * @ignore
59 */
60 className: PropTypes.string
61} : void 0;
62export default withStyles(styles, {
63 name: 'MuiTimelineContent'
64})(TimelineContent);
\No newline at end of file