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 GridListTileBar = React.forwardRef(function GridListTileBar(props, ref) {
|
102 | var actionIcon = props.actionIcon,
|
103 | _props$actionPosition = props.actionPosition,
|
104 | actionPosition = _props$actionPosition === void 0 ? 'right' : _props$actionPosition,
|
105 | classes = props.classes,
|
106 | className = props.className,
|
107 | subtitle = props.subtitle,
|
108 | title = props.title,
|
109 | _props$titlePosition = props.titlePosition,
|
110 | titlePosition = _props$titlePosition === void 0 ? 'bottom' : _props$titlePosition,
|
111 | other = (0, _objectWithoutProperties2.default)(props, ["actionIcon", "actionPosition", "classes", "className", "subtitle", "title", "titlePosition"]);
|
112 | var actionPos = actionIcon && actionPosition;
|
113 | return React.createElement("div", (0, _extends2.default)({
|
114 | className: (0, _clsx.default)(classes.root, className, titlePosition === 'top' ? classes.titlePositionTop : classes.titlePositionBottom, subtitle && classes.rootSubtitle),
|
115 | ref: ref
|
116 | }, other), React.createElement("div", {
|
117 | className: (0, _clsx.default)(classes.titleWrap, {
|
118 | 'left': classes.titleWrapActionPosLeft,
|
119 | 'right': classes.titleWrapActionPosRight
|
120 | }[actionPos])
|
121 | }, React.createElement("div", {
|
122 | className: classes.title
|
123 | }, title), subtitle ? React.createElement("div", {
|
124 | className: classes.subtitle
|
125 | }, subtitle) : null), actionIcon ? React.createElement("div", {
|
126 | className: (0, _clsx.default)(classes.actionIcon, actionPos === 'left' && classes.actionIconActionPosLeft)
|
127 | }, actionIcon) : null);
|
128 | });
|
129 | process.env.NODE_ENV !== "production" ? GridListTileBar.propTypes = {
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 | |
136 |
|
137 |
|
138 |
|
139 | actionIcon: _propTypes.default.node,
|
140 |
|
141 | |
142 |
|
143 |
|
144 | actionPosition: _propTypes.default.oneOf(['left', 'right']),
|
145 |
|
146 | |
147 |
|
148 |
|
149 |
|
150 | classes: _propTypes.default.object,
|
151 |
|
152 | |
153 |
|
154 |
|
155 | className: _propTypes.default.string,
|
156 |
|
157 | |
158 |
|
159 |
|
160 | subtitle: _propTypes.default.node,
|
161 |
|
162 | |
163 |
|
164 |
|
165 | title: _propTypes.default.node,
|
166 |
|
167 | |
168 |
|
169 |
|
170 | titlePosition: _propTypes.default.oneOf(['bottom', 'top'])
|
171 | } : void 0;
|
172 |
|
173 | var _default = (0, _withStyles.default)(styles, {
|
174 | name: 'MuiGridListTileBar'
|
175 | })(GridListTileBar);
|
176 |
|
177 | exports.default = _default; |
\ | No newline at end of file |