@universal-tennis/ui-shared 0.1.49 → 0.1.51
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.
- package/.storybook/variables.css +1 -0
- package/dist/components.d.ts +1 -0
- package/dist/components.js +1 -0
- package/dist/components.js.map +1 -1
- package/dist/stories/assets/css/variables.css +1 -0
- package/dist/stories/atoms/Icons/CalendarIcon.js +1 -1
- package/dist/stories/atoms/Icons/LocationIcon.js +1 -1
- package/dist/stories/molecules/SquareAvatarWithName/SquareAvatarWithName.d.ts +25 -0
- package/dist/stories/molecules/SquareAvatarWithName/SquareAvatarWithName.js +23 -0
- package/dist/stories/molecules/SquareAvatarWithName/SquareAvatarWithName.js.map +1 -0
- package/dist/stories/molecules/SquareAvatarWithName/SquareAvatarWithName.stories.d.ts +12 -0
- package/dist/stories/molecules/SquareAvatarWithName/SquareAvatarWithName.stories.js +60 -0
- package/dist/stories/molecules/SquareAvatarWithName/SquareAvatarWithName.stories.js.map +1 -0
- package/package.json +1 -1
- package/src/components.jsx +1 -0
- package/src/stories/assets/css/variables.css +1 -0
- package/src/stories/atoms/Icons/CalendarIcon.tsx +1 -1
- package/src/stories/atoms/Icons/LocationIcon.tsx +1 -1
- package/src/stories/molecules/SquareAvatarWithName/SquareAvatarWithName.stories.tsx +70 -0
- package/src/stories/molecules/SquareAvatarWithName/SquareAvatarWithName.tsx +76 -0
package/.storybook/variables.css
CHANGED
package/dist/components.d.ts
CHANGED
|
@@ -13,6 +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
|
export { default as AvatarWithName } from "./stories/molecules/AvatarWithName/AvatarWithName";
|
|
16
|
+
export { default as SquareAvatarWithName } from "./stories/molecules/SquareAvatarWithName/SquareAvatarWithName";
|
|
16
17
|
export { default as ContactCard } from "./stories/molecules/Cards/ContactCard";
|
|
17
18
|
export { default as DrawCard } from "./stories/molecules/Cards/DrawCard";
|
|
18
19
|
export { default as TeamCard } from "./stories/molecules/Cards/TeamCard";
|
package/dist/components.js
CHANGED
|
@@ -16,6 +16,7 @@ export { default as SwapIcon } from './stories/atoms/Icons/SwapIcon';
|
|
|
16
16
|
export { default as Map } from './stories/atoms/Map/Map';
|
|
17
17
|
// MOLECULES
|
|
18
18
|
export { default as AvatarWithName } from './stories/molecules/AvatarWithName/AvatarWithName';
|
|
19
|
+
export { default as SquareAvatarWithName } from './stories/molecules/SquareAvatarWithName/SquareAvatarWithName';
|
|
19
20
|
export { default as ContactCard } from './stories/molecules/Cards/ContactCard';
|
|
20
21
|
export { default as DrawCard } from './stories/molecules/Cards/DrawCard';
|
|
21
22
|
export { default as TeamCard } from './stories/molecules/Cards/TeamCard';
|
package/dist/components.js.map
CHANGED
|
@@ -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,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAC3F,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACjG,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,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 size, color }) {
|
|
4
|
-
return (React.createElement("svg", { width: size, height: size, viewBox: "0 0
|
|
4
|
+
return (React.createElement("svg", { width: size, height: size, viewBox: "0 0 14 14", fill: color, xmlns: "http://www.w3.org/2000/svg" },
|
|
5
5
|
React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M4.5 0.5C4.77614 0.5 5 0.723858 5 1V2H9V1C9 0.723858 9.22386 0.5 9.5 0.5C9.77614 0.5 10 0.723858 10 1V2H11C12.1046 2 13 2.89543 13 4V11C13 12.1046 12.1046 13 11 13H3C1.89543 13 1 12.1046 1 11V4C1 2.89543 1.89543 2 3 2H4V1C4 0.723858 4.22386 0.5 4.5 0.5ZM9 3V4C9 4.27614 9.22386 4.5 9.5 4.5C9.77614 4.5 10 4.27614 10 4V3H11C11.5523 3 12 3.44772 12 4V6.08325H2V4C2 3.44772 2.44772 3 3 3H4V4C4 4.27614 4.22386 4.5 4.5 4.5C4.77614 4.5 5 4.27614 5 4V3H9ZM2 7.08325V11C2 11.5523 2.44772 12 3 12H11C11.5523 12 12 11.5523 12 11V7.08325H2Z" })));
|
|
6
6
|
}
|
|
7
7
|
//# sourceMappingURL=CalendarIcon.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable max-len */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
export default function LocationIcon({ size, color }) {
|
|
4
|
-
return (React.createElement("svg", { width: size, height: size, viewBox: "0 0
|
|
4
|
+
return (React.createElement("svg", { width: size, height: size, viewBox: "0 0 14 14", fill: color, xmlns: "http://www.w3.org/2000/svg" },
|
|
5
5
|
React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M7 8C8.10457 8 9 7.10457 9 6C9 4.89543 8.10457 4 7 4C5.89543 4 5 4.89543 5 6C5 7.10457 5.89543 8 7 8ZM7 9C8.65685 9 10 7.65685 10 6C10 4.34315 8.65685 3 7 3C5.34315 3 4 4.34315 4 6C4 7.65685 5.34315 9 7 9Z" }),
|
|
6
6
|
React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M9.30809 10.9655C10.7626 9.57161 12 7.8219 12 6C12 3.23858 9.76142 1 7 1C4.23858 1 2 3.23858 2 6C2 7.8219 3.2374 9.57161 4.69191 10.9655C5.39697 11.6412 6.10609 12.1882 6.64052 12.5668C6.7725 12.6603 6.89326 12.7431 7 12.8146C7.10674 12.7431 7.2275 12.6603 7.35948 12.5668C7.89391 12.1882 8.60303 11.6412 9.30809 10.9655ZM7 14C7 14 13 10.5 13 6C13 2.68629 10.3137 0 7 0C3.68629 0 1 2.68629 1 6C1 10.5 7 14 7 14Z" })));
|
|
7
7
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface SquareAvatarWithNameProps {
|
|
3
|
+
avatarOnly: boolean;
|
|
4
|
+
avatarFontCategory: string;
|
|
5
|
+
avatarFontSize: string;
|
|
6
|
+
avatarWidth: string;
|
|
7
|
+
avatarHeight: string;
|
|
8
|
+
href: string;
|
|
9
|
+
name: string;
|
|
10
|
+
fontCategory: string;
|
|
11
|
+
fontSize: string;
|
|
12
|
+
isBye: boolean;
|
|
13
|
+
}
|
|
14
|
+
export default function SquareAvatarWithName({ avatarOnly, name, avatarFontSize, href, avatarFontCategory, avatarWidth, avatarHeight, fontSize, fontCategory, isBye }: {
|
|
15
|
+
avatarOnly?: boolean | undefined;
|
|
16
|
+
name?: string | undefined;
|
|
17
|
+
avatarFontSize?: string | undefined;
|
|
18
|
+
href?: string | undefined;
|
|
19
|
+
avatarFontCategory?: string | undefined;
|
|
20
|
+
avatarWidth?: string | undefined;
|
|
21
|
+
avatarHeight?: string | undefined;
|
|
22
|
+
fontSize?: string | undefined;
|
|
23
|
+
fontCategory?: string | undefined;
|
|
24
|
+
isBye?: boolean | undefined;
|
|
25
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Avatar from '@mui/material/Avatar';
|
|
3
|
+
import Box from '@mui/material/Box';
|
|
4
|
+
import Link from '@mui/material/Link';
|
|
5
|
+
import Typography from '../../atoms/Typography/Typography';
|
|
6
|
+
export default function SquareAvatarWithName({ avatarOnly = false, name = '', avatarFontSize = 'small-medium', href = '', avatarFontCategory = 'primary', avatarWidth = '26px', avatarHeight = '26px', fontSize = 'medium-book', fontCategory = 'secondary', isBye = false }) {
|
|
7
|
+
const getAcronym = (str) => {
|
|
8
|
+
const acronym = str === null || str === void 0 ? void 0 : str.split(' ').map((word) => word.charAt(0)).join('');
|
|
9
|
+
return acronym;
|
|
10
|
+
};
|
|
11
|
+
const SquareAvatarComponent = (React.createElement(Avatar, { sx: {
|
|
12
|
+
backgroundColor: isBye ? 'var(--grey)' : 'var(--black)',
|
|
13
|
+
marginRight: '8px',
|
|
14
|
+
width: `${avatarWidth}`,
|
|
15
|
+
height: `${avatarHeight}`
|
|
16
|
+
}, variant: "rounded" },
|
|
17
|
+
React.createElement(Typography, { sx: { textTransform: 'uppercase' }, size: avatarFontSize, category: avatarFontCategory }, isBye ? '—' : getAcronym(name))));
|
|
18
|
+
const NameTypography = (React.createElement(Typography, { category: fontCategory, size: fontSize, sx: { whiteSpace: 'noWrap', overflow: 'hidden', textOverflow: 'ellipsis' } }, name));
|
|
19
|
+
return (avatarOnly ? (SquareAvatarComponent) : (React.createElement(Box, { display: "flex", alignItems: "center" },
|
|
20
|
+
SquareAvatarComponent,
|
|
21
|
+
href ? (React.createElement(Link, { href: href, sx: { textDecoration: 'none' } }, NameTypography)) : NameTypography)));
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=SquareAvatarWithName.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SquareAvatarWithName.js","sourceRoot":"","sources":["../../../../src/stories/molecules/SquareAvatarWithName/SquareAvatarWithName.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,MAAM,MAAM,sBAAs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,UAAU,IACP,QAAQ,EAAE,YAAY,EACtB,IAAI,EAAE,QAAQ,EACd,EAAE,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,IAEzE,IAAI,CACI,CAChB,CAAC;IAEF,OAAO,CACL,UAAU,CAAC,CAAC,CAAC,CACX,qBAAqB,CACtB,CAAC,CAAC,CAAC,CACA,oBAAC,GAAG,IAAC,OAAO,EAAC,MAAM,EAAC,UAAU,EAAC,QAAQ;QAClC,qBAAqB;QACrB,IAAI,CAAC,CAAC,CAAC,CACJ,oBAAC,IAAI,IAAC,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE,IAC3C,cAAc,CACZ,CACV,CAAC,CAAC,CAAC,cAAc,CAChB,CACT,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
title: string;
|
|
3
|
+
};
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const Default: any;
|
|
6
|
+
export declare const WithCustomTypography: any;
|
|
7
|
+
export declare const WithCustomAvatarSize: any;
|
|
8
|
+
export declare const WithAvatarOnly: any;
|
|
9
|
+
export declare const WithLink: any;
|
|
10
|
+
export declare const WithLowercaseName: any;
|
|
11
|
+
export declare const WithLongName: any;
|
|
12
|
+
export declare const isBye: any;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Box from '@mui/material/Box';
|
|
3
|
+
import SquareAvatarWithName from './SquareAvatarWithName';
|
|
4
|
+
// Default
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Molecules/SquareAvatarWithName',
|
|
7
|
+
};
|
|
8
|
+
// Templates
|
|
9
|
+
function SquareAvatarWithNameTemplate(args) {
|
|
10
|
+
return React.createElement(SquareAvatarWithName, Object.assign({}, args));
|
|
11
|
+
}
|
|
12
|
+
function SquareAvatarWithLongNameTemplate(args) {
|
|
13
|
+
return React.createElement(Box, { width: "200px" },
|
|
14
|
+
React.createElement(SquareAvatarWithName, Object.assign({}, args)));
|
|
15
|
+
}
|
|
16
|
+
// Stories
|
|
17
|
+
export const Default = SquareAvatarWithNameTemplate.bind({});
|
|
18
|
+
Default.args = {
|
|
19
|
+
name: "Team Dream",
|
|
20
|
+
};
|
|
21
|
+
export const WithCustomTypography = SquareAvatarWithNameTemplate.bind({});
|
|
22
|
+
WithCustomTypography.args = {
|
|
23
|
+
name: "Team Dream",
|
|
24
|
+
avatarFontCategory: "secondary",
|
|
25
|
+
avatarFontSize: "small-book",
|
|
26
|
+
fontCategory: "primary",
|
|
27
|
+
fontSize: "medium-book"
|
|
28
|
+
};
|
|
29
|
+
export const WithCustomAvatarSize = SquareAvatarWithNameTemplate.bind({});
|
|
30
|
+
WithCustomAvatarSize.args = {
|
|
31
|
+
name: "Team Dream",
|
|
32
|
+
avatarWidth: '40px',
|
|
33
|
+
avatarHeight: '40px',
|
|
34
|
+
avatarFontCategory: "primary",
|
|
35
|
+
avatarFontSize: "small-book",
|
|
36
|
+
};
|
|
37
|
+
export const WithAvatarOnly = SquareAvatarWithNameTemplate.bind({});
|
|
38
|
+
WithAvatarOnly.args = {
|
|
39
|
+
avatarOnly: true,
|
|
40
|
+
name: "Team Dream",
|
|
41
|
+
};
|
|
42
|
+
export const WithLink = SquareAvatarWithNameTemplate.bind({});
|
|
43
|
+
WithLink.args = {
|
|
44
|
+
href: "https://www.reddit.com",
|
|
45
|
+
name: "Team Dream",
|
|
46
|
+
};
|
|
47
|
+
export const WithLowercaseName = SquareAvatarWithNameTemplate.bind({});
|
|
48
|
+
WithLowercaseName.args = {
|
|
49
|
+
name: "team dream",
|
|
50
|
+
};
|
|
51
|
+
export const WithLongName = SquareAvatarWithLongNameTemplate.bind({});
|
|
52
|
+
WithLongName.args = {
|
|
53
|
+
name: "Team Dreamadeamadeamadeamadeam",
|
|
54
|
+
};
|
|
55
|
+
export const isBye = SquareAvatarWithNameTemplate.bind({});
|
|
56
|
+
isBye.args = {
|
|
57
|
+
name: "Bye",
|
|
58
|
+
isBye: true,
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=SquareAvatarWithName.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SquareAvatarWithName.stories.js","sourceRoot":"","sources":["../../../../src/stories/molecules/SquareAvatarWithName/SquareAvatarWithName.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,GAAG,MAAM,mBAAmB,CAAC;AACpC,OAAO,oBAAmD,MAAM,wBAAwB,CAAC;AAEzF,UAAU;AACV,eAAe;IACb,KAAK,EAAE,gCAAgC;CACxC,CAAC;AAEF,YAAY;AACZ,SAAS,4BAA4B,CAAC,IAA+B;IACnE,OAAO,oBAAC,oBAAoB,oBAAK,IAAI,EAAI,CAAC;AAC5C,CAAC;AAED,SAAS,gCAAgC,CAAC,IAA+B;IACvE,OAAO,oBAAC,GAAG,IAAC,KAAK,EAAC,OAAO;QAAC,oBAAC,oBAAoB,oBAAK,IAAI,EAAI,CAAM,CAAC;AACrE,CAAC;AAED,UAAU;AACV,MAAM,CAAC,MAAM,OAAO,GAAG,4BAA4B,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC7D,OAAO,CAAC,IAAI,GAAG;IACb,IAAI,EAAE,YAAY;CACnB,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,4BAA4B,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC1E,oBAAoB,CAAC,IAAI,GAAG;IAC1B,IAAI,EAAE,YAAY;IAClB,kBAAkB,EAAE,WAAW;IAC/B,cAAc,EAAE,YAAY;IAC5B,YAAY,EAAE,SAAS;IACvB,QAAQ,EAAE,aAAa;CACxB,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,4BAA4B,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC1E,oBAAoB,CAAC,IAAI,GAAG;IAC1B,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,MAAM;IACnB,YAAY,EAAE,MAAM;IACpB,kBAAkB,EAAE,SAAS;IAC7B,cAAc,EAAE,YAAY;CAC7B,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,4BAA4B,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACpE,cAAc,CAAC,IAAI,GAAG;IACpB,UAAU,EAAE,IAAI;IAChB,IAAI,EAAE,YAAY;CACnB,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,4BAA4B,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC9D,QAAQ,CAAC,IAAI,GAAG;IACd,IAAI,EAAE,wBAAwB;IAC9B,IAAI,EAAE,YAAY;CACnB,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,4BAA4B,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACvE,iBAAiB,CAAC,IAAI,GAAG;IACvB,IAAI,EAAE,YAAY;CACnB,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,gCAAgC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACtE,YAAY,CAAC,IAAI,GAAG;IAClB,IAAI,EAAE,gCAAgC;CACvC,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAG,4BAA4B,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC3D,KAAK,CAAC,IAAI,GAAG;IACX,IAAI,EAAE,KAAK;IACX,KAAK,EAAE,IAAI;CACZ,CAAC"}
|
package/package.json
CHANGED
package/src/components.jsx
CHANGED
|
@@ -18,6 +18,7 @@ export { default as Map } from './stories/atoms/Map/Map';
|
|
|
18
18
|
|
|
19
19
|
// MOLECULES
|
|
20
20
|
export { default as AvatarWithName } from './stories/molecules/AvatarWithName/AvatarWithName';
|
|
21
|
+
export { default as SquareAvatarWithName } from './stories/molecules/SquareAvatarWithName/SquareAvatarWithName';
|
|
21
22
|
export { default as ContactCard } from './stories/molecules/Cards/ContactCard';
|
|
22
23
|
export { default as DrawCard } from './stories/molecules/Cards/DrawCard';
|
|
23
24
|
export { default as TeamCard } from './stories/molecules/Cards/TeamCard';
|
|
@@ -4,7 +4,7 @@ import { IconProps } from './sharedTypes';
|
|
|
4
4
|
|
|
5
5
|
export default function CalendarIcon({ size, color }: IconProps) {
|
|
6
6
|
return (
|
|
7
|
-
<svg width={size} height={size} viewBox="0 0
|
|
7
|
+
<svg width={size} height={size} viewBox="0 0 14 14" fill={color} xmlns="http://www.w3.org/2000/svg">
|
|
8
8
|
<path fillRule="evenodd" clipRule="evenodd" d="M4.5 0.5C4.77614 0.5 5 0.723858 5 1V2H9V1C9 0.723858 9.22386 0.5 9.5 0.5C9.77614 0.5 10 0.723858 10 1V2H11C12.1046 2 13 2.89543 13 4V11C13 12.1046 12.1046 13 11 13H3C1.89543 13 1 12.1046 1 11V4C1 2.89543 1.89543 2 3 2H4V1C4 0.723858 4.22386 0.5 4.5 0.5ZM9 3V4C9 4.27614 9.22386 4.5 9.5 4.5C9.77614 4.5 10 4.27614 10 4V3H11C11.5523 3 12 3.44772 12 4V6.08325H2V4C2 3.44772 2.44772 3 3 3H4V4C4 4.27614 4.22386 4.5 4.5 4.5C4.77614 4.5 5 4.27614 5 4V3H9ZM2 7.08325V11C2 11.5523 2.44772 12 3 12H11C11.5523 12 12 11.5523 12 11V7.08325H2Z" />
|
|
9
9
|
</svg>
|
|
10
10
|
);
|
|
@@ -4,7 +4,7 @@ import { IconProps } from './sharedTypes';
|
|
|
4
4
|
|
|
5
5
|
export default function LocationIcon({ size, color }: IconProps) {
|
|
6
6
|
return (
|
|
7
|
-
<svg width={size} height={size} viewBox="0 0
|
|
7
|
+
<svg width={size} height={size} viewBox="0 0 14 14" fill={color} xmlns="http://www.w3.org/2000/svg">
|
|
8
8
|
<path fillRule="evenodd" clipRule="evenodd" d="M7 8C8.10457 8 9 7.10457 9 6C9 4.89543 8.10457 4 7 4C5.89543 4 5 4.89543 5 6C5 7.10457 5.89543 8 7 8ZM7 9C8.65685 9 10 7.65685 10 6C10 4.34315 8.65685 3 7 3C5.34315 3 4 4.34315 4 6C4 7.65685 5.34315 9 7 9Z" />
|
|
9
9
|
<path fillRule="evenodd" clipRule="evenodd" d="M9.30809 10.9655C10.7626 9.57161 12 7.8219 12 6C12 3.23858 9.76142 1 7 1C4.23858 1 2 3.23858 2 6C2 7.8219 3.2374 9.57161 4.69191 10.9655C5.39697 11.6412 6.10609 12.1882 6.64052 12.5668C6.7725 12.6603 6.89326 12.7431 7 12.8146C7.10674 12.7431 7.2275 12.6603 7.35948 12.5668C7.89391 12.1882 8.60303 11.6412 9.30809 10.9655ZM7 14C7 14 13 10.5 13 6C13 2.68629 10.3137 0 7 0C3.68629 0 1 2.68629 1 6C1 10.5 7 14 7 14Z" />
|
|
10
10
|
</svg>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import Box from '@mui/material/Box';
|
|
4
|
+
import SquareAvatarWithName, { SquareAvatarWithNameProps } from './SquareAvatarWithName';
|
|
5
|
+
|
|
6
|
+
// Default
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Molecules/SquareAvatarWithName',
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
// Templates
|
|
12
|
+
function SquareAvatarWithNameTemplate(args: SquareAvatarWithNameProps) {
|
|
13
|
+
return <SquareAvatarWithName {...args} />;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function SquareAvatarWithLongNameTemplate(args: SquareAvatarWithNameProps) {
|
|
17
|
+
return <Box width="200px"><SquareAvatarWithName {...args} /></Box>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Stories
|
|
21
|
+
export const Default = SquareAvatarWithNameTemplate.bind({});
|
|
22
|
+
Default.args = {
|
|
23
|
+
name: "Team Dream",
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const WithCustomTypography = SquareAvatarWithNameTemplate.bind({});
|
|
27
|
+
WithCustomTypography.args = {
|
|
28
|
+
name: "Team Dream",
|
|
29
|
+
avatarFontCategory: "secondary",
|
|
30
|
+
avatarFontSize: "small-book",
|
|
31
|
+
fontCategory: "primary",
|
|
32
|
+
fontSize: "medium-book"
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const WithCustomAvatarSize = SquareAvatarWithNameTemplate.bind({});
|
|
36
|
+
WithCustomAvatarSize.args = {
|
|
37
|
+
name: "Team Dream",
|
|
38
|
+
avatarWidth: '40px',
|
|
39
|
+
avatarHeight: '40px',
|
|
40
|
+
avatarFontCategory: "primary",
|
|
41
|
+
avatarFontSize: "small-book",
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const WithAvatarOnly = SquareAvatarWithNameTemplate.bind({});
|
|
45
|
+
WithAvatarOnly.args = {
|
|
46
|
+
avatarOnly: true,
|
|
47
|
+
name: "Team Dream",
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const WithLink = SquareAvatarWithNameTemplate.bind({});
|
|
51
|
+
WithLink.args = {
|
|
52
|
+
href: "https://www.reddit.com",
|
|
53
|
+
name: "Team Dream",
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const WithLowercaseName = SquareAvatarWithNameTemplate.bind({});
|
|
57
|
+
WithLowercaseName.args = {
|
|
58
|
+
name: "team dream",
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const WithLongName = SquareAvatarWithLongNameTemplate.bind({});
|
|
62
|
+
WithLongName.args = {
|
|
63
|
+
name: "Team Dreamadeamadeamadeamadeam",
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const isBye = SquareAvatarWithNameTemplate.bind({});
|
|
67
|
+
isBye.args = {
|
|
68
|
+
name: "Bye",
|
|
69
|
+
isBye: true,
|
|
70
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import Avatar from '@mui/material/Avatar';
|
|
4
|
+
import Box from '@mui/material/Box';
|
|
5
|
+
import Link from '@mui/material/Link';
|
|
6
|
+
|
|
7
|
+
import Typography from '../../atoms/Typography/Typography';
|
|
8
|
+
|
|
9
|
+
export interface SquareAvatarWithNameProps {
|
|
10
|
+
avatarOnly: boolean;
|
|
11
|
+
avatarFontCategory: string;
|
|
12
|
+
avatarFontSize: string;
|
|
13
|
+
avatarWidth: string;
|
|
14
|
+
avatarHeight: string;
|
|
15
|
+
href: string,
|
|
16
|
+
name: string;
|
|
17
|
+
fontCategory: string;
|
|
18
|
+
fontSize: string;
|
|
19
|
+
isBye: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default function SquareAvatarWithName({
|
|
23
|
+
avatarOnly = false, name = '', avatarFontSize = 'small-medium', href = '',
|
|
24
|
+
avatarFontCategory = 'primary', avatarWidth = '26px', avatarHeight = '26px',
|
|
25
|
+
fontSize = 'medium-book', fontCategory = 'secondary', isBye = false
|
|
26
|
+
}) {
|
|
27
|
+
const getAcronym = (str: string) => {
|
|
28
|
+
const acronym = str?.split(' ').map((word) => word.charAt(0)).join('');
|
|
29
|
+
return acronym;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const SquareAvatarComponent = (
|
|
33
|
+
<Avatar
|
|
34
|
+
sx={{
|
|
35
|
+
backgroundColor: isBye ? 'var(--grey)' : 'var(--black)',
|
|
36
|
+
marginRight: '8px',
|
|
37
|
+
width: `${avatarWidth}`,
|
|
38
|
+
height: `${avatarHeight}`
|
|
39
|
+
}}
|
|
40
|
+
variant="rounded"
|
|
41
|
+
>
|
|
42
|
+
<Typography
|
|
43
|
+
sx={{ textTransform: 'uppercase' }}
|
|
44
|
+
size={avatarFontSize}
|
|
45
|
+
category={avatarFontCategory}
|
|
46
|
+
>
|
|
47
|
+
{isBye ? '—' : getAcronym(name)}
|
|
48
|
+
</Typography>
|
|
49
|
+
</Avatar>
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
const NameTypography = (
|
|
53
|
+
<Typography
|
|
54
|
+
category={fontCategory}
|
|
55
|
+
size={fontSize}
|
|
56
|
+
sx={{ whiteSpace: 'noWrap', overflow: 'hidden', textOverflow: 'ellipsis' }}
|
|
57
|
+
>
|
|
58
|
+
{name}
|
|
59
|
+
</Typography>
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
avatarOnly ? (
|
|
64
|
+
SquareAvatarComponent
|
|
65
|
+
) : (
|
|
66
|
+
<Box display="flex" alignItems="center">
|
|
67
|
+
{SquareAvatarComponent}
|
|
68
|
+
{href ? (
|
|
69
|
+
<Link href={href} sx={{ textDecoration: 'none' }}>
|
|
70
|
+
{NameTypography}
|
|
71
|
+
</Link>
|
|
72
|
+
) : NameTypography}
|
|
73
|
+
</Box>
|
|
74
|
+
)
|
|
75
|
+
);
|
|
76
|
+
}
|