Skip to content

Commit 9308879

Browse files
Merge pull request #2051 from iamfaran/feat/1289-customize-drawer-close
[Feat]: #1289 add close icon customization
2 parents ad164cb + 4aa6d92 commit 9308879

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

client/packages/lowcoder/src/comps/hooks/drawerComp.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import styled from "styled-components";
2424
import { useUserViewMode } from "util/hooks";
2525
import { isNumeric } from "util/stringUtils";
2626
import { NameConfig, withExposingConfigs } from "../generators/withExposing";
27+
import { IconControl } from "comps/controls/iconControl";
28+
import { hasIcon } from "comps/utils";
2729
import { title } from "process";
2830
import { SliderControl } from "../controls/sliderControl";
2931
import clsx from "clsx";
@@ -122,6 +124,7 @@ const childrenMap = {
122124
showMask: withDefault(BoolControl, true),
123125
toggleClose:withDefault(BoolControl,true),
124126
escapeClosable: withDefault(BoolControl, true),
127+
closeIcon: withDefault(IconControl, ""),
125128
zIndex: withDefault(NumberControl, Layers.drawer),
126129
};
127130

@@ -139,6 +142,9 @@ const DrawerPropertyView = React.memo((props: {
139142
{props.children.title.getView() && props.children.titleAlign.propertyView({ label: trans("drawer.titleAlign"), radioButton: true })}
140143
{props.children.closePosition.propertyView({ label: trans("drawer.closePosition"), radioButton: true })}
141144
{props.children.placement.propertyView({ label: trans("drawer.placement"), radioButton: true })}
145+
{props.children.toggleClose.getView() && props.children.closeIcon.propertyView({
146+
label: trans("drawer.closeIcon"),
147+
})}
142148
{["top", "bottom"].includes(props.children.placement.getView())
143149
? props.children.autoHeight.getPropertyView()
144150
: props.children.width.propertyView({
@@ -266,7 +272,7 @@ const DrawerView = React.memo((
266272
$closePosition={props.closePosition}
267273
onClick={onClose}
268274
>
269-
<CloseOutlined />
275+
{hasIcon(props.closeIcon) ? props.closeIcon : <CloseOutlined />}
270276
</ButtonStyle>
271277
)}
272278
<InnerGrid

client/packages/lowcoder/src/i18n/locales/en.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2366,7 +2366,9 @@ export const en = {
23662366
"openDrawerDesc": "Open Drawer",
23672367
"closeDrawerDesc": "Close Drawer",
23682368
"width": "Drawer Width",
2369-
"height": "Drawer Height"
2369+
"height": "Drawer Height",
2370+
"closeIcon": "Close Icon",
2371+
23702372
},
23712373
"meeting": {
23722374
"logLevel": "Agora SDK Log Level",

0 commit comments

Comments
 (0)