1 | "use strict";
|
2 |
|
3 | var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
4 |
|
5 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
6 |
|
7 | Object.defineProperty(exports, "__esModule", {
|
8 | value: true
|
9 | });
|
10 | exports.default = exports.styles = void 0;
|
11 |
|
12 | var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
13 |
|
14 | var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
15 |
|
16 | var React = _interopRequireWildcard(require("react"));
|
17 |
|
18 | var _propTypes = _interopRequireDefault(require("prop-types"));
|
19 |
|
20 | var _clsx = _interopRequireDefault(require("clsx"));
|
21 |
|
22 | var _withStyles = _interopRequireDefault(require("../styles/withStyles"));
|
23 |
|
24 | var styles = function styles(theme) {
|
25 | return {
|
26 |
|
27 | root: {
|
28 | position: 'absolute',
|
29 | left: 0,
|
30 | right: 0,
|
31 | height: 48,
|
32 | background: 'rgba(0, 0, 0, 0.5)',
|
33 | display: 'flex',
|
34 | alignItems: 'center',
|
35 | fontFamily: theme.typography.fontFamily
|
36 | },
|
37 |
|
38 |
|
39 | titlePositionBottom: {
|
40 | bottom: 0
|
41 | },
|
42 |
|
43 |
|
44 | titlePositionTop: {
|
45 | top: 0
|
46 | },
|
47 |
|
48 |
|
49 | rootSubtitle: {
|
50 | height: 68
|
51 | },
|
52 |
|
53 |
|
54 | titleWrap: {
|
55 | flexGrow: 1,
|
56 | marginLeft: 16,
|
57 | marginRight: 16,
|
58 | color: theme.palette.common.white,
|
59 | overflow: 'hidden'
|
60 | },
|
61 |
|
62 |
|
63 | titleWrapActionPosLeft: {
|
64 | marginLeft: 0
|
65 | },
|
66 |
|
67 |
|
68 | titleWrapActionPosRight: {
|
69 | marginRight: 0
|
70 | },
|
71 |
|
72 |
|
73 | title: {
|
74 | fontSize: theme.typography.pxToRem(16),
|
75 | lineHeight: '24px',
|
76 | textOverflow: 'ellipsis',
|
77 | overflow: 'hidden',
|
78 | whiteSpace: 'nowrap'
|
79 | },
|
80 |
|
81 |
|
82 | subtitle: {
|
83 | fontSize: theme.typography.pxToRem(12),
|
84 | lineHeight: 1,
|
85 | textOverflow: 'ellipsis',
|
86 | overflow: 'hidden',
|
87 | whiteSpace: 'nowrap'
|
88 | },
|
89 |
|
90 |
|
91 | actionIcon: {},
|
92 |
|
93 |
|
94 | actionIconActionPosLeft: {
|
95 | order: -1
|
96 | }
|
97 | };
|
98 | };
|
99 |
|
100 | exports.styles = styles;
|
101 | var warnedOnce = false;
|
102 |
|
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 | var GridListTileBar = React.forwardRef(function GridListTileBar(props, ref) {
|
110 | if (process.env.NODE_ENV !== 'production') {
|
111 | if (!warnedOnce) {
|
112 | warnedOnce = true;
|
113 | console.error(['Material-UI: The GridListTileBar component was renamed to ImageListItemBar to align with the current Material Design naming.', '', "You should use `import { ImageListItemBar } from '@material-ui/core'`", "or `import ImageListItemBar from '@material-ui/core/ImageListItemBar'`."].join('\n'));
|
114 | }
|
115 | }
|
116 |
|
117 | var actionIcon = props.actionIcon,
|
118 | _props$actionPosition = props.actionPosition,
|
119 | actionPosition = _props$actionPosition === void 0 ? 'right' : _props$actionPosition,
|
120 | classes = props.classes,
|
121 | className = props.className,
|
122 | subtitle = props.subtitle,
|
123 | title = props.title,
|
124 | _props$titlePosition = props.titlePosition,
|
125 | titlePosition = _props$titlePosition === void 0 ? 'bottom' : _props$titlePosition,
|
126 | other = (0, _objectWithoutProperties2.default)(props, ["actionIcon", "actionPosition", "classes", "className", "subtitle", "title", "titlePosition"]);
|
127 | var actionPos = actionIcon && actionPosition;
|
128 | return React.createElement("div", (0, _extends2.default)({
|
129 | className: (0, _clsx.default)(classes.root, className, titlePosition === 'top' ? classes.titlePositionTop : classes.titlePositionBottom, subtitle && classes.rootSubtitle),
|
130 | ref: ref
|
131 | }, other), React.createElement("div", {
|
132 | className: (0, _clsx.default)(classes.titleWrap, {
|
133 | 'left': classes.titleWrapActionPosLeft,
|
134 | 'right': classes.titleWrapActionPosRight
|
135 | }[actionPos])
|
136 | }, React.createElement("div", {
|
137 | className: classes.title
|
138 | }, title), subtitle ? React.createElement("div", {
|
139 | className: classes.subtitle
|
140 | }, subtitle) : null), actionIcon ? React.createElement("div", {
|
141 | className: (0, _clsx.default)(classes.actionIcon, actionPos === 'left' && classes.actionIconActionPosLeft)
|
142 | }, actionIcon) : null);
|
143 | });
|
144 | process.env.NODE_ENV !== "production" ? GridListTileBar.propTypes = {
|
145 |
|
146 |
|
147 |
|
148 |
|
149 |
|
150 | |
151 |
|
152 |
|
153 |
|
154 | actionIcon: _propTypes.default.node,
|
155 |
|
156 | |
157 |
|
158 |
|
159 | actionPosition: _propTypes.default.oneOf(['left', 'right']),
|
160 |
|
161 | |
162 |
|
163 |
|
164 |
|
165 | classes: _propTypes.default.object,
|
166 |
|
167 | |
168 |
|
169 |
|
170 | className: _propTypes.default.string,
|
171 |
|
172 | |
173 |
|
174 |
|
175 | subtitle: _propTypes.default.node,
|
176 |
|
177 | |
178 |
|
179 |
|
180 | title: _propTypes.default.node,
|
181 |
|
182 | |
183 |
|
184 |
|
185 | titlePosition: _propTypes.default.oneOf(['bottom', 'top'])
|
186 | } : void 0;
|
187 |
|
188 | var _default = (0, _withStyles.default)(styles, {
|
189 | name: 'MuiGridListTileBar'
|
190 | })(GridListTileBar);
|
191 |
|
192 | exports.default = _default; |
\ | No newline at end of file |