Skip to content

Commit

Permalink
Fix color picker.
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianStehle committed Feb 1, 2024
1 parent 5acee19 commit b18fe4c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
11 changes: 2 additions & 9 deletions src/core/react/ColorPicker.scss
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
@import '@app/style/mixins';
@import '@app/style/vars';

$size: 24px;
$size: 22px;

.color-picker {
&-button {
&,
& button {
padding: 2px !important;
}
}

&-colors {
@include clearfix;
max-width: 210px;
Expand All @@ -24,9 +17,9 @@ $size: 24px;
background: $color-white;
border: 1px solid $color-input;
border-radius: $size;
box-sizing: border-box;
display: inline-flex;
justify-content: center;
margin: 1px;
}

&.rect {
Expand Down
7 changes: 6 additions & 1 deletion src/core/react/ColorPicker.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import type { Meta, StoryObj } from '@storybook/react';
import { Button } from 'antd';
import { ColorPalette } from '@app/core/utils';
import { ColorPicker } from './ColorPicker';

Expand All @@ -15,7 +16,11 @@ const meta: Meta<typeof ColorPicker> = {
const palette = ColorPalette.colors();

return (
<ColorPicker palette={palette} {...args} />
<>
<ColorPicker palette={palette} {...args} />
&nbsp;
<Button>Button</Button>
</>
);
},
argTypes: {
Expand Down
13 changes: 9 additions & 4 deletions src/core/react/ColorPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { texts } from '@app/texts';
import { ColorList } from './ColorList';
import { useEventCallback } from './hooks';
import './ColorPicker.scss';
import Icon from '@ant-design/icons';

type ColorTab = 'palette' | 'advanced';

Expand Down Expand Up @@ -122,10 +123,14 @@ export const ColorPicker = React.memo((props: ColorPickerProps) => {

return (
<Popover content={content} open={visible && !disabled} placement={placement} trigger='click' onOpenChange={setVisible}>

Check warning on line 125 in src/core/react/ColorPicker.tsx

View check run for this annotation

Codecov / codecov/patch

src/core/react/ColorPicker.tsx#L125

Added line #L125 was not covered by tests
<Button disabled={disabled} className='color-picker-button' onClick={doToggle}>
<div className='color-picker-color'>
<div className='color-picker-color-inner' style={{ background: colorHex }}></div>
</div>
<Button disabled={disabled} className='color-picker-button' onClick={doToggle}
icon={
<Icon component={() =>
<div className='color-picker-color'>

Check warning on line 129 in src/core/react/ColorPicker.tsx

View check run for this annotation

Codecov / codecov/patch

src/core/react/ColorPicker.tsx#L129

Added line #L129 was not covered by tests
<div className='color-picker-color-inner' style={{ background: colorHex }}></div>
</div>
} />
}>
</Button>
</Popover>
);
Expand Down

0 comments on commit b18fe4c

Please sign in to comment.