From 072abb22407122ce19d155fd1f25bd8f79799a08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Hatcher?= Date: Sun, 13 Oct 2024 11:35:13 +0200 Subject: [PATCH] FIX: Vertical Align by default is bottom --- webapp/src/components/toolbar.tsx | 22 ++++++++-------------- webapp/src/components/workbook.tsx | 2 +- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/webapp/src/components/toolbar.tsx b/webapp/src/components/toolbar.tsx index d4ca308..230feed 100644 --- a/webapp/src/components/toolbar.tsx +++ b/webapp/src/components/toolbar.tsx @@ -144,7 +144,7 @@ function Toolbar(properties: ToolbarProperties) { $pressed={false} onClick={(): void => { properties.onNumberFormatPicked( - decreaseDecimalPlaces(properties.numFmt), + decreaseDecimalPlaces(properties.numFmt) ); }} disabled={!canEdit} @@ -157,7 +157,7 @@ function Toolbar(properties: ToolbarProperties) { $pressed={false} onClick={(): void => { properties.onNumberFormatPicked( - increaseDecimalPlaces(properties.numFmt), + increaseDecimalPlaces(properties.numFmt) ); }} disabled={!canEdit} @@ -257,7 +257,7 @@ function Toolbar(properties: ToolbarProperties) { $pressed={properties.horizontalAlign === "left"} onClick={() => properties.onToggleHorizontalAlign( - properties.horizontalAlign === "left" ? "general" : "left", + properties.horizontalAlign === "left" ? "general" : "left" ) } disabled={!canEdit} @@ -270,7 +270,7 @@ function Toolbar(properties: ToolbarProperties) { $pressed={properties.horizontalAlign === "center"} onClick={() => properties.onToggleHorizontalAlign( - properties.horizontalAlign === "center" ? "general" : "center", + properties.horizontalAlign === "center" ? "general" : "center" ) } disabled={!canEdit} @@ -283,7 +283,7 @@ function Toolbar(properties: ToolbarProperties) { $pressed={properties.horizontalAlign === "right"} onClick={() => properties.onToggleHorizontalAlign( - properties.horizontalAlign === "right" ? "general" : "right", + properties.horizontalAlign === "right" ? "general" : "right" ) } disabled={!canEdit} @@ -294,11 +294,7 @@ function Toolbar(properties: ToolbarProperties) { - properties.onToggleVerticalAlign( - properties.verticalAlign === "top" ? "bottom" : "top", - ) - } + onClick={() => properties.onToggleVerticalAlign("top")} disabled={!canEdit} title={t("toolbar.vertical_align_top")} > @@ -308,9 +304,7 @@ function Toolbar(properties: ToolbarProperties) { type="button" $pressed={properties.verticalAlign === "center"} onClick={() => - properties.onToggleVerticalAlign( - properties.verticalAlign === "center" ? "bottom" : "center", - ) + properties.onToggleVerticalAlign("center") } disabled={!canEdit} title={t("toolbar.vertical_align_middle")} @@ -440,7 +434,7 @@ export const StyledButton = styled("button")( borderTopColor: "#F1F2F8", }, }; - }, + } ); const Divider = styled("div")({ diff --git a/webapp/src/components/workbook.tsx b/webapp/src/components/workbook.tsx index a8b2c51..2436bc6 100644 --- a/webapp/src/components/workbook.tsx +++ b/webapp/src/components/workbook.tsx @@ -368,7 +368,7 @@ const Workbook = (props: { model: Model; workbookState: WorkbookState }) => { horizontalAlign={ style.alignment ? style.alignment.horizontal : "general" } - verticalAlign={style.alignment ? style.alignment.vertical : "center"} + verticalAlign={style.alignment ? style.alignment.vertical : "bottom"} canEdit={true} numFmt={style.num_fmt} showGridLines={model.getShowGridLines(model.getSelectedSheet())}