Skip to content

Commit 180e77a

Browse files
committed
styles added to float button
1 parent 68ea696 commit 180e77a

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

client/packages/lowcoder/src/comps/comps/buttonComp/floatButtonComp.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { BoolControl } from "comps/controls/boolControl";
33
import { stringExposingStateControl } from "comps/controls/codeStateControl";
44
import { dropdownControl } from "comps/controls/dropdownControl";
55
import { styleControl } from "comps/controls/styleControl";
6-
import { FloatButtonStyle, FloatButtonStyleType } from "comps/controls/styleControlConstants";
6+
import { BadgeStyle, BadgeStyleType, FloatButtonStyle, FloatButtonStyleType } from "comps/controls/styleControlConstants";
77
import { UICompBuilder } from "comps/generators/uiCompBuilder";
88
import { NameConfig, NameConfigHidden, withExposingConfigs } from "comps/generators/withExposing";
99
import { Section, sectionNames } from "lowcoder-design";
@@ -17,7 +17,7 @@ import styled from "styled-components";
1717
import { ButtonEventHandlerControl } from "comps/controls/eventHandlerControl";
1818
import { manualOptionsControl } from "comps/controls/optionsControl";
1919

20-
const Wrapper = styled.div<{ $style: FloatButtonStyleType }>`
20+
const Wrapper = styled.div<{ $badgeStyle: BadgeStyleType, $style: FloatButtonStyleType}>`
2121
width: 0px;
2222
height: 0px;
2323
overflow: hidden;
@@ -29,6 +29,12 @@ const Wrapper = styled.div<{ $style: FloatButtonStyleType }>`
2929
right: 0px;
3030
inset-block-end: -8px;
3131
}
32+
.ant-float-btn-primary .ant-float-btn-body {
33+
background-color: ${(props) => props.$style.background};
34+
border: ${(props) => props.$style.border};
35+
border-style: ${(props) => props.$style.borderStyle};
36+
border-width: ${(props) => props.$style.borderWidth};
37+
}
3238
`
3339

3440
const buttonShapeOption = [
@@ -70,6 +76,7 @@ const childrenMap = {
7076
includeMargin: BoolControl.DEFAULT_TRUE,
7177
image: StringControl,
7278
icon: withDefault(IconControl, '/icon:antd/questioncircleoutlined'),
79+
badgeStyle: styleControl(BadgeStyle),
7380
style: styleControl(FloatButtonStyle),
7481
buttons: manualOptionsControl(buttonGroupOption, {
7582
initOptions: [
@@ -92,20 +99,20 @@ const FloatButtonView = (props: RecordConstructorToView<typeof childrenMap>) =>
9299
onClick={() => button.onEvent("click")}
93100
tooltip={button?.label}
94101
description={button?.description}
95-
badge={{ count: button?.badge, color: props.style.badgeColor, dot: props?.dot }}
102+
badge={{ count: button?.badge, color: props.badgeStyle.badgeColor, dot: props?.dot }}
96103
type={onlyOne ? props.buttonTheme : 'default'}
97104
shape={props.shape}
98105
/>)
99106
: ''
100107
}
101108
return (
102-
<Wrapper $style={props.style} >
109+
<Wrapper $badgeStyle={props.badgeStyle} $style={props.style}>
103110
{props.buttons.length === 1 ? (renderButton(props.buttons[0], true)) :
104111
(<FloatButton.Group
105112
trigger="hover"
106113
icon={props.icon}
107114
shape={props.shape}
108-
badge={{ count: props.buttons.reduce((sum, i) => sum + (i.buttonType === 'custom' && !i.hidden ? i.badge : 0), 0), color: props.style.badgeColor, dot: props.dot }}
115+
badge={{ count: props.buttons.reduce((sum, i) => sum + (i.buttonType === 'custom' && !i.hidden ? i.badge : 0), 0), color: props.badgeStyle.badgeColor, dot: props.dot }}
109116
type={props.buttonTheme}
110117
>
111118
{props.buttons.map((button: any) => renderButton(button))}
@@ -129,6 +136,7 @@ let FloatButtonBasicComp = (function () {
129136
<Section name={sectionNames.layout}>
130137
{hiddenPropertyView(children)}
131138
</Section>
139+
<Section name={sectionNames.badgeStyle}>{children.badgeStyle.getPropertyView()}</Section>
132140
<Section name={sectionNames.style}>{children.style.getPropertyView()}</Section>
133141
</>
134142
))

0 commit comments

Comments
 (0)