@universal-tennis/ui-shared 0.1.44 → 0.1.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,6 +10,7 @@ export { default as MessageIcon } from "./stories/atoms/Icons/MessageIcon";
10
10
  export { default as SessionIcon } from "./stories/atoms/Icons/SessionIcon";
11
11
  export { default as SwapIcon } from "./stories/atoms/Icons/SwapIcon";
12
12
  export { default as Map } from "./stories/atoms/Map/Map";
13
+ export { default as AvatarWithName } from "./stories/molecules/AvatarWithName/AvatarWithName";
13
14
  export { default as ContactCard } from "./stories/molecules/Cards/ContactCard";
14
15
  export { default as DrawCard } from "./stories/molecules/Cards/DrawCard";
15
16
  export { default as TeamCard } from "./stories/molecules/Cards/TeamCard";
@@ -13,7 +13,7 @@ export { default as SessionIcon } from './stories/atoms/Icons/SessionIcon';
13
13
  export { default as SwapIcon } from './stories/atoms/Icons/SwapIcon';
14
14
  export { default as Map } from './stories/atoms/Map/Map';
15
15
  // MOLECULES
16
- export { default as AvatarWithName } from './stories/molecules/AvatarWithName';
16
+ export { default as AvatarWithName } from './stories/molecules/AvatarWithName/AvatarWithName';
17
17
  export { default as ContactCard } from './stories/molecules/Cards/ContactCard';
18
18
  export { default as DrawCard } from './stories/molecules/Cards/DrawCard';
19
19
  export { default as TeamCard } from './stories/molecules/Cards/TeamCard';
@@ -1 +1 @@
1
- {"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.jsx"],"names":[],"mappings":"AAAA,OAAO,oCAAoC,CAAC;AAE5C,QAAQ;AACR,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAC/F,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AACzF,O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qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAC/F,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AACzF,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAC3F,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAEzD,YAAY;AACZ,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,mDAAmD,CAAC;AAC9F,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAEzE,aAAa;AACb,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,0CAA0C,CAAC"}
@@ -1,17 +1,25 @@
1
1
  /// <reference types="react" />
2
2
  export interface AvatarWithNameProps {
3
- avatarTypographyCategory: string;
4
- avatarTypographySize: string;
3
+ avatarOnly: boolean;
4
+ avatarFontCategory: string;
5
+ avatarFontSize: string;
6
+ avatarWidth: string;
7
+ avatarHeight: string;
8
+ href: string;
5
9
  imgSrc: string;
6
10
  playerName: string;
7
- typographyCategory: string;
8
- typographySize: string;
11
+ fontCategory: string;
12
+ fontSize: string;
9
13
  }
