Skip to content

Commit ccc2dbf

Browse files
let's merge
1 parent 04bada5 commit ccc2dbf

File tree

5 files changed

+96
-643
lines changed

5 files changed

+96
-643
lines changed

docs/src/pages/demos/chips/ChipsPlayground.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,18 @@ class ChipsPlayground extends React.Component {
4747
const { classes } = this.props;
4848
const { color, onDelete, avatar } = this.state;
4949

50-
const colorToCode = color !== 'default' ? `color=${color}` : '';
50+
const colorToCode = color !== 'default' ? `color=${color} ` : '';
5151

5252
let onDeleteToCode;
5353
switch (onDelete) {
5454
case 'none':
5555
onDeleteToCode = '';
5656
break;
5757
case 'custom':
58-
onDeleteToCode = 'deleteIcon={<DoneIcon />} onDelete={handleDelete}';
58+
onDeleteToCode = 'deleteIcon={<DoneIcon />} onDelete={handleDelete} ';
5959
break;
6060
default:
61-
onDeleteToCode = 'onDelete={handleDelete}';
61+
onDeleteToCode = 'onDelete={handleDelete} ';
6262
break;
6363
}
6464

@@ -69,15 +69,15 @@ class ChipsPlayground extends React.Component {
6969
avatarToCode = '';
7070
break;
7171
case 'img':
72-
avatarToCode = 'avatar={<Avatar src="https://github.com/static/images/uxceo-128.jpg" />}';
72+
avatarToCode = 'avatar={<Avatar src="https://github.com/static/images/uxceo-128.jpg" />} ';
7373
avatarToPlayground = <Avatar src="/static/images/uxceo-128.jpg" />;
7474
break;
7575
case 'letter':
76-
avatarToCode = 'avatar={<Avatar>FH</Avatar>}';
76+
avatarToCode = 'avatar={<Avatar>FH</Avatar>} ';
7777
avatarToPlayground = <Avatar>FH</Avatar>;
7878
break;
7979
default:
80-
avatarToCode = 'avatar={<Avatar><FaceIcon /></Avatar>}';
80+
avatarToCode = 'avatar={<Avatar><FaceIcon /></Avatar>} ';
8181
avatarToPlayground = (
8282
<Avatar>
8383
<FaceIcon />
@@ -88,7 +88,7 @@ class ChipsPlayground extends React.Component {
8888

8989
const code = `
9090
\`\`\`jsx
91-
<Chip ${colorToCode} ${onDeleteToCode} ${avatarToCode} />
91+
<Chip ${colorToCode}${onDeleteToCode}${avatarToCode}/>
9292
\`\`\`
9393
`;
9494

packages/material-ui/src/Chip/Chip.js

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ export const styles = theme => {
4949
},
5050
/* Styles applied to the root element if `onClick` is defined or `clickable={true}`. */
5151
clickable: {
52-
// Remove grey highlight
53-
WebkitTapHighlightColor: 'transparent',
52+
WebkitTapHighlightColor: 'transparent', // Remove grey highlight
5453
cursor: 'pointer',
5554
'&:hover, &:focus': {
5655
backgroundColor: emphasize(backgroundColor, 0.08),
@@ -64,8 +63,7 @@ export const styles = theme => {
6463
* Styles applied to the root element if
6564
* `onClick` and `color="primary"` is defined or `clickable={true}`.
6665
*/
67-
clickablePrimary: {
68-
// Remove grey highlight
66+
clickableColorPrimary: {
6967
'&:hover, &:focus': {
7068
backgroundColor: emphasize(theme.palette.primary.main, 0.08),
7169
},
@@ -77,8 +75,7 @@ export const styles = theme => {
7775
* Styles applied to the root element if
7876
* `onClick` and `color="secondary"` is defined or `clickable={true}`.
7977
*/
80-
clickableSecondary: {
81-
// Remove grey highlight
78+
clickableColorSecondary: {
8279
'&:hover, &:focus': {
8380
backgroundColor: emphasize(theme.palette.secondary.main, 0.08),
8481
},
@@ -93,13 +90,13 @@ export const styles = theme => {
9390
},
9491
},
9592
/* Styles applied to the root element if `onDelete` and `color="primary"` is defined. */
96-
deletablePrimary: {
93+
deletableColorPrimary: {
9794
'&:focus': {
9895
backgroundColor: emphasize(theme.palette.primary.main, 0.2),
9996
},
10097
},
10198
/* Styles applied to the root element if `onDelete` and `color="secondary"` is defined. */
102-
deletableSecondary: {
99+
deletableColorSecondary: {
103100
'&:focus': {
104101
backgroundColor: emphasize(theme.palette.secondary.main, 0.2),
105102
},
@@ -113,12 +110,12 @@ export const styles = theme => {
113110
fontSize: theme.typography.pxToRem(16),
114111
},
115112
/* Styles applied to the `avatar` element if `checked={true}` and `color="primary"` */
116-
avatarPrimary: {
113+
avatarColorPrimary: {
117114
color: darken(theme.palette.primary.contrastText, 0.1),
118115
backgroundColor: theme.palette.primary.dark,
119116
},
120117
/* Styles applied to the `avatar` element if `checked={true}` and `color="secondary"` */
121-
avatarSecondary: {
118+
avatarColorSecondary: {
122119
color: darken(theme.palette.secondary.contrastText, 0.1),
123120
backgroundColor: theme.palette.secondary.dark,
124121
},
@@ -150,14 +147,14 @@ export const styles = theme => {
150147
},
151148
},
152149
/* Styles applied to the deleteIcon element if `color="primary"`. */
153-
deleteIconPrimary: {
150+
deleteIconColorPrimary: {
154151
color: fade(theme.palette.primary.contrastText, 0.65),
155152
'&:hover, &:active': {
156153
color: theme.palette.primary.contrastText,
157154
},
158155
},
159156
/* Styles applied to the deleteIcon element if `color="secondary"`. */
160-
deleteIconSecondary: {
157+
deleteIconColorSecondary: {
161158
color: fade(theme.palette.primary.contrastText, 0.65),
162159
'&:hover, &:active': {
163160
color: theme.palette.primary.contrastText,
@@ -214,13 +211,13 @@ class Chip extends React.Component {
214211
classes,
215212
className: classNameProp,
216213
clickable,
214+
color,
217215
component: Component,
218216
deleteIcon: deleteIconProp,
219217
label,
220218
onClick,
221219
onDelete,
222220
onKeyDown,
223-
color,
224221
tabIndex: tabIndexProp,
225222
...other
226223
} = this.props;
@@ -229,9 +226,9 @@ class Chip extends React.Component {
229226
classes.root,
230227
{ [classes[`color${capitalize(color)}`]]: color !== 'default' },
231228
{ [classes.clickable]: onClick || clickable },
232-
{ [classes[`clickable${capitalize(color)}`]]: (onClick || clickable) && color !== 'default' },
229+
{ [classes[`clickableColor${capitalize(color)}`]]: (onClick || clickable) && color !== 'default' },
233230
{ [classes.deletable]: onDelete },
234-
{ [classes[`deletable${capitalize(color)}`]]: onDelete && color !== 'default' },
231+
{ [classes[`deletableColor${capitalize(color)}`]]: onDelete && color !== 'default' },
235232
classNameProp,
236233
);
237234

@@ -241,14 +238,14 @@ class Chip extends React.Component {
241238
deleteIconProp && React.isValidElement(deleteIconProp) ? (
242239
React.cloneElement(deleteIconProp, {
243240
className: classNames(deleteIconProp.props.className, classes.deleteIcon, {
244-
[classes[`deleteIcon${capitalize(color)}`]]: color !== 'default',
241+
[classes[`deleteIconColor${capitalize(color)}`]]: color !== 'default',
245242
}),
246243
onClick: this.handleDeleteIconClick,
247244
})
248245
) : (
249246
<CancelIcon
250247
className={classNames(classes.deleteIcon, {
251-
[classes[`deleteIcon${capitalize(color)}`]]: color !== 'default',
248+
[classes[`deleteIconColor${capitalize(color)}`]]: color !== 'default',
252249
})}
253250
onClick={this.handleDeleteIconClick}
254251
/>
@@ -259,7 +256,7 @@ class Chip extends React.Component {
259256
if (avatarProp && React.isValidElement(avatarProp)) {
260257
avatar = React.cloneElement(avatarProp, {
261258
className: classNames(classes.avatar, avatarProp.props.className, {
262-
[classes[`avatar${capitalize(color)}`]]: color !== 'default',
259+
[classes[`avatarColor${capitalize(color)}`]]: color !== 'default',
263260
}),
264261
childrenClassName: classNames(classes.avatarChildren, avatarProp.props.childrenClassName),
265262
});

0 commit comments

Comments
 (0)