Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#696 - Avatar - Changes in avatar sizes #705

Merged
merged 3 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 30 additions & 8 deletions packages/react-components/src/components/Avatar/Avatar.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ $base-class: 'avatar';
&--medium#{$circle-class},
&--large#{$circle-class},
&--xlarge#{$circle-class},
&--xxlarge#{$circle-class} {
&--xxlarge#{$circle-class},
&--xxxlarge#{$circle-class} {
bottom: 75%;
left: 75%;
}
Expand All @@ -49,7 +50,8 @@ $base-class: 'avatar';
&--medium#{$rounded-square-class},
&--large#{$rounded-square-class},
&--xlarge#{$rounded-square-class},
&--xxlarge#{$rounded-square-class} {
&--xxlarge#{$rounded-square-class},
&--xxxlarge#{$rounded-square-class} {
bottom: 81.25%;
left: 81.25%;
}
Expand Down Expand Up @@ -85,18 +87,24 @@ $base-class: 'avatar';
}

&--large {
border-width: calc(10px * 0.125);
width: 10px;
height: 10px;
}

&--xlarge {
border-width: calc(12px * 0.125);
width: 12px;
height: 12px;
}

&--xlarge {
&--xxlarge {
border-width: calc(16px * 0.125);
width: 16px;
height: 16px;
}

&--xxlarge {
&--xxxlarge {
border-width: calc(24px * 0.125);
width: 24px;
height: 24px;
Expand Down Expand Up @@ -127,7 +135,8 @@ $base-class: 'avatar';
&--medium,
&--large,
&--xlarge,
&--xxlarge {
&--xxlarge,
&--xxxlarge {
border-width: 3px;
width: calc(100% + 4px);
height: calc(100% + 4px);
Expand Down Expand Up @@ -181,6 +190,11 @@ $base-class: 'avatar';
width: 48px;
height: 48px;
}

&--xxxlarge svg {
width: 48px;
height: 48px;
}
}

&--circle {
Expand All @@ -201,7 +215,8 @@ $base-class: 'avatar';
&--with-rim.#{$base-class}--medium,
&--with-rim.#{$base-class}--large,
&--with-rim.#{$base-class}--xlarge,
&--with-rim.#{$base-class}--xxlarge {
&--with-rim.#{$base-class}--xxlarge,
&--with-rim.#{$base-class}--xxxlarge {
margin: 5px;
}

Expand Down Expand Up @@ -241,20 +256,27 @@ $base-class: 'avatar';
}

&--large {
width: 40px;
height: 40px;
line-height: 24px;
font-size: 18px;
}

&--xlarge {
width: 48px;
height: 48px;
line-height: 24px;
font-size: 18px;
}

&--xlarge {
&--xxlarge {
width: 64px;
height: 64px;
line-height: 32px;
font-size: 24px;
}

&--xxlarge {
&--xxxlarge {
width: 96px;
height: 96px;
line-height: 40px;
Expand Down
28 changes: 28 additions & 0 deletions packages/react-components/src/components/Avatar/Avatar.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ export const Sizes = (): React.ReactElement => (
<StoryDescriptor title="XXLarge">
<Avatar type="text" text={defaultName} size="xxlarge" />
</StoryDescriptor>
<StoryDescriptor title="XXXLarge">
<Avatar type="text" text={defaultName} size="xxxlarge" />
</StoryDescriptor>
</>
);

Expand Down Expand Up @@ -229,6 +232,21 @@ export const SizesWithStatus = (): React.ReactElement => (
status="available"
/>
</StoryDescriptor>
<StoryDescriptor title="XXXLarge">
<Avatar
type="image"
src={defaultImage}
size="xxxlarge"
status="available"
/>
<Avatar
type="text"
text={defaultName}
shape="rounded-square"
size="xxxlarge"
status="available"
/>
</StoryDescriptor>
</>
);

Expand Down Expand Up @@ -314,5 +332,15 @@ export const SizesWithRim = (): React.ReactElement => (
withRim
/>
</StoryDescriptor>
<StoryDescriptor title="XXXLarge">
<Avatar type="image" src={defaultImage} size="xxxlarge" withRim />
<Avatar
type="text"
text={defaultName}
shape="rounded-square"
size="xxxlarge"
withRim
/>
</StoryDescriptor>
</>
);
5 changes: 3 additions & 2 deletions packages/react-components/src/components/Avatar/Avatar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';

import { Person as PersonIcon } from '@livechat/design-system-icons/react/material';
import { Person as PersonIcon } from '@livechat/design-system-icons/react/tabler';
import cx from 'clsx';

import { Icon } from '../Icon';
Expand All @@ -18,7 +18,8 @@ type AvatarSize =
| 'medium'
| 'large'
| 'xlarge'
| 'xxlarge';
| 'xxlarge'
| 'xxxlarge';
type AvatarStatus = 'available' | 'unavailable' | 'unknown';
type AvatarType = 'image' | 'text';

Expand Down