update: in Type and Bucket buttons, use a colored div instead of a border
This commit is contained in:
committed by
Nicolás Hatcher Andrés
parent
4850b6518f
commit
eb8b129431
@@ -278,6 +278,7 @@ function Toolbar(properties: ToolbarProperties) {
|
|||||||
onClick={() => setFontColorPickerOpen(true)}
|
onClick={() => setFontColorPickerOpen(true)}
|
||||||
>
|
>
|
||||||
<Type />
|
<Type />
|
||||||
|
<ColorLine color={properties.fontColor} />
|
||||||
</StyledButton>
|
</StyledButton>
|
||||||
<StyledButton
|
<StyledButton
|
||||||
type="button"
|
type="button"
|
||||||
@@ -289,6 +290,7 @@ function Toolbar(properties: ToolbarProperties) {
|
|||||||
onClick={() => setFillColorPickerOpen(true)}
|
onClick={() => setFillColorPickerOpen(true)}
|
||||||
>
|
>
|
||||||
<PaintBucket />
|
<PaintBucket />
|
||||||
|
<ColorLine color={properties.fillColor} />
|
||||||
</StyledButton>
|
</StyledButton>
|
||||||
<StyledButton
|
<StyledButton
|
||||||
type="button"
|
type="button"
|
||||||
@@ -500,57 +502,64 @@ const ToolbarContainer = styled("div")`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
type TypeButtonProperties = { $pressed: boolean; $underlinedColor?: string };
|
type TypeButtonProperties = { $pressed: boolean; $underlinedColor?: string };
|
||||||
export const StyledButton = styled("button")<TypeButtonProperties>(
|
export const StyledButton = styled("button", {
|
||||||
({ disabled, $pressed, $underlinedColor }) => {
|
shouldForwardProp: (prop) =>
|
||||||
const result = {
|
prop !== "$pressed" && prop !== "$underlinedColor",
|
||||||
width: "24px",
|
})<TypeButtonProperties>(({ disabled, $pressed }) => {
|
||||||
minWidth: "24px",
|
const result = {
|
||||||
height: "24px",
|
width: "24px",
|
||||||
display: "inline-flex",
|
minWidth: "24px",
|
||||||
alignItems: "center",
|
height: "24px",
|
||||||
justifyContent: "center",
|
display: "inline-flex",
|
||||||
fontSize: "12px",
|
alignItems: "center",
|
||||||
border: `0px solid ${theme.palette.common.white}`,
|
justifyContent: "center",
|
||||||
borderRadius: "4px",
|
fontSize: "12px",
|
||||||
transition: "all 0.2s",
|
border: `0px solid ${theme.palette.common.white}`,
|
||||||
outline: `1px solid ${theme.palette.common.white}`,
|
borderRadius: "4px",
|
||||||
cursor: "pointer",
|
transition: "all 0.2s",
|
||||||
backgroundColor: "white",
|
outline: `1px solid ${theme.palette.common.white}`,
|
||||||
padding: "0px",
|
cursor: "pointer",
|
||||||
svg: {
|
backgroundColor: "white",
|
||||||
width: "16px",
|
padding: "0px",
|
||||||
height: "16px",
|
position: "relative" as const,
|
||||||
},
|
svg: {
|
||||||
};
|
width: "16px",
|
||||||
if (disabled) {
|
height: "16px",
|
||||||
return {
|
},
|
||||||
...result,
|
};
|
||||||
color: theme.palette.grey["400"],
|
if (disabled) {
|
||||||
cursor: "default",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return {
|
return {
|
||||||
...result,
|
...result,
|
||||||
borderTop: $underlinedColor
|
color: theme.palette.grey["400"],
|
||||||
? `3px solid ${theme.palette.common.white}`
|
cursor: "default",
|
||||||
: "none",
|
|
||||||
borderBottom: $underlinedColor ? `3px solid ${$underlinedColor}` : "none",
|
|
||||||
color: theme.palette.grey["900"],
|
|
||||||
backgroundColor: $pressed
|
|
||||||
? theme.palette.grey["300"]
|
|
||||||
: theme.palette.common.white,
|
|
||||||
"&:hover": {
|
|
||||||
transition: "all 0.2s",
|
|
||||||
outline: `1px solid ${theme.palette.grey["200"]}`,
|
|
||||||
borderTopColor: theme.palette.common.white,
|
|
||||||
},
|
|
||||||
"&:active": {
|
|
||||||
backgroundColor: theme.palette.grey["300"],
|
|
||||||
outline: `1px solid ${theme.palette.grey["300"]}`,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
},
|
}
|
||||||
);
|
return {
|
||||||
|
...result,
|
||||||
|
color: theme.palette.grey["900"],
|
||||||
|
backgroundColor: $pressed
|
||||||
|
? theme.palette.grey["300"]
|
||||||
|
: theme.palette.common.white,
|
||||||
|
"&:hover": {
|
||||||
|
transition: "all 0.2s",
|
||||||
|
outline: `1px solid ${theme.palette.grey["200"]}`,
|
||||||
|
},
|
||||||
|
"&:active": {
|
||||||
|
backgroundColor: theme.palette.grey["300"],
|
||||||
|
outline: `1px solid ${theme.palette.grey["300"]}`,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const ColorLine = styled("div")<{ color: string }>(({ color }) => ({
|
||||||
|
height: "3px",
|
||||||
|
width: "16px",
|
||||||
|
position: "absolute",
|
||||||
|
bottom: "0px",
|
||||||
|
left: "50%",
|
||||||
|
transform: "translateX(-50%)",
|
||||||
|
backgroundColor: color,
|
||||||
|
}));
|
||||||
|
|
||||||
const Divider = styled("div")({
|
const Divider = styled("div")({
|
||||||
width: "0px",
|
width: "0px",
|
||||||
|
|||||||
Reference in New Issue
Block a user