Skip to content

Commit 9275cf7

Browse files
SvenAlHamadPavel910
authored andcommitted
fix(lexical): color picker active state styling
1 parent 280f0bb commit 9275cf7

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

packages/lexical-editor-actions/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"@webiny/app-page-builder-elements": "0.0.0",
88
"@webiny/lexical-editor": "0.0.0",
99
"@webiny/ui": "0.0.0",
10-
"classnames": "^2.3.1",
1110
"emotion": "^10.0.27",
1211
"react": "18.2.0",
1312
"react-color": "^2.19.3",

packages/lexical-editor-actions/src/components/LexicalColorPicker/LexicalColorPicker.tsx

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React, { useCallback, useState, SyntheticEvent, useRef, useEffect, useMem
22
import styled from "@emotion/styled";
33
import { css } from "emotion";
44
import { usePageElements } from "@webiny/app-page-builder-elements/hooks/usePageElements";
5-
import classnames from "classnames";
65
import { ChromePicker, ColorState, RGBColor } from "react-color";
76
import { OnChangeHandler } from "react-color/lib/components/common/ColorWrap";
87
import { Tooltip } from "@webiny/ui/Tooltip";
@@ -34,7 +33,7 @@ const Color = styled("button")({
3433
cursor: "pointer",
3534
width: 40,
3635
height: 40,
37-
transition: "transform 0.2s, scale 0.2s",
36+
transition: "transform 0.1s, border 0.2s",
3837
borderColor: "transparent",
3938
display: "flex",
4039
alignItems: "center",
@@ -85,7 +84,10 @@ const COLORS = {
8584

8685
const styles = {
8786
selectedColor: css({
88-
boxShadow: "0px 0px 0px 2px var(--mdc-theme-secondary)"
87+
boxShadow: "inset 0px 0px 0px 10px var(--mdc-theme-secondary)",
88+
button: {
89+
border: "5px solid var(--mdc-theme-surface)"
90+
}
8991
}),
9092
button: css({
9193
cursor: "pointer",
@@ -192,10 +194,9 @@ export const LexicalColorPicker = ({
192194
themeColor.current = true;
193195
}
194196
return (
195-
<ColorBox key={index}>
197+
<ColorBox key={index} className={color === value ? styles.selectedColor : ""}>
196198
<Tooltip content={<span>{color}</span>} placement="bottom">
197199
<Color
198-
className={key === value ? styles.selectedColor : ""}
199200
style={{ backgroundColor: color }}
200201
onClick={() => {
201202
// With page elements implementation, we want to store the color key and
@@ -209,23 +210,20 @@ export const LexicalColorPicker = ({
209210
);
210211
})}
211212

212-
<ColorBox>
213+
<ColorBox className={value === "transparent" ? styles.selectedColor : ""}>
213214
<Tooltip content={<span>Transparent</span>} placement="bottom">
214215
<Color
215-
className={classnames(transparent, {
216-
[styles.selectedColor]: value === "transparent"
217-
})}
216+
className={transparent}
218217
onClick={() => {
219218
onChangeComplete("transparent");
220219
}}
221220
/>
222221
</Tooltip>
223222
</ColorBox>
224223

225-
<ColorBox>
224+
<ColorBox className={value && !themeColor.current ? styles.selectedColor : ""}>
226225
<Tooltip content={<span>Color picker</span>} placement="bottom">
227226
<Color
228-
className={value && !themeColor.current ? styles.selectedColor : ""}
229227
style={{ backgroundColor: themeColor.current ? "#fff" : value }}
230228
onClick={togglePicker}
231229
>

yarn.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18399,7 +18399,6 @@ __metadata:
1839918399
"@webiny/lexical-editor": 0.0.0
1840018400
"@webiny/project-utils": 0.0.0
1840118401
"@webiny/ui": 0.0.0
18402-
classnames: ^2.3.1
1840318402
emotion: ^10.0.27
1840418403
react: 18.2.0
1840518404
react-color: ^2.19.3

0 commit comments

Comments
 (0)