Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix table bg-color changing #1911

Merged
merged 2 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/shared/types/dash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export type DashTabItem =
| DashTabItemImage;

type BackgroundSettings = {
enabled?: boolean;
color: string;
};

Expand Down
4 changes: 3 additions & 1 deletion src/ui/components/DashKit/plugins/Image/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ function PluginImage(props: Props, _ref?: React.LegacyRef<HTMLDivElement>) {
w: null,
};
const backgroundEnabled = Boolean(
background?.color && background?.color !== CustomPaletteColors.NONE,
background?.enabled !== false &&
background?.color &&
background?.color !== CustomPaletteColors.NONE,
);
const {classMod, style} = React.useMemo(() => {
return getPreparedWrapSettings(backgroundEnabled, background?.color);
Expand Down
4 changes: 3 additions & 1 deletion src/ui/components/DashKit/plugins/Text/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ const textPlugin = {
const data = props.data as DashTabItemText['data'];

const showBgColor = Boolean(
data.background?.color && data.background?.color !== CustomPaletteColors.NONE,
data.background?.enabled !== false &&
data.background?.color &&
data.background?.color !== CustomPaletteColors.NONE,
);

const {classMod, style} = getPreparedWrapSettings(showBgColor, data.background?.color);
Expand Down
4 changes: 3 additions & 1 deletion src/ui/components/DashKit/plugins/Title/Title.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ const titlePlugin: PluginTitle = {
const content = <DashKitPluginTitle {...props} ref={forwardedRef} />;

const showBgColor = Boolean(
data.background?.color && data.background?.color !== CustomPaletteColors.NONE,
data.background?.enabled !== false &&
data.background?.color &&
data.background?.color !== CustomPaletteColors.NONE,
);

const {classMod, style} = getPreparedWrapSettings(showBgColor, data.background?.color);
Expand Down
2 changes: 1 addition & 1 deletion src/ui/components/DashKit/plugins/Widget/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export type CurrentTab = {
autoHeight?: boolean;
enableActionParams?: boolean;
background?: {
enabled: boolean;
enabled?: boolean;
color: string;
};
};
Expand Down
2 changes: 1 addition & 1 deletion src/ui/components/Widgets/Chart/ChartWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ export const ChartWidget = (props: ChartWidgetProps) => {
}, [editMode, widgetType]);

const showBgColor = Boolean(
currentTab.background?.enabled &&
currentTab?.enabled !== false &&
currentTab.background?.color &&
currentTab.background?.color !== 'transparent',
);
Expand Down
Loading