Skip to content

Commit 5705207

Browse files
set icon colors as per main branding color
1 parent 2e73aca commit 5705207

File tree

7 files changed

+68
-21
lines changed

7 files changed

+68
-21
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { getBrandingSetting } from "@lowcoder-ee/redux/selectors/enterpriseSelectors";
2+
import { ReactNode } from "react";
3+
import { useSelector } from "react-redux";
4+
import { styled } from "styled-components";
5+
6+
const IconWrapper = styled.span<{$color?: string}>`
7+
svg > path[fill-rule='evenodd'] {
8+
${props => props.$color && `fill: ${props.$color}` };
9+
}
10+
`;
11+
12+
export const BrandedIcon = (props: {
13+
children: ReactNode,
14+
}) => {
15+
const brandingSettings = useSelector(getBrandingSetting);
16+
return (
17+
<IconWrapper $color={brandingSettings?.config_set?.mainBrandingColor}>
18+
{props.children}
19+
</IconWrapper>
20+
);
21+
};

client/packages/lowcoder/src/pages/ApplicationV2/HomeResCard.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { TacoButton } from "lowcoder-design/src/components/button"
2-
import { useState } from "react";
2+
import { ReactNode, useState } from "react";
33
import { useDispatch } from "react-redux";
44
import { updateAppMetaAction } from "redux/reduxActions/applicationActions";
55
import styled from "styled-components";
@@ -24,6 +24,7 @@ import { TypographyText } from "../../components/TypographyText";
2424
import { useParams } from "react-router-dom";
2525
import { messageInstance } from "lowcoder-design/src/components/GlobalInstances";
2626
import {FolderIcon} from "icons";
27+
import { BrandedIcon } from "@lowcoder-ee/components/BrandedIcon";
2728

