Skip to content

Commit 9e553b0

Browse files
committed
avatar group styles added
1 parent e923590 commit 9e553b0

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

client/packages/lowcoder/src/comps/comps/avatarGroup.tsx

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { CompAction, RecordConstructorToView, changeChildAction } from "lowcoder-core";
22
import { styleControl } from "comps/controls/styleControl";
3-
import { QRCodeStyle, QRCodeStyleType, avatarGroupStyle, AvatarGroupStyleType } from "comps/controls/styleControlConstants";
3+
import { QRCodeStyle, QRCodeStyleType, avatarGroupStyle, AvatarGroupStyleType, avatarContainerStyle, AvatarContainerStyleType } from "comps/controls/styleControlConstants";
44
import { UICompBuilder } from "comps/generators/uiCompBuilder";
55
import { NameConfig, NameConfigHidden, withExposingConfigs } from "comps/generators/withExposing";
66
import { AlignCenter, AlignLeft, AlignRight, Section, sectionNames } from "lowcoder-design";
@@ -31,13 +31,20 @@ const MacaroneList = [
3131
'#fcd6bb',
3232
]
3333

34-
const Container = styled.div<{ $style: AvatarGroupStyleType | undefined, alignment: string }>`
34+
const Container = styled.div<{ $style: AvatarContainerStyleType | undefined, alignment: string }>`
3535
height: 100%;
3636
width: 100%;
3737
display: flex;
3838
align-items: center;
3939
justify-content: ${props => props.alignment};
4040
cursor: pointer;
41+
background: ${props => props?.$style?.background};
42+
margin: ${props => props?.$style?.margin};
43+
padding: ${props => props?.$style?.padding};
44+
border: ${props => props?.$style?.border};
45+
border-style: ${props => props?.$style?.borderStyle};
46+
border-radius: ${props => props?.$style?.radius};
47+
border-width: ${props => props?.$style?.borderWidth};
4148
`;
4249

4350
const DropdownOption = new MultiCompBuilder(
@@ -79,7 +86,8 @@ export const alignOptions = [
7986
] as const;
8087

8188
const childrenMap = {
82-
style: styleControl(avatarGroupStyle),
89+
avatar: styleControl(avatarGroupStyle),
90+
style: styleControl(avatarContainerStyle),
8391
maxCount: withDefault(NumberControl, 3),
8492
avatarSize: withDefault(NumberControl, 40),
8593
alignment: dropdownControl(alignOptions, "center"),
@@ -112,8 +120,8 @@ const AvatarGroupView = (props: RecordConstructorToView<typeof childrenMap> & {
112120
src={item.src ?? undefined}
113121
icon={(item.AvatarIcon as ReactElement)?.props.value === '' || item.label.trim() !== '' ? undefined : item.AvatarIcon}
114122
style={{
115-
color: item.color ? item.color : (props.style.fill !== '#FFFFFF' ? props.style.fill : '#FFFFFF'),
116-
backgroundColor: item.backgroundColor ? item.backgroundColor : (props.autoColor ? MacaroneList[index % MacaroneList.length] : props.style.background),
123+
color: item.color ? item.color : (props.avatar.fill !== '#FFFFFF' ? props.avatar.fill : '#FFFFFF'),
124+
backgroundColor: item.backgroundColor ? item.backgroundColor : (props.autoColor ? MacaroneList[index % MacaroneList.length] : props.avatar.background),
117125
}}
118126
size={props.avatarSize}
119127
onClick={() => {
@@ -163,9 +171,14 @@ let AvatarGroupBasicComp = (function () {
163171
)}
164172

165173
{["layout", "both"].includes(useContext(EditorContext).editorModeStatus) && (
174+
<>
175+
<Section name={sectionNames.avatarStyle}>
176+
{children.avatar.getPropertyView()}
177+
</Section>
166178
<Section name={sectionNames.style}>
167179
{children.style.getPropertyView()}
168180
</Section>
181+
</>
169182
)}
170183
</>
171184
))

0 commit comments

Comments
 (0)