10
- export default function AvatarWithName({ imgSrc, playerName, avatarTypographySize, avatarTypographyCategory, typographySize, typographyCategory }: {
14
+ export default function AvatarWithName({ avatarOnly, imgSrc, playerName, avatarFontSize, href, avatarFontCategory, avatarWidth, avatarHeight, fontSize, fontCategory }: {
15
+ avatarOnly?: boolean | undefined;
11
16
  imgSrc?: string | undefined;
12
17
  playerName?: string | undefined;
13
- avatarTypographySize?: string | undefined;
14
- avatarTypographyCategory?: string | undefined;
15
- typographySize?: string | undefined;
16
- typographyCategory?: string | undefined;
18
+ avatarFontSize?: string | undefined;
19
+ href?: string | undefined;
20
+ avatarFontCategory?: string | undefined;
21
+ avatarWidth?: string | undefined;
22
+ avatarHeight?: string | undefined;
23
+ fontSize?: string | undefined;
24
+ fontCategory?: string | undefined;
17
25
  }): JSX.Element;
@@ -1,15 +1,20 @@
1
1
  import React from 'react';
2
2
  import Avatar from '@mui/material/Avatar';
3
3
  import Box from '@mui/material/Box';
4
+ import Link from '@mui/material/Link';
4
5
  import Typography from '../../atoms/Typography/Typography';
5
- export default function AvatarWithName({ imgSrc = '', playerName = '', avatarTypographySize = '', avatarTypographyCategory = '', typographySize = '', typographyCategory = '' }) {
6
+ export default function AvatarWithName({ avatarOnly = false, imgSrc = '', playerName = '', avatarFontSize = 'medium-medium', href = '', avatarFontCategory = 'primary', avatarWidth = '40px', avatarHeight = '40px', fontSize = 'small-medium', fontCategory = 'secondary' }) {
6
7
  const getAcronym = (str) => {
7
8
  const acronym = str === null || str === void 0 ? void 0 : str.split(' ').map((word) => word.charAt(0)).join('');
8
9
  return acronym;
9
10
  };
10
- return (React.createElement(Box, { display: "flex", alignItems: "center" },
11
- React.createElement(Avatar, { sx: { bgcolor: 'black', marginRight: '10px' }, src: imgSrc },
12
- React.createElement(Typography, { size: avatarTypographySize, category: avatarTypographyCategory }, getAcronym(playerName))),
13
- React.createElement(Typography, { category: typographyCategory, size: typographySize }, playerName)));
11
+ const AvatarComponent = (React.createElement(Avatar, { sx: {
12
+ backgroundColor: 'var(--black)', marginRight: '10px', width: `${avatarWidth}`, height: `${avatarHeight}`
13
+ }, src: imgSrc },
14
+ React.createElement(Typography, { size: avatarFontSize, category: avatarFontCategory }, getAcronym(playerName))));
15
+ return (avatarOnly ? (AvatarComponent) : (React.createElement(Box, { display: "flex", alignItems: "center" },
16
+ AvatarComponent,
17
+ href ? (React.createElement(Link, { href: href, sx: { textDecoration: 'none' } },
18
+ React.createElement(Typography, { category: fontCategory, size: fontSize }, playerName))) : React.createElement(Typography, { category: fontCategory, size: fontSize }, playerName))));
14
19
  }
15
20
  //# sourceMappingURL=AvatarWithName.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AvatarWithName.js","sourceRoot":"","sources":["../../../../src/stories/molecules/AvatarWithName/AvatarWithName.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,MAAM,MAAM,sBAAsB,CAAC;AAC1C,OAAO,GAAG,MAAM,mBAAmB,CAAC;AAEpC,OAAO,UAAU,MAAM,mCAAmC,CAAC;AAW3D,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,MAAM,GAAG,EAAE,EAAE,UAAU,GAAG,EAAE,EAAE,oBAAoB,GAAG,EAAE,EAAE,wBAAwB,GAAG,EAAE,EAAE,cAAc,GAAG,EAAE,EAAE,kBAAkB,GAAG,EAAE,EACrI;IACC,MAAM,UAAU,GAAG,CAAC,GAAW,EAAE,EAAE;QACjC,MAAM,OAAO,GAAG,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,E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I,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QACvE,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC;IAEF,MAAM,eAAe,GAAG,CACpB,oBAAC,MAAM,IACH,EAAE,EAAE;YACF,eAAe,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,WAAW,EAAE,EAAE,MAAM,EAAE,GAAG,YAAY,EAAE;SACzG,EACD,GAAG,EAAE,MAAM;QAEX,oBAAC,UAAU,IAAC,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,kBAAkB,IAAG,UAAU,CAAC,UAAU,CAAC,CAAc,CAChG,CACZ,CAAC;IAEF,OAAO,CACL,UAAU,CAAC,CAAC,CAAC,CACX,eAAe,CAChB,CAAC,CAAC,CAAC,CACA,oBAAC,GAAG,IAAC,OAAO,EAAC,MAAM,EAAC,UAAU,EAAC,QAAQ;QAClC,eAAe;QACf,IAAI,CAAC,CAAC,CAAC,CACJ,oBAAC,IAAI,IAAC,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE;YAC5C,oBAAC,UAAU,IAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,IAAG,UAAU,CAAc,CAC1E,CACV,CAAC,CAAC,CAAC,oBAAC,UAAU,IAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,IAAG,UAAU,CAAc,CAC/E,CACT,CACF,CAAC;AACJ,CAAC"}
@@ -3,6 +3,10 @@ declare const _default: {
3
3
  };
4
4
  export default _default;
5
5
  export declare const Default: any;
6
- export declare const WithImageAndCustomTypography: any;
6
+ export declare const WithImage: any;
7
+ export declare const WithCustomTypography: any;
8
+ export declare const WithCustomAvatarSize: any;
9
+ export declare const WithAvatarOnly: any;
7
10
  export declare const WithNoImage: any;
8
11
  export declare const WithBrokenImage: any;
12
+ export declare const WithLink: any;
@@ -11,38 +11,48 @@ function AvatarWithNameTemplate(args) {
11
11
  // Stories
12
12
  export const Default = AvatarWithNameTemplate.bind({});
13
13
  Default.args = {
14
- avatarTypographyCategory: '',
15
- avatarTypographySize: "",
16
- imgSrc: '',
17
14
  playerName: "Julia Gulia",
18
- typographyCategory: "",
19
- typographySize: "",
20
15
  };
21
- export const WithImageAndCustomTypography = AvatarWithNameTemplate.bind({});
22
- WithImageAndCustomTypography.args = {
23
- avatarTypographyCategory: '',
24
- avatarTypographySize: "",
16
+ export const WithImage = AvatarWithNameTemplate.bind({});
17
+ WithImage.args = {
25
18
  imgSrc: 'https://ci-cdn.universaltennis.com/v1/player/329903/images/profile/7839bf68-b56f-486a-88ab-a52debbac709.png',
26
19
  playerName: "Julia Gulia",
27
- typographyCategory: "secondary",
28
- typographySize: "small-medium",
20
+ };
21
+ export const WithCustomTypography = AvatarWithNameTemplate.bind({});
22
+ WithCustomTypography.args = {
23
+ playerName: "Julia Gulia",
24
+ avatarFontCategory: "secondary",
25
+ avatarFontSize: "large-medium",
26
+ fontCategory: "primary",
27
+ fontSize: "medium-book"
28
+ };
29
+ export const WithCustomAvatarSize = AvatarWithNameTemplate.bind({});
30
+ WithCustomAvatarSize.args = {
31
+ playerName: "Julia Gulia",
32
+ avatarWidth: '26px',
33
+ avatarHeight: '26px',
34
+ avatarFontCategory: "primary",
35
+ avatarFontSize: "small-book",
36
+ };
37
+ export const WithAvatarOnly = AvatarWithNameTemplate.bind({});
38
+ WithAvatarOnly.args = {
39
+ avatarOnly: true,
40
+ playerName: "Julia Gulia",
29
41
  };
30
42
  export const WithNoImage = AvatarWithNameTemplate.bind({});
31
43
  WithNoImage.args = {
32
- avatarTypographyCategory: 'primary',
33
- avatarTypographySize: "medium-medium",
34
44
  imgSrc: '',
35
45
  playerName: "Julia Gulia",
36
- typographyCategory: "secondary",
37
- typographySize: "small-medium",
38
46
  };
39
47
  export const WithBrokenImage = AvatarWithNameTemplate.bind({});
40
48
  WithBrokenImage.args = {
41
- avatarTypographyCategory: 'primary',
42
- avatarTypographySize: "medium-medium",
43
49
  imgSrc: 'https://ci-cdn.universaltennis.com/v1/player/329903/images/profile/7839bf68-b56f-486a-88ab-a52debbac709.pn',
44
50
  playerName: "Julia Gulia",
45
- typographyCategory: "secondary",
46
- typographySize: "small-medium",
51
+ };
52
+ export const WithLink = AvatarWithNameTemplate.bind({});
53
+ WithLink.args = {
54
+ imgSrc: 'https://ci-cdn.universaltennis.com/v1/player/329903/images/profile/7839bf68-b56f-486a-88ab-a52debbac709.png',
55
+ href: "https://www.reddit.com",
56
+ playerName: "Julia Gulia",
47
57
  };
48
58
  //# sourceMappingURL=AvatarWithName.stories.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AvatarWithName.stories.js","sourceRoot":"","sources":["../../../../src/stories/molecules/AvatarWithName/AvatarWithName.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,cAAuC,MAAM,kBAAkB,CAAC;AAEvE,UAAU;AACV,eAAe;IACb,KAAK,EAAE,0BAA0B;CAClC,CAAC;AAEF,YAAY;AACZ,SAAS,sBAAsB,CAAC,IAAyB;IACvD,OAAO,oBAAC,cAAc,oBAAK,IAAI,EAAI,CAAC;AACtC,CAAC;AAED,UAAU;AACV,MAAM,CAAC,MAAM,OAAO,GAAG,sBAAsB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACvD,OAAO,CAAC,IAAI,GAAG;IACb,wBAAwB,EAAE,EAAE;IAC5B,oBAAoB,EAAE,EAAE;IACxB,MAAM,EAAE,EAAE;IACV,UAAU,EAAE,aAAa;IACzB,kBAAkB,EAAE,EAAE;IACtB,cAAc,EAAE,EAAE;CACnB,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAG,sBAAsB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC5E,4BAA4B,CAAC,IAAI,GAAG;IAClC,wBAAwB,EAAE,EAAE;IAC5B,oBAAoB,EAAE,EAAE;IACxB,MAAM,EAAE,6GAA6G;IACrH,UAAU,EAAE,aAAa;IACzB,kBAAkB,EAAE,WAAW;IAC/B,cAAc,EAAE,cAAc;CAC/B,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,sBAAsB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC3D,WAAW,CAAC,IAAI,GAAG;IACjB,wBAAwB,EAAE,SAAS;IACnC,oBAAoB,EAAE,eAAe;IACrC,MAAM,EAAE,EAAE;IACV,UAAU,EAAE,aAAa;IACzB,kBAAkB,EAAE,WAAW;IAC/B,cAAc,EAAE,cAAc;CAC/B,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,sBAAsB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC/D,eAAe,CAAC,IAAI,GAAG;IACrB,wBAAwB,EAAE,SAAS;IACnC,oBAAoB,EAAE,eAAe;IACrC,MAAM,EAAE,4GAA4G;IACpH,UAAU,EAAE,aAAa;IACzB,kBAAkB,EAAE,WAAW;IAC/B,cAAc,EAAE,cAAc;CAC/B,CAAC"}
1
+ {"version":3,"file":"AvatarWithName.stories.js","sourceRoot":"","sources":["../../../../src/stories/molecules/AvatarWithName/AvatarWithName.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,cAAuC,MAAM,kBAAkB,CAAC;AAEvE,UAAU;AACV,eAAe;IACb,KAAK,EAAE,0BAA0B;CAClC,CAAC;AAEF,YAAY;AACZ,SAAS,sBAAsB,CAAC,IAAyB;IACvD,OAAO,oBAAC,cAAc,oBAAK,IAAI,EAAI,CAAC;AACtC,CAAC;AAED,UAAU;AACV,MAAM,CAAC,MAAM,OAAO,GAAG,sBAAsB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACvD,OAAO,CAAC,IAAI,GAAG;IACb,UAAU,EAAE,aAAa;CAC1B,CAAC;AAEF,MAAM,CAAC,MAAM,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AAI,CAAC,EAAE,CAAC,CAAC;AACxD,QAAQ,CAAC,IAAI,GAAG;IACd,MAAM,EAAE,6GAA6G;IACrH,IAAI,EAAE,wBAAwB;IAC9B,UAAU,EAAE,aAAa;CAC1B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@universal-tennis/ui-shared",
3
- "version": "0.1.44",
3
+ "version": "0.1.46",
4
4
  "main": "dist/items.js",
5
5
  "license": "MIT",
6
6
  "homepage": "https://universaltennis.com",
@@ -15,7 +15,7 @@ export { default as SwapIcon } from './stories/atoms/Icons/SwapIcon';
15
15
  export { default as Map } from './stories/atoms/Map/Map';
16
16
 
17
17
  // MOLECULES
18
- export { default as AvatarWithName } from './stories/molecules/AvatarWithName';
18
+ export { default as AvatarWithName } from './stories/molecules/AvatarWithName/AvatarWithName';
19
19
  export { default as ContactCard } from './stories/molecules/Cards/ContactCard';
20
20
  export { default as DrawCard } from './stories/molecules/Cards/DrawCard';
21
21
  export { default as TeamCard } from './stories/molecules/Cards/TeamCard';
@@ -15,40 +15,54 @@ function AvatarWithNameTemplate(args: AvatarWithNameProps) {
15
15
  // Stories
16
16
  export const Default = AvatarWithNameTemplate.bind({});
17
17
  Default.args = {
18
- avatarTypographyCategory: '',
19
- avatarTypographySize: "",
20
- imgSrc: '',
21
18
  playerName: "Julia Gulia",
22
- typographyCategory: "",
23
- typographySize: "",
24
19
  };
25
20
 
26
- export const WithImageAndCustomTypography = AvatarWithNameTemplate.bind({});
27
- WithImageAndCustomTypography.args = {
28
- avatarTypographyCategory: '',
29
- avatarTypographySize: "",
21
+ export const WithImage = AvatarWithNameTemplate.bind({});
22
+ WithImage.args = {
30
23
  imgSrc: 'https://ci-cdn.universaltennis.com/v1/player/329903/images/profile/7839bf68-b56f-486a-88ab-a52debbac709.png',
31
24
  playerName: "Julia Gulia",
32
- typographyCategory: "secondary",
33
- typographySize: "small-medium",
25
+ };
26
+
27
+ export const WithCustomTypography = AvatarWithNameTemplate.bind({});
28
+ WithCustomTypography.args = {
29
+ playerName: "Julia Gulia",
30
+ avatarFontCategory: "secondary",
31
+ avatarFontSize: "large-medium",
32
+ fontCategory: "primary",
33
+ fontSize: "medium-book"
34
+ };
35
+
36
+ export const WithCustomAvatarSize = AvatarWithNameTemplate.bind({});
37
+ WithCustomAvatarSize.args = {
38
+ playerName: "Julia Gulia",
39
+ avatarWidth: '26px',
40
+ avatarHeight: '26px',
41
+ avatarFontCategory: "primary",
42
+ avatarFontSize: "small-book",
43
+ };
44
+
45
+ export const WithAvatarOnly = AvatarWithNameTemplate.bind({});
46
+ WithAvatarOnly.args = {
47
+ avatarOnly: true,
48
+ playerName: "Julia Gulia",
34
49
  };
35
50
 
36
51
  export const WithNoImage = AvatarWithNameTemplate.bind({});
37
52
  WithNoImage.args = {
38
- avatarTypographyCategory: 'primary',
39
- avatarTypographySize: "medium-medium",
40
53
  imgSrc: '',
41
54
  playerName: "Julia Gulia",
42
- typographyCategory: "secondary",
43
- typographySize: "small-medium",
44
55
  };
45
56
 
46
57
  export const WithBrokenImage = AvatarWithNameTemplate.bind({});
47
58
  WithBrokenImage.args = {
48
- avatarTypographyCategory: 'primary',
49
- avatarTypographySize: "medium-medium",
50
59
  imgSrc: 'https://ci-cdn.universaltennis.com/v1/player/329903/images/profile/7839bf68-b56f-486a-88ab-a52debbac709.pn',
51
60
  playerName: "Julia Gulia",
52
- typographyCategory: "secondary",
53
- typographySize: "small-medium",
61
+ };
62
+
63
+ export const WithLink = AvatarWithNameTemplate.bind({});
64
+ WithLink.args = {
65
+ imgSrc: 'https://ci-cdn.universaltennis.com/v1/player/329903/images/profile/7839bf68-b56f-486a-88ab-a52debbac709.png',
66
+ href: "https://www.reddit.com",
67
+ playerName: "Julia Gulia",
54
68
  };
@@ -2,32 +2,55 @@ import React from 'react';
2
2
 
3
3
  import Avatar from '@mui/material/Avatar';
4
4
  import Box from '@mui/material/Box';
5
+ import Link from '@mui/material/Link';
5
6
 
6
7
  import Typography from '../../atoms/Typography/Typography';
7
8
 
8
9
  export interface AvatarWithNameProps {
9
- avatarTypographyCategory: string;
10
- avatarTypographySize: string;
10
+ avatarOnly: boolean;
11
+ avatarFontCategory: string;
12
+ avatarFontSize: string;
13
+ avatarWidth: string;
14
+ avatarHeight: string;
15
+ href: string,
11
16
  imgSrc: string;
12
17
  playerName: string;
13
- typographyCategory: string;
14
- typographySize: string;
18
+ fontCategory: string;
19
+ fontSize: string;
15
20
  }
16
21
 
17
22
  export default function AvatarWithName({
18
- imgSrc = '', playerName = '', avatarTypographySize = '', avatarTypographyCategory = '', typographySize = '', typographyCategory = ''
23
+ avatarOnly = false, imgSrc = '', playerName = '', avatarFontSize = 'medium-medium', href = '',
24
+ avatarFontCategory = 'primary', avatarWidth = '40px', avatarHeight = '40px', fontSize = 'small-medium', fontCategory = 'secondary'
19
25
  }) {
20
26
  const getAcronym = (str: string) => {
21
27
  const acronym = str?.split(' ').map((word) => word.charAt(0)).join('');
22
28
  return acronym;
23
29
  };
24
30
 
31
+ const AvatarComponent = (
32
+ <Avatar
33
+ sx={{
34
+ backgroundColor: 'var(--black)', marginRight: '10px', width: `${avatarWidth}`, height: `${avatarHeight}`
35
+ }}
36
+ src={imgSrc}
37
+ >
38
+ <Typography size={avatarFontSize} category={avatarFontCategory}>{getAcronym(playerName)}</Typography>
39
+ </Avatar>
40
+ );
41
+
25
42
  return (
26
- <Box display="flex" alignItems="center">
27
- <Avatar sx={{ bgcolor: 'black', marginRight: '10px' }} src={imgSrc}>
28
- <Typography size={avatarTypographySize} category={avatarTypographyCategory}>{getAcronym(playerName)}</Typography>
29
- </Avatar>
30
- <Typography category={typographyCategory} size={typographySize}>{playerName}</Typography>
31
- </Box>
43
+ avatarOnly ? (
44
+ AvatarComponent
45
+ ) : (
46
+ <Box display="flex" alignItems="center">
47
+ {AvatarComponent}
48
+ {href ? (
49
+ <Link href={href} sx={{ textDecoration: 'none' }}>
50
+ <Typography category={fontCategory} size={fontSize}>{playerName}</Typography>
51
+ </Link>
52
+ ) : <Typography category={fontCategory} size={fontSize}>{playerName}</Typography>}
53
+ </Box>
54
+ )
32
55
  );
33
56
  }