File tree 4 files changed +41
-7
lines changed
packages/design-system-react/src/components/avatar-favicon
4 files changed +41
-7
lines changed Original file line number Diff line number Diff line change
1
+ import { AvatarBaseSize } from '../avatar-base' ;
2
+ import { AvatarFaviconSize } from './AvatarFavicon.types' ;
3
+
4
+ export const AVATAR_FAVICON_TO_AVATAR_BASE_SIZE_MAP : Record <
5
+ AvatarFaviconSize ,
6
+ AvatarBaseSize
7
+ > = {
8
+ [ AvatarFaviconSize . Xs ] : AvatarBaseSize . Xs ,
9
+ [ AvatarFaviconSize . Sm ] : AvatarBaseSize . Sm ,
10
+ [ AvatarFaviconSize . Md ] : AvatarBaseSize . Md ,
11
+ [ AvatarFaviconSize . Lg ] : AvatarBaseSize . Lg ,
12
+ [ AvatarFaviconSize . Xl ] : AvatarBaseSize . Xl ,
13
+ } ;
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import React from 'react';
2
2
3
3
import { AvatarBase , AvatarBaseShape , AvatarBaseSize } from '../avatar-base' ;
4
4
import type { AvatarFaviconProps } from './AvatarFavicon.types' ;
5
+ import { AVATAR_FAVICON_TO_AVATAR_BASE_SIZE_MAP } from './AvatarFavicon.constants' ;
5
6
6
7
export const AvatarFavicon = React . forwardRef <
7
8
HTMLDivElement ,
@@ -27,7 +28,7 @@ export const AvatarFavicon = React.forwardRef<
27
28
< AvatarBase
28
29
ref = { ref }
29
30
shape = { AvatarBaseShape . Circle }
30
- size = { size }
31
+ size = { AVATAR_FAVICON_TO_AVATAR_BASE_SIZE_MAP [ size ] }
31
32
className = { className }
32
33
fallbackText = { displayText }
33
34
fallbackTextProps = { fallbackTextProps }
Original file line number Diff line number Diff line change 1
1
import type { ComponentProps } from 'react' ;
2
2
3
3
import type { TextProps } from '../text' ;
4
- import { AvatarFaviconSize } from '.' ;
4
+ import type { AvatarBaseProps } from '../avatar-base ' ;
5
5
6
- export type AvatarFaviconProps = Omit <
7
- ComponentProps < 'img' > ,
8
- 'children' | 'size'
9
- > & {
6
+ export enum AvatarFaviconSize {
7
+ /**
8
+ * Extra small size (16px)
9
+ */
10
+ Xs = 'xs' ,
11
+ /**
12
+ * Small size (24px)
13
+ */
14
+ Sm = 'sm' ,
15
+ /**
16
+ * Medium size (32px)
17
+ */
18
+ Md = 'md' ,
19
+ /**
20
+ * Large size (40px)
21
+ */
22
+ Lg = 'lg' ,
23
+ /**
24
+ * Extra large size (48px)
25
+ */
26
+ Xl = 'xl' ,
27
+ }
28
+
29
+ export type AvatarFaviconProps = Omit < AvatarBaseProps , 'size' > & {
10
30
/**
11
31
* Required name of the dapp
12
32
* Used as alt text for image and first letter is used as fallback if no fallbackText provided
Original file line number Diff line number Diff line change 1
1
export { AvatarFavicon } from './AvatarFavicon' ;
2
+ export { AvatarFaviconSize } from './AvatarFavicon.types' ;
2
3
export type { AvatarFaviconProps } from './AvatarFavicon.types' ;
3
- export { AvatarBaseSize as AvatarFaviconSize } from '../avatar-base' ;
You can’t perform that action at this time.
0 commit comments