Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Commit fe8a348

Browse files
committed
working text align
1 parent 0b46cbc commit fe8a348

File tree

4 files changed

+25
-6
lines changed

4 files changed

+25
-6
lines changed

src/cdm/StyleModel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ export type ColorPickerProps = {
1212
} & BaseStyleProps;
1313

1414
export type TextAlignmentProps = {
15-
15+
currentAlignment: string;
1616
} & BaseStyleProps;

src/components/modals/columnSettings/handlers/AlignmentSelectorHandler.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export class AlignmentSelectorHandler extends AbstractHandlerClass<ColumnSetting
2121
<TextAlignmentSelector
2222
modal={columnSettingsManager.modal}
2323
columnKey={column.key}
24+
currentAlignment={column.config.content_alignment}
2425
/>
2526
);
2627
return this.goNext(columnHandlerResponse);

src/components/styles/TextAlignmentSelector.tsx

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import Stack from "@mui/material/Stack";
66
import ToggleButton from "@mui/material/ToggleButton";
77
import ToggleButtonGroup from "@mui/material/ToggleButtonGroup";
88
import { TextAlignmentProps } from "cdm/StyleModel";
9-
import { COLUMN_ALIGNMENT_OPTIONS } from "helpers/Constants";
9+
import { COLUMN_ALIGNMENT_OPTIONS, StyleVariables } from "helpers/Constants";
1010

1111
export default function TextAlignmentSelector(props: TextAlignmentProps) {
12-
const { modal, columnKey } = props;
12+
const { modal, columnKey, currentAlignment } = props;
1313
const { view } = modal;
14-
const [alignment, setAlignment] = React.useState("left");
14+
const [alignment, setAlignment] = React.useState(currentAlignment);
1515

1616
const handleAlignment = async (
1717
event: React.MouseEvent<HTMLElement>,
@@ -38,18 +38,36 @@ export default function TextAlignmentSelector(props: TextAlignmentProps) {
3838
<ToggleButton
3939
value={COLUMN_ALIGNMENT_OPTIONS.LEFT}
4040
aria-label="left aligned"
41+
sx={{
42+
color: StyleVariables.TEXT_NORMAL,
43+
"&.Mui-selected, &.Mui-selected:hover": {
44+
color: StyleVariables.TEXT_ACCENT,
45+
},
46+
}}
4147
>
4248
<FormatAlignLeftIcon />
4349
</ToggleButton>
4450
<ToggleButton
4551
value={COLUMN_ALIGNMENT_OPTIONS.CENTER}
4652
aria-label="centered"
53+
sx={{
54+
color: StyleVariables.TEXT_NORMAL,
55+
"&.Mui-selected, &.Mui-selected:hover": {
56+
color: StyleVariables.TEXT_ACCENT,
57+
},
58+
}}
4759
>
4860
<FormatAlignCenterIcon />
4961
</ToggleButton>
5062
<ToggleButton
5163
value={COLUMN_ALIGNMENT_OPTIONS.RIGHT}
5264
aria-label="right aligned"
65+
sx={{
66+
color: StyleVariables.TEXT_NORMAL,
67+
"&.Mui-selected, &.Mui-selected:hover": {
68+
color: StyleVariables.TEXT_ACCENT,
69+
},
70+
}}
5371
>
5472
<FormatAlignRightIcon />
5573
</ToggleButton>

styles.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,8 +491,8 @@ div.database-plugin__checkbox {
491491

492492
.database-plugin__text-align-right {
493493
display: flex;
494-
align-items: right;
495494
justify-content: flex-end;
495+
text-align: right;
496496
}
497497

498498
.database-plugin__text-align-center {
@@ -503,8 +503,8 @@ div.database-plugin__checkbox {
503503

504504
.database-plugin__text-align-left {
505505
display: flex;
506-
text-align: left;
507506
justify-content: flex-start;
507+
text-align: left;
508508
}
509509

510510
.cell-padding {

0 commit comments

Comments
 (0)