Skip to content

Commit 0ebcb8d

Browse files
committed
Update avatar with badge
1 parent ed57818 commit 0ebcb8d

4 files changed

Lines changed: 28 additions & 7 deletions

File tree

component-library/src/components/wrapped/BccAvatar/BccAvatar.css

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,13 @@
5959
@apply text-5xl;
6060
}
6161

62+
.p-overlaybadge .bcc-avatar.p-avatar-circle.lg~.p-badge,
63+
.p-overlaybadge .bcc-avatar.p-avatar-circle.xl~.p-badge {
64+
transform: translate(40%, -40%);
65+
}
6266

6367
.p-overlaybadge .bcc-avatar.p-avatar-circle.xxxl~.p-badge,
64-
.p-overlaybadge .bcc-avatar.p-avatar-circle.xxl~.p-badge,
65-
.p-overlaybadge .bcc-avatar.p-avatar-circle.xl~.p-badge {
66-
transform: translate(25%, -25%);
68+
.p-overlaybadge .bcc-avatar.p-avatar-circle.xxl~.p-badge {
69+
transform: translate(20%, -20%);
6770
}
6871
}

component-library/src/components/wrapped/BccAvatar/BccAvatar.stories.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,24 @@ export const AvatarGroup: Story = {
180180
};
181181

182182
export const WithBadge: Story = {
183-
render: () => ({
183+
args: { label: 'B', gender: 'female', child: true, size: 'xxl' },
184+
render: args => ({
184185
components: { BccAvatar, BccOverlayBadge },
186+
setup() {
187+
const sizeMap = {
188+
xs: 'small',
189+
sm: 'small',
190+
md: 'medium',
191+
lg: 'large',
192+
xl: 'large',
193+
xxl: 'xlarge',
194+
xxxl: 'xlarge',
195+
};
196+
return { args, sizeMap };
197+
},
185198
template: `
186-
<BccOverlayBadge value="3" class="inline-block">
187-
<BccAvatar label="B" gender="female" child size="xxl" shape="circle" />
199+
<BccOverlayBadge value="3" :size="sizeMap[args.size]">
200+
<BccAvatar v-bind="args" />
188201
</BccOverlayBadge>
189202
`,
190203
}),

component-library/src/components/wrapped/BccAvatar/BccAvatar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export type AvatarProps = Omit<PrimeAvatarProps, 'shape' | 'size'> & {
1414
squared?: boolean;
1515
/** Adds a visible border around the avatar. */
1616
bordered?: boolean;
17-
/** Controls the avatar dimensions; maps to CSS size classes (xs through xxl). */
17+
/** Controls the avatar dimensions; maps to CSS size classes (xs through xxl). Default: md */
1818
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
1919
};
2020

component-library/src/styles/component-overrides.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,9 @@ GUTTER FIX
3232
.p-select-overlay,
3333
.p-treeselect-overlay {
3434
margin: var(--p-anchor-gutter) 0;
35+
}
36+
37+
/* This fix is to ensure overlay badge is contained within the size of the component it wraps */
38+
.p-overlaybadge {
39+
display: inline-block;
3540
}

0 commit comments

Comments
 (0)