FIX: More sensible decrease/increase font-size
This commit is contained in:
committed by
Nicolás Hatcher Andrés
parent
a9a8c4f615
commit
4f627b4363
@@ -7,8 +7,6 @@ import type {
|
|||||||
import { styled } from "@mui/material/styles";
|
import { styled } from "@mui/material/styles";
|
||||||
import type {} from "@mui/system";
|
import type {} from "@mui/system";
|
||||||
import {
|
import {
|
||||||
AArrowDown,
|
|
||||||
AArrowUp,
|
|
||||||
AlignCenter,
|
AlignCenter,
|
||||||
AlignLeft,
|
AlignLeft,
|
||||||
AlignRight,
|
AlignRight,
|
||||||
@@ -22,9 +20,11 @@ import {
|
|||||||
Grid2x2X,
|
Grid2x2X,
|
||||||
ImageDown,
|
ImageDown,
|
||||||
Italic,
|
Italic,
|
||||||
|
Minus,
|
||||||
PaintBucket,
|
PaintBucket,
|
||||||
PaintRoller,
|
PaintRoller,
|
||||||
Percent,
|
Percent,
|
||||||
|
Plus,
|
||||||
Redo2,
|
Redo2,
|
||||||
RemoveFormatting,
|
RemoveFormatting,
|
||||||
Strikethrough,
|
Strikethrough,
|
||||||
@@ -74,6 +74,7 @@ type ToolbarProperties = {
|
|||||||
onDownloadPNG: () => void;
|
onDownloadPNG: () => void;
|
||||||
fillColor: string;
|
fillColor: string;
|
||||||
fontColor: string;
|
fontColor: string;
|
||||||
|
fontSize: number;
|
||||||
bold: boolean;
|
bold: boolean;
|
||||||
underline: boolean;
|
underline: boolean;
|
||||||
italic: boolean;
|
italic: boolean;
|
||||||
@@ -253,17 +254,7 @@ function Toolbar(properties: ToolbarProperties) {
|
|||||||
>
|
>
|
||||||
<Type />
|
<Type />
|
||||||
</StyledButton>
|
</StyledButton>
|
||||||
<StyledButton
|
<Divider />
|
||||||
type="button"
|
|
||||||
$pressed={false}
|
|
||||||
disabled={!canEdit}
|
|
||||||
onClick={() => {
|
|
||||||
properties.onIncreaseFontSize(1);
|
|
||||||
}}
|
|
||||||
title={t("toolbar.increase_font_size")}
|
|
||||||
>
|
|
||||||
<AArrowUp />
|
|
||||||
</StyledButton>
|
|
||||||
<StyledButton
|
<StyledButton
|
||||||
type="button"
|
type="button"
|
||||||
$pressed={false}
|
$pressed={false}
|
||||||
@@ -273,8 +264,21 @@ function Toolbar(properties: ToolbarProperties) {
|
|||||||
}}
|
}}
|
||||||
title={t("toolbar.decrease_font_size")}
|
title={t("toolbar.decrease_font_size")}
|
||||||
>
|
>
|
||||||
<AArrowDown />
|
<Minus />
|
||||||
</StyledButton>
|
</StyledButton>
|
||||||
|
<FontSizeBox>{properties.fontSize}</FontSizeBox>
|
||||||
|
<StyledButton
|
||||||
|
type="button"
|
||||||
|
$pressed={false}
|
||||||
|
disabled={!canEdit}
|
||||||
|
onClick={() => {
|
||||||
|
properties.onIncreaseFontSize(1);
|
||||||
|
}}
|
||||||
|
title={t("toolbar.increase_font_size")}
|
||||||
|
>
|
||||||
|
<Plus />
|
||||||
|
</StyledButton>
|
||||||
|
<Divider />
|
||||||
<StyledButton
|
<StyledButton
|
||||||
type="button"
|
type="button"
|
||||||
$pressed={false}
|
$pressed={false}
|
||||||
@@ -534,4 +538,16 @@ const Divider = styled("div")({
|
|||||||
margin: "0px 12px",
|
margin: "0px 12px",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const FontSizeBox = styled("div")({
|
||||||
|
width: "24px",
|
||||||
|
height: "24px",
|
||||||
|
lineHeight: "24px",
|
||||||
|
textAlign: "center",
|
||||||
|
fontFamily: "Inter",
|
||||||
|
fontSize: "11px",
|
||||||
|
border: `1px solid ${theme.palette.grey["300"]}`,
|
||||||
|
borderRadius: "4px",
|
||||||
|
minWidth: "24px",
|
||||||
|
});
|
||||||
|
|
||||||
export default Toolbar;
|
export default Toolbar;
|
||||||
|
|||||||
@@ -628,6 +628,7 @@ const Workbook = (props: { model: Model; workbookState: WorkbookState }) => {
|
|||||||
}}
|
}}
|
||||||
fillColor={style.fill.fg_color || "#FFFFFF"}
|
fillColor={style.fill.fg_color || "#FFFFFF"}
|
||||||
fontColor={style.font.color}
|
fontColor={style.font.color}
|
||||||
|
fontSize={style.font.sz}
|
||||||
bold={style.font.b}
|
bold={style.font.b}
|
||||||
underline={style.font.u}
|
underline={style.font.u}
|
||||||
italic={style.font.i}
|
italic={style.font.i}
|
||||||
|
|||||||
Reference in New Issue
Block a user