UNPKG

2.22 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 padding: '6px 16px',
14 marginRight: 'auto',
15 textAlign: 'right',
16 flex: 1
17 },
18
19 /* Styles applied to the root element if `align="right"`. */
20 alignRight: {
21 textAlign: 'left'
22 }
23});
24const TimelineOppositeContent = /*#__PURE__*/React.forwardRef(function TimelineOppositeContent(props, ref) {
25 const {
26 classes,
27 className
28 } = props,
29 other = _objectWithoutPropertiesLoose(props, ["classes", "className"]);
30
31 const {
32 align = 'left'
33 } = React.useContext(TimelineContext);
34 const {
35 classes: contextClasses = {}
36 } = React.useContext(TimelineItemContext);
37 return /*#__PURE__*/React.createElement("div", _extends({
38 className: clsx(classes.root, contextClasses.oppositeContent, classes[`align${capitalize(align)}`], className),
39 ref: ref
40 }, other));
41});
42process.env.NODE_ENV !== "production" ? TimelineOppositeContent.propTypes = {
43 // ----------------------------- Warning --------------------------------
44 // | These PropTypes are generated from the TypeScript type definitions |
45 // | To update them edit the d.ts file and run "yarn proptypes" |
46 // ----------------------------------------------------------------------
47
48 /**
49 * The content of the component.
50 */
51 children: PropTypes.node,
52
53 /**
54 * Override or extend the styles applied to the component.
55 * See [CSS API](#css) below for more details.
56 */
57 classes: PropTypes.object,
58
59 /**
60 * @ignore
61 */
62 className: PropTypes.string
63} : void 0;
64TimelineOppositeContent.muiName = 'TimelineOppositeContent';
65export default withStyles(styles, {
66 name: 'MuiTimelineOppositeContent'
67})(TimelineOppositeContent);
\No newline at end of file