Skip to content

Commit

Permalink
fix(avatar): slotted icon size (#1504)
Browse files Browse the repository at this point in the history
  • Loading branch information
SisIvanova authored Dec 6, 2024
1 parent 29fb7c1 commit 77bc2c4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
6 changes: 6 additions & 0 deletions src/components/avatar/themes/shared/avatar.common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ $theme: $material;

:host {
--component-size: var(--ig-size, #{var-get($theme, 'default-size')});

::slotted(igc-icon) {
--ig-size: 3;

color: var-get($theme, 'icon-color');
}
}

[part='base'] {
Expand Down
2 changes: 0 additions & 2 deletions src/components/avatar/themes/shared/avatar.indigo.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@ $theme: $indigo;

::slotted(igc-icon) {
--ig-size: 1;

color: var-get($theme, 'icon-color');
}
}
23 changes: 21 additions & 2 deletions stories/avatar.stories.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import type { Meta, StoryObj } from '@storybook/web-components';

import { IgcAvatarComponent, defineComponents } from 'igniteui-webcomponents';
import {
IgcAvatarComponent,
IgcIconComponent,
defineComponents,
registerIcon,
} from 'igniteui-webcomponents';
import { html } from 'lit';

defineComponents(IgcAvatarComponent);
defineComponents(IgcAvatarComponent, IgcIconComponent);

// region default
const metadata: Meta<IgcAvatarComponent> = {
Expand Down Expand Up @@ -57,6 +63,11 @@ interface IgcAvatarArgs {
}
type Story = StoryObj<IgcAvatarArgs>;

registerIcon(
'home',
'https://unpkg.com/[email protected]/action/svg/production/ic_home_24px.svg'
);

// endregion

export const Image: Story = {
Expand All @@ -66,6 +77,14 @@ export const Image: Story = {
},
};

export const WithIcon: Story = {
render: () => html`
<igc-avatar>
<igc-icon name="home"></igc-icon>
</igc-avatar>
`,
};

export const WithInitials: Story = {
args: {
initials: 'RK',
Expand Down

0 comments on commit 77bc2c4

Please sign in to comment.