From eb8b1294318f73aeb72867e897989f581e0a7f38 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 17 Jul 2025 00:49:54 +0200 Subject: [PATCH] update: in Type and Bucket buttons, use a colored div instead of a border --- .../src/components/Toolbar/Toolbar.tsx | 105 ++++++++++-------- 1 file changed, 57 insertions(+), 48 deletions(-) diff --git a/webapp/IronCalc/src/components/Toolbar/Toolbar.tsx b/webapp/IronCalc/src/components/Toolbar/Toolbar.tsx index ea5ae4c..c48d17b 100644 --- a/webapp/IronCalc/src/components/Toolbar/Toolbar.tsx +++ b/webapp/IronCalc/src/components/Toolbar/Toolbar.tsx @@ -278,6 +278,7 @@ function Toolbar(properties: ToolbarProperties) { onClick={() => setFontColorPickerOpen(true)} > + setFillColorPickerOpen(true)} > + ( - ({ disabled, $pressed, $underlinedColor }) => { - const result = { - width: "24px", - minWidth: "24px", - height: "24px", - display: "inline-flex", - alignItems: "center", - justifyContent: "center", - fontSize: "12px", - border: `0px solid ${theme.palette.common.white}`, - borderRadius: "4px", - transition: "all 0.2s", - outline: `1px solid ${theme.palette.common.white}`, - cursor: "pointer", - backgroundColor: "white", - padding: "0px", - svg: { - width: "16px", - height: "16px", - }, - }; - if (disabled) { - return { - ...result, - color: theme.palette.grey["400"], - cursor: "default", - }; - } +export const StyledButton = styled("button", { + shouldForwardProp: (prop) => + prop !== "$pressed" && prop !== "$underlinedColor", +})(({ disabled, $pressed }) => { + const result = { + width: "24px", + minWidth: "24px", + height: "24px", + display: "inline-flex", + alignItems: "center", + justifyContent: "center", + fontSize: "12px", + border: `0px solid ${theme.palette.common.white}`, + borderRadius: "4px", + transition: "all 0.2s", + outline: `1px solid ${theme.palette.common.white}`, + cursor: "pointer", + backgroundColor: "white", + padding: "0px", + position: "relative" as const, + svg: { + width: "16px", + height: "16px", + }, + }; + if (disabled) { return { ...result, - borderTop: $underlinedColor - ? `3px solid ${theme.palette.common.white}` - : "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"]}`, - }, + color: theme.palette.grey["400"], + cursor: "default", }; - }, -); + } + 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")({ width: "0px",