1 | import _extends from "@babel/runtime/helpers/esm/extends";
|
2 | import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
3 | import * as React from 'react';
|
4 | import PropTypes from 'prop-types';
|
5 | import clsx from 'clsx';
|
6 | import withStyles from '../styles/withStyles';
|
7 | export const styles = theme => ({
|
8 |
|
9 | root: {
|
10 | position: 'absolute',
|
11 | left: 0,
|
12 | right: 0,
|
13 | height: 48,
|
14 | background: 'rgba(0, 0, 0, 0.5)',
|
15 | display: 'flex',
|
16 | alignItems: 'center',
|
17 | fontFamily: theme.typography.fontFamily
|
18 | },
|
19 |
|
20 |
|
21 | titlePositionBottom: {
|
22 | bottom: 0
|
23 | },
|
24 |
|
25 |
|
26 | titlePositionTop: {
|
27 | top: 0
|
28 | },
|
29 |
|
30 |
|
31 | rootSubtitle: {
|
32 | height: 68
|
33 | },
|
34 |
|
35 |
|
36 | titleWrap: {
|
37 | flexGrow: 1,
|
38 | marginLeft: 16,
|
39 | marginRight: 16,
|
40 | color: theme.palette.common.white,
|
41 | overflow: 'hidden'
|
42 | },
|
43 |
|
44 |
|
45 | titleWrapActionPosLeft: {
|
46 | marginLeft: 0
|
47 | },
|
48 |
|
49 |
|
50 | titleWrapActionPosRight: {
|
51 | marginRight: 0
|
52 | },
|
53 |
|
54 |
|
55 | title: {
|
56 | fontSize: theme.typography.pxToRem(16),
|
57 | lineHeight: '24px',
|
58 | textOverflow: 'ellipsis',
|
59 | overflow: 'hidden',
|
60 | whiteSpace: 'nowrap'
|
61 | },
|
62 |
|
63 |
|
64 | subtitle: {
|
65 | fontSize: theme.typography.pxToRem(12),
|
66 | lineHeight: 1,
|
67 | textOverflow: 'ellipsis',
|
68 | overflow: 'hidden',
|
69 | whiteSpace: 'nowrap'
|
70 | },
|
71 |
|
72 |
|
73 | actionIcon: {},
|
74 |
|
75 |
|
76 | actionIconActionPosLeft: {
|
77 | order: -1
|
78 | }
|
79 | });
|
80 | let warnedOnce = false;
|
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 | const GridListTileBar = React.forwardRef(function GridListTileBar(props, ref) {
|
89 | if (process.env.NODE_ENV !== 'production') {
|
90 | if (!warnedOnce) {
|
91 | warnedOnce = true;
|
92 | 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'));
|
93 | }
|
94 | }
|
95 |
|
96 | const {
|
97 | actionIcon,
|
98 | actionPosition = 'right',
|
99 | classes,
|
100 | className,
|
101 | subtitle,
|
102 | title,
|
103 | titlePosition = 'bottom'
|
104 | } = props,
|
105 | other = _objectWithoutPropertiesLoose(props, ["actionIcon", "actionPosition", "classes", "className", "subtitle", "title", "titlePosition"]);
|
106 |
|
107 | const actionPos = actionIcon && actionPosition;
|
108 | return React.createElement("div", _extends({
|
109 | className: clsx(classes.root, className, titlePosition === 'top' ? classes.titlePositionTop : classes.titlePositionBottom, subtitle && classes.rootSubtitle),
|
110 | ref: ref
|
111 | }, other), React.createElement("div", {
|
112 | className: clsx(classes.titleWrap, {
|
113 | 'left': classes.titleWrapActionPosLeft,
|
114 | 'right': classes.titleWrapActionPosRight
|
115 | }[actionPos])
|
116 | }, React.createElement("div", {
|
117 | className: classes.title
|
118 | }, title), subtitle ? React.createElement("div", {
|
119 | className: classes.subtitle
|
120 | }, subtitle) : null), actionIcon ? React.createElement("div", {
|
121 | className: clsx(classes.actionIcon, actionPos === 'left' && classes.actionIconActionPosLeft)
|
122 | }, actionIcon) : null);
|
123 | });
|
124 | process.env.NODE_ENV !== "production" ? GridListTileBar.propTypes = {
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 | |
131 |
|
132 |
|
133 |
|
134 | actionIcon: PropTypes.node,
|
135 |
|
136 | |
137 |
|
138 |
|
139 | actionPosition: PropTypes.oneOf(['left', 'right']),
|
140 |
|
141 | |
142 |
|
143 |
|
144 |
|
145 | classes: PropTypes.object,
|
146 |
|
147 | |
148 |
|
149 |
|
150 | className: PropTypes.string,
|
151 |
|
152 | |
153 |
|
154 |
|
155 | subtitle: PropTypes.node,
|
156 |
|
157 | |
158 |
|
159 |
|
160 | title: PropTypes.node,
|
161 |
|
162 | |
163 |
|
164 |
|
165 | titlePosition: PropTypes.oneOf(['bottom', 'top'])
|
166 | } : void 0;
|
167 | export default withStyles(styles, {
|
168 | name: 'MuiGridListTileBar'
|
169 | })(GridListTileBar); |
\ | No newline at end of file |