mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-01 11:39:28 +08:00
site: update color picker position
This commit is contained in:
parent
24e2af63f2
commit
6cb3ae46a2
@ -12,6 +12,7 @@ export default class ColorPicker extends Component {
|
||||
static defaultProps = {
|
||||
onChange: noop,
|
||||
onChangeComplete: noop,
|
||||
position: 'bottom',
|
||||
}
|
||||
|
||||
constructor(props) {
|
||||
@ -39,7 +40,7 @@ export default class ColorPicker extends Component {
|
||||
this.props.onChangeComplete(color.hex);
|
||||
};
|
||||
render() {
|
||||
const { small, type } = this.props;
|
||||
const { small, type, position } = this.props;
|
||||
|
||||
const Picker = pickers[type];
|
||||
|
||||
@ -74,12 +75,18 @@ export default class ColorPicker extends Component {
|
||||
zIndex: '100',
|
||||
},
|
||||
};
|
||||
return (
|
||||
<div>
|
||||
|
||||
if (position === 'top') {
|
||||
styles.wrapper.transform = 'translateY(-100%)';
|
||||
styles.wrapper.paddingBottom = 8;
|
||||
}
|
||||
|
||||
const swatch = (
|
||||
<div style={styles.swatch} onClick={this.handleClick}>
|
||||
<div style={styles.color} />
|
||||
</div>
|
||||
{this.state.displayColorPicker ? (
|
||||
);
|
||||
const picker = this.state.displayColorPicker ? (
|
||||
<div style={styles.popover}>
|
||||
<div style={styles.cover} onClick={this.handleClose} />
|
||||
<div style={styles.wrapper}>
|
||||
@ -91,8 +98,11 @@ export default class ColorPicker extends Component {
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
) : null;
|
||||
|
||||
if (position === 'top') {
|
||||
return <div>{picker}{swatch}</div>;
|
||||
}
|
||||
return <div>{swatch}{picker}</div>;
|
||||
}
|
||||
}
|
||||
|
@ -104,6 +104,7 @@ class Footer extends React.Component {
|
||||
type="sketch"
|
||||
small
|
||||
color={this.state.color}
|
||||
position="top"
|
||||
presetColors={[
|
||||
'#f04134',
|
||||
'#00a854',
|
||||
|
Loading…
Reference in New Issue
Block a user