2829
const ExecButton = styled(TacoButton)`
2930
width: 52px;
@@ -167,13 +168,15 @@ export function HomeResCard(props: { res: HomeRes; onMove: (res: HomeRes) => voi
167168
<Wrapper>
168169
<Card>
169170
{Icon && (
170-
<Icon width={"42px"} height={"42px"} style={
171-
{
172-
color: iconColor,
173-
marginRight: "10px",
174-
flexShrink: 0
175-
}
176-
} />
171+
<BrandedIcon>
172+
<Icon width={"42px"} height={"42px"} style={
173+
{
174+
color: iconColor,
175+
marginRight: "10px",
176+
flexShrink: 0
177+
}
178+
} />
179+
</BrandedIcon>
177180
)}
178181
<CardInfo
179182
onClick={(e) => {

client/packages/lowcoder/src/pages/ApplicationV2/HomeTableView.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { MoveToFolderModal } from "./MoveToFolderModal";
2222
import { trans } from "../../i18n";
2323
import { useParams } from "react-router-dom";
2424
import { messageInstance } from "lowcoder-design/src/components/GlobalInstances";
25+
import { BrandedIcon } from "@lowcoder-ee/components/BrandedIcon";
2526

2627
const OperationWrapper = styled.div`
2728
display: flex;
@@ -119,11 +120,13 @@ export const HomeTableView = (props: { resources: HomeRes[], setModify?: any, mo
119120
return (
120121
<NameWrapper>
121122
{Icon && (
122-
<Icon
123-
width={"24px"}
124-
height={"24px"}
125-
style={{ marginRight: "10px", flexShrink: 0 }}
126-
/>
123+
<BrandedIcon>
124+
<Icon
125+
width={"24px"}
126+
height={"24px"}
127+
style={{ marginRight: "10px", flexShrink: 0 }}
128+
/>
129+
</BrandedIcon>
127130
)}
128131
<TypographyText
129132
ellipsis={true}

client/packages/lowcoder/src/pages/ApplicationV2/TrashTableView.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { deleteApplication, restoreApplication } from "../../redux/reduxActions/
99
import { HomeRes } from "./HomeLayout";
1010
import { trans, transToNode } from "../../i18n";
1111
import { messageInstance } from "lowcoder-design/src/components/GlobalInstances";
12+
import { BrandedIcon } from "@lowcoder-ee/components/BrandedIcon";
1213

1314
const OperationWrapper = styled.div`
1415
display: flex;
@@ -59,11 +60,13 @@ export const TrashTableView = (props: { resources: HomeRes[] , setModify: any, m
5960
return (
6061
<NameWrapper>
6162
{Icon && (
62-
<Icon
63-
width={"24px"}
64-
height={"24px"}
65-
style={{ marginRight: "10px", flexShrink: 0 }}
66-
/>
63+
<BrandedIcon>
64+
<Icon
65+
width={"24px"}
66+
height={"24px"}
67+
style={{ marginRight: "10px", flexShrink: 0 }}
68+
/>
69+
</BrandedIcon>
6770
)}
6871
{item.name}
6972
</NameWrapper>

client/packages/lowcoder/src/pages/editor/right/styledComponent.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const NoShake = css`
1111
transform-style: preserve-3d;
1212
`;
1313

14-
export const CompIconDiv = styled.div<{ $h: number; $w: number, $isSelected?: boolean }>`
14+
export const CompIconDiv = styled.div<{ $h: number; $w: number, $isSelected?: boolean, $color?: string }>`
1515
${NoShake};
1616
padding: 3px;
1717
background: #ffffff;
@@ -50,6 +50,15 @@ export const CompIconDiv = styled.div<{ $h: number; $w: number, $isSelected?: bo
5050
transform-style: preserve-3d;
5151
backface-visibility: hidden;
5252
`}
53+
54+
${props => props.$color && `
55+
svg > *[fill='#B480DE'] {
56+
fill: ${props.$color};
57+
}
58+
svg > *[stroke='#B480DE'] {
59+
stroke: ${props.$color};
60+
}
61+
`}
5362
`;
5463

5564
export const RightPanelContentWrapper = styled.div`

client/packages/lowcoder/src/pages/editor/right/uiCompPanel.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import {
2424
} from "lowcoder-design";
2525
import { TransparentImg } from "../../../util/commonUtils";
2626
import { RightContext } from "./rightContext";
27+
import { useSelector } from "react-redux";
28+
import { getBrandingSetting } from "@lowcoder-ee/redux/selectors/enterpriseSelectors";
2729

2830
const CompDiv = styled.div`
2931
display: flex;
@@ -65,8 +67,10 @@ const HovDiv = styled.div`
6567

6668
const IconContain = (props: { Icon: React.FunctionComponent<React.SVGProps<SVGSVGElement>> }) => {
6769
const { Icon } = props;
70+
const brandingSettings = useSelector(getBrandingSetting);
71+
6872
return (
69-
<CompIconDiv $w={64} $h={64}>
73+
<CompIconDiv $w={64} $h={64} $color={brandingSettings?.config_set?.mainBrandingColor}>
7074
<Icon />
7175
</CompIconDiv>
7276
);

client/packages/lowcoder/src/pages/setting/theme/ThemeCompPanel.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ import { JSONObject } from "util/jsonTypes";
3030
import PreviewApp from "components/PreviewApp";
3131
import { parseCompType } from "comps/utils/remote";
3232
import { defaultTheme } from "@lowcoder-ee/constants/themeConstants";
33+
import { useSelector } from "react-redux";
34+
import { getBrandingSetting } from "@lowcoder-ee/redux/selectors/enterpriseSelectors";
3335

3436
const CompDiv = styled.div`
3537
display: flex;
@@ -79,8 +81,10 @@ const IconContain = (props: {
7981
isSelected: boolean,
8082
}) => {
8183
const { Icon, isSelected } = props;
84+
const brandingSettings = useSelector(getBrandingSetting);
85+
8286
return (
83-
<CompIconDiv $w={64} $h={64} $isSelected={isSelected}>
87+
<CompIconDiv $w={64} $h={64} $isSelected={isSelected} $color={brandingSettings?.config_set?.mainBrandingColor}>
8488
<Icon />
8589
</CompIconDiv>
8690
);

0 commit comments

Comments
 (0)