update: in Type and Bucket buttons, use a colored div instead of a border

This commit is contained in:
Daniel
2025-07-17 00:49:54 +02:00
committed by Nicolás Hatcher Andrés
parent 4850b6518f
commit eb8b129431

View File

@@ -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,8 +502,10 @@ 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) =>
prop !== "$pressed" && prop !== "$underlinedColor",
})<TypeButtonProperties>(({ disabled, $pressed }) => {
const result = { const result = {
width: "24px", width: "24px",
minWidth: "24px", minWidth: "24px",
@@ -517,6 +521,7 @@ export const StyledButton = styled("button")<TypeButtonProperties>(
cursor: "pointer", cursor: "pointer",
backgroundColor: "white", backgroundColor: "white",
padding: "0px", padding: "0px",
position: "relative" as const,
svg: { svg: {
width: "16px", width: "16px",
height: "16px", height: "16px",
@@ -531,10 +536,6 @@ export const StyledButton = styled("button")<TypeButtonProperties>(
} }
return { return {
...result, ...result,
borderTop: $underlinedColor
? `3px solid ${theme.palette.common.white}`
: "none",
borderBottom: $underlinedColor ? `3px solid ${$underlinedColor}` : "none",
color: theme.palette.grey["900"], color: theme.palette.grey["900"],
backgroundColor: $pressed backgroundColor: $pressed
? theme.palette.grey["300"] ? theme.palette.grey["300"]
@@ -542,15 +543,23 @@ export const StyledButton = styled("button")<TypeButtonProperties>(
"&:hover": { "&:hover": {
transition: "all 0.2s", transition: "all 0.2s",
outline: `1px solid ${theme.palette.grey["200"]}`, outline: `1px solid ${theme.palette.grey["200"]}`,
borderTopColor: theme.palette.common.white,
}, },
"&:active": { "&:active": {
backgroundColor: theme.palette.grey["300"], backgroundColor: theme.palette.grey["300"],
outline: `1px solid ${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",