Skip to content

Commit 6445d07

Browse files
[core] Upgrade dev dependencies
1 parent 355317f commit 6445d07

File tree

3 files changed

+307
-568
lines changed

3 files changed

+307
-568
lines changed

docs/src/pages/style/color/ColorDemo.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const styles = theme => ({
1717
},
1818
appFrame: {
1919
position: 'relative',
20-
height: 360,
20+
height: 390,
2121
backgroundColor: theme.palette.background.paper,
2222
},
2323
statusBar: {

docs/src/pages/style/color/ColorTool.js

+28-27
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ const styles = theme => ({
3434
justifyContent: 'center',
3535
alignItems: 'center',
3636
},
37+
swatch: {
38+
width: 192,
39+
},
3740
sliderContainer: {
3841
display: 'flex',
3942
alignItems: 'center',
@@ -127,32 +130,6 @@ class ColorTool extends React.Component {
127130
const { classes, theme } = this.props;
128131
const { primaryShade, secondaryShade } = this.state;
129132

130-
const colorTile = (hue, colorIntent) => {
131-
const shade = colorIntent === 'primary' ? shades[primaryShade] : shades[secondaryShade];
132-
const backgroundColor = colors[hue][shade];
133-
134-
return (
135-
<Tooltip placement="right" id={`tooltip-${colorIntent}-${hue}`} title={hue} key={hue}>
136-
<Radio
137-
color="default"
138-
checked={this.state[colorIntent] === backgroundColor}
139-
onChange={this.handleChangeHue(colorIntent)}
140-
value={hue}
141-
name={colorIntent}
142-
aria-labelledby={`tooltip-${colorIntent}-${hue}`}
143-
icon={<div className={classes.radio} style={{ backgroundColor }} />}
144-
checkedIcon={
145-
<div className={classes.radioSelected} style={{ backgroundColor }}>
146-
<CheckIcon style={{ fontSize: 30 }} />
147-
</div>
148-
}
149-
/>
150-
</Tooltip>
151-
);
152-
};
153-
154-
const colorSwatch = value => hues.map(hue => colorTile(hue, value));
155-
156133
const colorBar = color => {
157134
const background = { main: color };
158135
theme.palette.augmentColor(background);
@@ -209,7 +186,31 @@ class ColorTool extends React.Component {
209186
/>
210187
<Typography>{shades[intentShade]}</Typography>
211188
</div>
212-
<div>{colorSwatch(intent)}</div>
189+
<div className={classes.swatch}>
190+
{hues.map(hue => {
191+
const shade = intent === 'primary' ? shades[primaryShade] : shades[secondaryShade];
192+
const backgroundColor = colors[hue][shade];
193+
194+
return (
195+
<Tooltip placement="right" title={hue} key={hue}>
196+
<Radio
197+
color="default"
198+
checked={this.state[intent] === backgroundColor}
199+
onChange={this.handleChangeHue(intent)}
200+
value={hue}
201+
name={intent}
202+
aria-labelledby={`tooltip-${intent}-${hue}`}
203+
icon={<div className={classes.radio} style={{ backgroundColor }} />}
204+
checkedIcon={
205+
<div className={classes.radioSelected} style={{ backgroundColor }}>
206+
<CheckIcon style={{ fontSize: 30 }} />
207+
</div>
208+
}
209+
/>
210+
</Tooltip>
211+
);
212+
})}
213+
</div>
213214
{colorBar(color)}
214215
</Grid>
215216
);

0 commit comments

Comments
 (0)