Skip to content

Commit 77bc2c4

Browse files
authored
fix(avatar): slotted icon size (#1504)
1 parent 29fb7c1 commit 77bc2c4

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

src/components/avatar/themes/shared/avatar.common.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ $theme: $material;
55

66
:host {
77
--component-size: var(--ig-size, #{var-get($theme, 'default-size')});
8+
9+
::slotted(igc-icon) {
10+
--ig-size: 3;
11+
12+
color: var-get($theme, 'icon-color');
13+
}
814
}
915

1016
[part='base'] {

src/components/avatar/themes/shared/avatar.indigo.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,5 @@ $theme: $indigo;
88

99
::slotted(igc-icon) {
1010
--ig-size: 1;
11-
12-
color: var-get($theme, 'icon-color');
1311
}
1412
}

stories/avatar.stories.ts

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
import type { Meta, StoryObj } from '@storybook/web-components';
22

3-
import { IgcAvatarComponent, defineComponents } from 'igniteui-webcomponents';
3+
import {
4+
IgcAvatarComponent,
5+
IgcIconComponent,
6+
defineComponents,
7+
registerIcon,
8+
} from 'igniteui-webcomponents';
9+
import { html } from 'lit';
410

5-
defineComponents(IgcAvatarComponent);
11+
defineComponents(IgcAvatarComponent, IgcIconComponent);
612

713
// region default
814
const metadata: Meta<IgcAvatarComponent> = {
@@ -57,6 +63,11 @@ interface IgcAvatarArgs {
5763
}
5864
type Story = StoryObj<IgcAvatarArgs>;
5965

66+
registerIcon(
67+
'home',
68+
'https://unpkg.com/[email protected]/action/svg/production/ic_home_24px.svg'
69+
);
70+
6071
// endregion
6172

6273
export const Image: Story = {
@@ -66,6 +77,14 @@ export const Image: Story = {
6677
},
6778
};
6879

80+
export const WithIcon: Story = {
81+
render: () => html`
82+
<igc-avatar>
83+
<igc-icon name="home"></igc-icon>
84+
</igc-avatar>
85+
`,
86+
};
87+
6988
export const WithInitials: Story = {
7089
args: {
7190
initials: 'RK',

0 commit comments

Comments
 (0)