chore: fix color picker position

close #27598
This commit is contained in:
afc163 2020-11-06 12:11:47 +08:00
parent f5d5e9b5ee
commit 2430ae2732

View File

@ -57,9 +57,10 @@ export default class ColorPicker extends Component<ColorPickerProps> {
render() {
const { small, position, presetColors } = this.props;
const { color, displayColorPicker } = this.state;
const width = small ? 80 : 120;
const styles = {
color: {
width: small ? '80px' : '120px',
width: `${width}px`,
height: small ? '16px' : '24px',
borderRadius: '2px',
background: color,
@ -90,7 +91,7 @@ export default class ColorPicker extends Component<ColorPickerProps> {
};
if (position === 'top') {
styles.wrapper.transform = 'translateY(-100%)';
styles.wrapper.transform = `translate(calc(-100% + ${width + 8}px), -100%)`;
styles.wrapper.paddingBottom = 8;
}