@toptal/picasso-avatar 2.0.7-alpha-fx-null-fix-button-e862ee8b7.0 → 3.0.0

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.
Files changed (80) hide show
  1. package/dist-package/src/Avatar/Avatar.d.ts.map +1 -1
  2. package/dist-package/src/Avatar/Avatar.js +2 -7
  3. package/dist-package/src/Avatar/Avatar.js.map +1 -1
  4. package/dist-package/src/Avatar/AvatarEditContainer/AvatarEditContainer.d.ts +2 -1
  5. package/dist-package/src/Avatar/AvatarEditContainer/AvatarEditContainer.d.ts.map +1 -1
  6. package/dist-package/src/Avatar/AvatarEditContainer/AvatarEditContainer.js +7 -14
  7. package/dist-package/src/Avatar/AvatarEditContainer/AvatarEditContainer.js.map +1 -1
  8. package/dist-package/src/Avatar/AvatarEditContainer/styles.d.ts +3 -3
  9. package/dist-package/src/Avatar/AvatarEditContainer/styles.d.ts.map +1 -1
  10. package/dist-package/src/Avatar/AvatarEditContainer/styles.js +13 -78
  11. package/dist-package/src/Avatar/AvatarEditContainer/styles.js.map +1 -1
  12. package/dist-package/src/Avatar/AvatarWrapper/AvatarWrapper.d.ts +4 -2
  13. package/dist-package/src/Avatar/AvatarWrapper/AvatarWrapper.d.ts.map +1 -1
  14. package/dist-package/src/Avatar/AvatarWrapper/AvatarWrapper.js +3 -10
  15. package/dist-package/src/Avatar/AvatarWrapper/AvatarWrapper.js.map +1 -1
  16. package/dist-package/src/Avatar/AvatarWrapper/styles.d.ts +3 -6
  17. package/dist-package/src/Avatar/AvatarWrapper/styles.d.ts.map +1 -1
  18. package/dist-package/src/Avatar/AvatarWrapper/styles.js +22 -50
  19. package/dist-package/src/Avatar/AvatarWrapper/styles.js.map +1 -1
  20. package/dist-package/src/Avatar/IconAvatar/IconAvatar.d.ts +1 -0
  21. package/dist-package/src/Avatar/IconAvatar/IconAvatar.d.ts.map +1 -1
  22. package/dist-package/src/Avatar/IconAvatar/IconAvatar.js +3 -8
  23. package/dist-package/src/Avatar/IconAvatar/IconAvatar.js.map +1 -1
  24. package/dist-package/src/Avatar/IconAvatar/styles.d.ts +2 -2
  25. package/dist-package/src/Avatar/IconAvatar/styles.d.ts.map +1 -1
  26. package/dist-package/src/Avatar/IconAvatar/styles.js +7 -14
  27. package/dist-package/src/Avatar/IconAvatar/styles.js.map +1 -1
  28. package/dist-package/src/Avatar/ImageAvatar/ImageAvatar.d.ts +2 -1
  29. package/dist-package/src/Avatar/ImageAvatar/ImageAvatar.d.ts.map +1 -1
  30. package/dist-package/src/Avatar/ImageAvatar/ImageAvatar.js +6 -12
  31. package/dist-package/src/Avatar/ImageAvatar/ImageAvatar.js.map +1 -1
  32. package/dist-package/src/Avatar/TextAvatar/TextAvatar.d.ts +4 -2
  33. package/dist-package/src/Avatar/TextAvatar/TextAvatar.d.ts.map +1 -1
  34. package/dist-package/src/Avatar/TextAvatar/TextAvatar.js +4 -19
  35. package/dist-package/src/Avatar/TextAvatar/TextAvatar.js.map +1 -1
  36. package/dist-package/src/Avatar/TextAvatar/styles.d.ts +3 -2
  37. package/dist-package/src/Avatar/TextAvatar/styles.d.ts.map +1 -1
  38. package/dist-package/src/Avatar/TextAvatar/styles.js +11 -21
  39. package/dist-package/src/Avatar/TextAvatar/styles.js.map +1 -1
  40. package/dist-package/src/AvatarDropzoneSvg/AvatarDropzoneSvg.d.ts +1 -0
  41. package/dist-package/src/AvatarDropzoneSvg/AvatarDropzoneSvg.d.ts.map +1 -1
  42. package/dist-package/src/AvatarDropzoneSvg/AvatarDropzoneSvg.js +7 -25
  43. package/dist-package/src/AvatarDropzoneSvg/AvatarDropzoneSvg.js.map +1 -1
  44. package/dist-package/src/AvatarDropzoneSvg/styles.d.ts +5 -3
  45. package/dist-package/src/AvatarDropzoneSvg/styles.d.ts.map +1 -1
  46. package/dist-package/src/AvatarDropzoneSvg/styles.js +34 -99
  47. package/dist-package/src/AvatarDropzoneSvg/styles.js.map +1 -1
  48. package/dist-package/src/AvatarGroup/AvatarGroup.d.ts.map +1 -1
  49. package/dist-package/src/AvatarGroup/AvatarGroup.js +2 -8
  50. package/dist-package/src/AvatarGroup/AvatarGroup.js.map +1 -1
  51. package/package.json +13 -14
  52. package/src/Avatar/Avatar.tsx +3 -10
  53. package/src/Avatar/AvatarEditContainer/AvatarEditContainer.tsx +17 -18
  54. package/src/Avatar/AvatarEditContainer/styles.ts +15 -86
  55. package/src/Avatar/AvatarWrapper/AvatarWrapper.tsx +13 -19
  56. package/src/Avatar/AvatarWrapper/styles.ts +28 -80
  57. package/src/Avatar/IconAvatar/IconAvatar.tsx +9 -11
  58. package/src/Avatar/IconAvatar/styles.ts +8 -15
  59. package/src/Avatar/ImageAvatar/ImageAvatar.tsx +14 -18
  60. package/src/Avatar/TextAvatar/TextAvatar.tsx +29 -35
  61. package/src/Avatar/TextAvatar/styles.ts +12 -23
  62. package/src/AvatarDropzoneSvg/AvatarDropzoneSvg.tsx +28 -28
  63. package/src/AvatarDropzoneSvg/styles.ts +40 -104
  64. package/src/AvatarGroup/AvatarGroup.tsx +2 -11
  65. package/LICENSE +0 -20
  66. package/dist-package/src/Avatar/ImageAvatar/styles.d.ts +0 -3
  67. package/dist-package/src/Avatar/ImageAvatar/styles.d.ts.map +0 -1
  68. package/dist-package/src/Avatar/ImageAvatar/styles.js +0 -25
  69. package/dist-package/src/Avatar/ImageAvatar/styles.js.map +0 -1
  70. package/dist-package/src/Avatar/styles.d.ts +0 -3
  71. package/dist-package/src/Avatar/styles.d.ts.map +0 -1
  72. package/dist-package/src/Avatar/styles.js +0 -9
  73. package/dist-package/src/Avatar/styles.js.map +0 -1
  74. package/dist-package/src/AvatarGroup/styles.d.ts +0 -3
  75. package/dist-package/src/AvatarGroup/styles.d.ts.map +0 -1
  76. package/dist-package/src/AvatarGroup/styles.js +0 -8
  77. package/dist-package/src/AvatarGroup/styles.js.map +0 -1
  78. package/src/Avatar/ImageAvatar/styles.ts +0 -26
  79. package/src/Avatar/styles.ts +0 -9
  80. package/src/AvatarGroup/styles.ts +0 -9
@@ -1,88 +1,17 @@
1
- import type { Theme } from '@material-ui/core/styles'
2
- import { createStyles } from '@material-ui/core/styles'
3
- import { alpha } from '@toptal/picasso-shared'
4
-
5
- export default ({ palette, zIndex }: Theme) => {
6
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
7
- const hoverColor = alpha(palette.grey.darker!, 0.7)
8
-
9
- return createStyles({
10
- root: {
11
- border: 'none',
12
- cursor: 'pointer',
13
- position: 'absolute',
14
- left: 0,
15
- top: 0,
16
- display: 'flex',
17
- justifyContent: 'center',
18
- alignItems: 'center',
19
- outline: 'none',
20
- background: 'transparent',
21
- },
22
- rootXxsmall: {
23
- width: '32px',
24
- height: '32px',
25
- },
26
- rootXsmall: {
27
- width: '40px',
28
- height: '40px',
29
- },
30
- rootSmall: {
31
- width: '80px',
32
- height: '80px',
33
- },
34
- rootMedium: {
35
- width: '120px',
36
- height: '120px',
37
- },
38
- rootLarge: {
39
- width: '160px',
40
- height: '160px',
41
- },
42
-
43
- svg: {
44
- margin: '-3px', // to center the svg
45
- position: 'absolute',
46
- },
47
- svgXxsmall: {
48
- width: '38px', // +6px for outline
49
- height: '38px', // +6px for outline
50
- },
51
- svgXsmall: {
52
- width: '46px', // +6px for outline
53
- height: '46px', // +6px for outline
54
- },
55
- svgSmall: {
56
- width: '86px', // +6px for outline
57
- height: '86px', // +6px for outline
58
- },
59
- svgMedium: {
60
- width: '126px', // +6px for outline
61
- height: '126px', // +6px for outline
62
- },
63
- svgLarge: {
64
- width: '166px', // +6px for outline
65
- height: '166px', // +6px for outline
66
- },
67
-
68
- background: {
69
- fill: hoverColor,
70
- },
71
-
72
- outline: {
73
- display: 'none',
74
- stroke: palette.blue.main,
75
-
76
- '&$focused': {
77
- display: 'initial',
78
- },
79
- },
80
-
81
- pencilIcon: {
82
- color: palette.common.white,
83
- zIndex: zIndex.tooltip,
84
- },
1
+ import type { Size } from './AvatarEditContainer'
2
+
3
+ export const rootClassBySize: Record<Size, string> = {
4
+ xxsmall: 'w-[32px] h-[32px]',
5
+ xsmall: 'w-[40px] h-[40px]',
6
+ small: 'w-[80px] h-[80px]',
7
+ medium: 'w-[120px] h-[120px]',
8
+ large: 'w-[160px] h-[160px]',
9
+ }
85
10
 
86
- focused: {},
87
- })
11
+ export const svgClassBySize: Record<Size, string> = {
12
+ xxsmall: 'w-[38px] h-[38px]',
13
+ xsmall: 'w-[46px] h-[46px]',
14
+ small: 'w-[86px] h-[86px]',
15
+ medium: 'w-[126px] h-[126px]',
16
+ large: 'w-[166px] h-[166px]',
88
17
  }
@@ -1,22 +1,20 @@
1
1
  import type { ReactNode } from 'react'
2
2
  import React from 'react'
3
- import type { Theme } from '@material-ui/core/styles'
4
- import { makeStyles } from '@material-ui/core/styles'
5
3
  import type { BaseProps, SizeType } from '@toptal/picasso-shared'
6
- import cx from 'classnames'
4
+ import { twMerge } from '@toptal/picasso-tailwind-merge'
7
5
 
8
- import styles, { getCornerClassName, getSizeClassName } from './styles'
6
+ import { classBySizeAndVariant, clipClassBySize } from './styles'
7
+
8
+ export type Size = SizeType<'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large'>
9
+
10
+ export type Variant = 'square' | 'portrait' | 'landscape'
9
11
 
10
12
  export interface Props extends BaseProps {
11
13
  children: ReactNode
12
- size: SizeType<'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large'>
13
- variant: 'square' | 'portrait' | 'landscape'
14
+ size: Size
15
+ variant: Variant
14
16
  }
15
17
 
16
- const useStyles = makeStyles<Theme>(styles, {
17
- name: 'PicassoAvatarWrapper',
18
- })
19
-
20
18
  const AvatarWrapper = (props: Props) => {
21
19
  const {
22
20
  children,
@@ -26,20 +24,16 @@ const AvatarWrapper = (props: Props) => {
26
24
  size,
27
25
  variant,
28
26
  } = props
29
- const classes = useStyles()
30
-
31
- const sizeClassName = getSizeClassName(size, variant)
32
- const cornerClassName = getCornerClassName(size)
33
27
 
34
28
  return (
35
29
  <div
36
30
  style={style}
37
31
  data-testid={dataTestId}
38
- className={cx(
39
- className,
40
- classes.root,
41
- classes[sizeClassName],
42
- classes[cornerClassName]
32
+ className={twMerge(
33
+ 'relative bg-gray-500 text-[1rem] shrink-0 grow-0',
34
+ classBySizeAndVariant[size][variant],
35
+ clipClassBySize[size],
36
+ className
43
37
  )}
44
38
  >
45
39
  {children}
@@ -1,94 +1,42 @@
1
- import type { SizeType } from '@toptal/picasso-shared'
2
- import type { Theme } from '@material-ui/core/styles'
3
- import { createStyles } from '@material-ui/core/styles'
4
- import capitalize from '@material-ui/core/utils/capitalize'
5
- import type { CSSProperties } from '@material-ui/core/styles/withStyles'
1
+ import type { Size, Variant } from './AvatarWrapper'
6
2
 
7
- const SETTINGS = {
3
+ export const classBySizeAndVariant: Record<Size, Record<Variant, string>> = {
8
4
  xxsmall: {
9
- dimensions: 2,
10
- cornerSize: '0.5em',
5
+ square: 'w-[2em] h-[2em]',
6
+ portrait: 'w-[1.333333333em] h-[2em]',
7
+ landscape: 'w-[2em] h-[1.333333333em]',
11
8
  },
12
9
  xsmall: {
13
- dimensions: 2.5,
14
- cornerSize: '0.5em',
10
+ square: 'w-[2.5em] h-[2.5em]',
11
+ portrait: 'w-[1.666666666em] h-[2.5em]',
12
+ landscape: 'w-[2.5em] h-[1.666666666em]',
15
13
  },
16
14
  small: {
17
- dimensions: 5,
18
- cornerSize: '1em',
15
+ square: 'w-[5em] h-[5em]',
16
+ portrait: 'w-[3.333333333em] h-[5em]',
17
+ landscape: 'w-[5em] h-[3.333333333em]',
19
18
  },
20
19
  medium: {
21
- dimensions: 7.5,
22
- cornerSize: '1.5em',
20
+ square: 'w-[7.5em] h-[7.5em]',
21
+ portrait: 'w-[5em] h-[7.5em]',
22
+ landscape: 'w-[7.5em] h-[5em]',
23
23
  },
24
24
  large: {
25
- dimensions: 10,
26
- cornerSize: '1.5em',
25
+ square: 'w-[10em] h-[10em]',
26
+ portrait: 'w-[7.5em] h-[10em]',
27
+ landscape: 'w-[10em] h-[7.5em]',
27
28
  },
28
- } as const
29
-
30
- const VARIANTS = ['square', 'portrait', 'landscape']
31
-
32
- const sizeClassNames = Object.entries(SETTINGS).reduce(
33
- (classNames, [size, { dimensions }]) => {
34
- VARIANTS.forEach(variant => {
35
- const className = `size${capitalize(size)}${capitalize(variant)}`
36
-
37
- const ratio = size === 'large' ? 3 / 4 : 2 / 3
38
- const widthRatio = variant === 'portrait' ? ratio : 1
39
- const heightRatio = variant === 'landscape' ? ratio : 1
40
-
41
- classNames[className] = {
42
- width: `${dimensions * widthRatio}em`,
43
- height: `${dimensions * heightRatio}em`,
44
- }
45
- })
46
-
47
- return classNames
48
- },
49
- {} as Record<string, CSSProperties>
50
- )
51
-
52
- const cornerClassNames = Object.entries(SETTINGS).reduce(
53
- (classNames, [size, { cornerSize }]) => {
54
- const className = `corner${capitalize(size)}`
55
- const clipPath = `polygon(0 0, 100% 0, 100% 100%, ${cornerSize} 100%, 0 calc(100% - ${cornerSize}))`
56
-
57
- classNames[className] = {
58
- clipPath,
59
- // we can remove this prefix as soon as this issue will
60
- // be resolved - https://github.com/cssinjs/css-vendor/issues/74
61
- '-webkit-clip-path': clipPath,
62
- }
63
-
64
- return classNames
65
- },
66
- {} as Record<string, CSSProperties>
67
- )
68
-
69
- export default ({ palette }: Theme) =>
70
- createStyles({
71
- root: {
72
- position: 'relative',
73
- backgroundColor: palette.grey.main,
74
- fontSize: '1rem',
75
- flexShrink: 0,
76
- flexGrow: 0,
77
- },
78
-
79
- ...sizeClassNames,
80
- ...cornerClassNames,
81
- })
82
-
83
- export const getSizeClassName = (
84
- size: SizeType<'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large'>,
85
- variant: 'square' | 'portrait' | 'landscape'
86
- ) => {
87
- return `size${capitalize(size)}${capitalize(variant)}`
88
29
  }
89
30
 
90
- export const getCornerClassName = (
91
- size: SizeType<'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large'>
92
- ) => {
93
- return `corner${capitalize(size)}`
31
+ export const clipClassBySize: Record<Size, string> = {
32
+ xxsmall:
33
+ '[clip-path:polygon(0_0,_100%_0,_100%_100%,_0.5em_100%,_0_calc(100%-0.5em))]',
34
+ xsmall:
35
+ '[clip-path:polygon(0_0,_100%_0,_100%_100%,_0.5em_100%,_0_calc(100%-0.5em))]',
36
+ small:
37
+ '[clip-path:polygon(0_0,_100%_0,_100%_100%,_1em_100%,_0_calc(100%-1em))]',
38
+ medium:
39
+ '[clip-path:polygon(0_0,_100%_0,_100%_100%,_1.5em_100%,_0_calc(100%-1.5em))]',
40
+ large:
41
+ '[clip-path:polygon(0_0,_100%_0,_100%_100%,_1.5em_100%,_0_calc(100%-1.5em))]',
94
42
  }
@@ -1,31 +1,29 @@
1
1
  import React from 'react'
2
- import cx from 'classnames'
3
- import type { Theme } from '@material-ui/core/styles'
4
- import { makeStyles } from '@material-ui/core/styles'
5
2
  import type { BaseProps, SizeType } from '@toptal/picasso-shared'
6
3
  import { Profile16 } from '@toptal/picasso-icons'
4
+ import { twMerge } from '@toptal/picasso-tailwind-merge'
7
5
 
8
- import styles from './styles'
6
+ import { classBySize } from './styles'
7
+
8
+ export type Size = SizeType<'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large'>
9
9
 
10
10
  interface Props extends BaseProps {
11
11
  size: SizeType<'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large'>
12
12
  }
13
13
 
14
- const useStyles = makeStyles<Theme>(styles, {
15
- name: 'PicassoIconAvatar',
16
- })
17
-
18
14
  const IconAvatar = ({
19
15
  size,
20
16
  'data-testid': dataTestId,
21
17
  className,
22
18
  style,
23
19
  }: Props) => {
24
- const classes = useStyles()
25
-
26
20
  return (
27
21
  <Profile16
28
- className={cx(className, classes.root, classes[`${size}Icon`])}
22
+ className={twMerge(
23
+ className,
24
+ 'absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2',
25
+ classBySize[size]
26
+ )}
29
27
  color='white'
30
28
  data-testid={dataTestId}
31
29
  style={style}
@@ -1,16 +1,9 @@
1
- import { createStyles } from '@material-ui/core/styles'
1
+ import type { Size } from './IconAvatar'
2
2
 
3
- export default () =>
4
- createStyles({
5
- root: {
6
- position: 'absolute',
7
- top: '50%',
8
- left: '50%',
9
- transform: 'translate(-50%, -50%)',
10
- },
11
- xxsmallIcon: { fontSize: '1em' },
12
- xsmallIcon: { fontSize: '1em' },
13
- smallIcon: { fontSize: '1.5em' },
14
- mediumIcon: { fontSize: '1.875em' },
15
- largeIcon: { fontSize: '3em' },
16
- })
3
+ export const classBySize: Record<Size, string> = {
4
+ xxsmall: 'text-[1em]',
5
+ xsmall: 'text-[1em]',
6
+ small: 'text-[1.5em]',
7
+ medium: 'text-[1.875em]',
8
+ large: 'text-[3em]',
9
+ }
@@ -1,29 +1,23 @@
1
1
  import React from 'react'
2
- import cx from 'classnames'
3
- import type { JssProps, BaseProps, SizeType } from '@toptal/picasso-shared'
4
- import type { Theme } from '@material-ui/core/styles'
5
- import { makeStyles } from '@material-ui/core/styles'
2
+ import type { BaseProps, SizeType } from '@toptal/picasso-shared'
6
3
  import { Logo } from '@toptal/picasso-logo'
7
4
  import { Image } from '@toptal/picasso-image'
5
+ import { twMerge } from '@toptal/picasso-tailwind-merge'
8
6
 
9
- import styles from './styles'
7
+ export type Size = SizeType<'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large'>
10
8
 
11
9
  export interface Props extends BaseProps {
12
- size: SizeType<'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large'>
10
+ size: Size
13
11
  src: string
14
12
  alt?: string
15
13
  name?: string
16
14
  }
17
15
 
18
16
  type LogoProps = {
19
- size: SizeType<'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large'>
20
- } & JssProps
21
-
22
- const useStyles = makeStyles<Theme, Props>(styles, {
23
- name: 'PicassoImageAvatar',
24
- })
17
+ size: Size
18
+ }
25
19
 
26
- const AvatarLogo = ({ size, classes }: LogoProps) => {
20
+ const AvatarLogo = ({ size }: LogoProps) => {
27
21
  const isTooSmall = ['small', 'xsmall', 'xxsmall'].includes(size)
28
22
 
29
23
  if (isTooSmall) {
@@ -32,11 +26,11 @@ const AvatarLogo = ({ size, classes }: LogoProps) => {
32
26
 
33
27
  return (
34
28
  <div
35
- className={classes.logoContainer}
29
+ className='flex absolute bottom-4 left-4'
36
30
  role='img'
37
31
  aria-label='photo placeholder'
38
32
  >
39
- <Logo emblem variant='white' className={classes.logo} />
33
+ <Logo emblem variant='white' className='w-[1.0625rem] h-6' />
40
34
  </div>
41
35
  )
42
36
  }
@@ -52,19 +46,21 @@ const ImageAvatar = (props: Props) => {
52
46
  'data-testid': dataTestId,
53
47
  'data-private': dataPrivate,
54
48
  } = props
55
- const classes = useStyles(props)
56
49
 
57
50
  return (
58
51
  <>
59
52
  <Image
60
53
  alt={alt || name || ''}
61
- className={cx(classes.image, className)}
54
+ className={twMerge(
55
+ 'object-cover w-full h-full absolute left-0 top-0 [image-rendering:-webkit-optimize-contrast]',
56
+ className
57
+ )}
62
58
  src={src}
63
59
  style={style}
64
60
  data-testid={dataTestId}
65
61
  data-private={dataPrivate}
66
62
  />
67
- <AvatarLogo classes={classes} size={size} />
63
+ <AvatarLogo size={size} />
68
64
  </>
69
65
  )
70
66
  }
@@ -1,23 +1,21 @@
1
1
  import type { ReactNode } from 'react'
2
2
  import React from 'react'
3
- import cx from 'classnames'
4
- import type { Theme } from '@material-ui/core/styles'
5
- import { makeStyles } from '@material-ui/core/styles'
6
3
  import type { BaseProps, SizeType } from '@toptal/picasso-shared'
7
4
  import { Typography } from '@toptal/picasso-typography'
5
+ import { twJoin, twMerge } from '@toptal/picasso-tailwind-merge'
8
6
 
9
- import styles from './styles'
7
+ import { containerTextClassBySize, typographyTextClassBySize } from './styles'
8
+
9
+ export type Size = SizeType<'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large'>
10
+
11
+ export type FontSize = SizeType<'small' | 'large'>
10
12
 
11
13
  interface Props extends BaseProps {
12
14
  children: ReactNode
13
- fontSize?: SizeType<'small' | 'large'>
14
- size: SizeType<'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large'>
15
+ fontSize?: FontSize
16
+ size: Size
15
17
  }
16
18
 
17
- const useStyles = makeStyles<Theme>(styles, {
18
- name: 'PicassoTextAvatar',
19
- })
20
-
21
19
  const TextAvatar = ({
22
20
  children,
23
21
  className,
@@ -26,32 +24,28 @@ const TextAvatar = ({
26
24
  fontSize,
27
25
  size,
28
26
  'data-private': dataPrivate,
29
- }: Props) => {
30
- const classes = useStyles()
31
-
32
- const SIZE_TO_FONT_SIZE = {
33
- small: '!text-[0.666666667em]',
34
- large: '!text-[1em]',
35
- }
36
-
37
- return (
38
- <div
39
- /* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */
40
- className={cx(classes.root, className, classes[size!])}
41
- style={style}
42
- data-private={dataPrivate}
27
+ }: Props) => (
28
+ <div
29
+ className={twMerge(
30
+ 'uppercase absolute top-1/2 left-1/2 [transform:translate(-50%,-50%)]',
31
+ containerTextClassBySize[size],
32
+ className
33
+ )}
34
+ style={style}
35
+ data-private={dataPrivate}
36
+ >
37
+ <Typography
38
+ data-testid={dataTestID}
39
+ className={twJoin(
40
+ fontSize ? typographyTextClassBySize[fontSize] : '',
41
+ 'leading-[1.5em]'
42
+ )}
43
+ invert
43
44
  >
44
- <Typography
45
- data-testid={dataTestID}
46
- /* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */
47
- className={SIZE_TO_FONT_SIZE[fontSize!]}
48
- invert
49
- >
50
- {children}
51
- </Typography>
52
- </div>
53
- )
54
- }
45
+ {children}
46
+ </Typography>
47
+ </div>
48
+ )
55
49
 
56
50
  TextAvatar.defaultProps = {
57
51
  size: 'large',
@@ -1,25 +1,14 @@
1
- import { createStyles } from '@material-ui/core/styles'
1
+ import type { FontSize, Size } from './TextAvatar'
2
2
 
3
- export default () =>
4
- createStyles({
5
- root: {
6
- textTransform: 'uppercase',
7
- position: 'absolute',
8
- top: '50%',
9
- left: '50%',
10
- transform: 'translate(-50%, -50%)',
11
- },
3
+ export const containerTextClassBySize: Record<Size, string> = {
4
+ xxsmall: 'text-[1em]',
5
+ xsmall: 'text-[1em]',
6
+ small: 'text-[2em]',
7
+ medium: 'text-[3em]',
8
+ large: 'text-[5em]',
9
+ }
12
10
 
13
- xxsmall: { fontSize: '1em' },
14
- xsmall: { fontSize: '1em' },
15
- small: { fontSize: '2em' },
16
- medium: { fontSize: '3em' },
17
- large: { fontSize: '5em' },
18
-
19
- smallFont: {
20
- fontSize: '0.666666667em',
21
- },
22
- largeFont: {
23
- fontSize: '1em',
24
- },
25
- })
11
+ export const typographyTextClassBySize: Record<FontSize, string> = {
12
+ small: 'text-[0.666666667em]',
13
+ large: 'text-[1em]',
14
+ }
@@ -1,10 +1,13 @@
1
1
  import React from 'react'
2
- import type { Theme } from '@material-ui/core'
3
- import { capitalize, makeStyles } from '@material-ui/core'
4
2
  import type { BaseProps, SizeType } from '@toptal/picasso-shared'
5
- import cx from 'classnames'
3
+ import { twJoin } from '@toptal/picasso-tailwind-merge'
6
4
 
7
- import styles from './styles'
5
+ import {
6
+ getBackgroundFillClass,
7
+ getBordersStrokeClass,
8
+ rootClassBySize,
9
+ svgClassBySize,
10
+ } from './styles'
8
11
  import { getShapes } from './utils'
9
12
 
10
13
  /**
@@ -43,6 +46,8 @@ export const AVATAR_DROPZONE_SVG_SHAPES = {
43
46
  large: getShapes(SETTINGS.large),
44
47
  } as const
45
48
 
49
+ export type Size = SizeType<'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large'>
50
+
46
51
  export interface Props extends BaseProps {
47
52
  size?: SizeType<'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large'>
48
53
  isDragActive?: boolean
@@ -52,10 +57,6 @@ export interface Props extends BaseProps {
52
57
  hovered?: boolean
53
58
  }
54
59
 
55
- const useStyles = makeStyles<Theme>(styles, {
56
- name: 'PicassoDropzoneSvg',
57
- })
58
-
59
60
  export const DropzoneSvg = (props: Props) => {
60
61
  const {
61
62
  size = 'small',
@@ -70,35 +71,35 @@ export const DropzoneSvg = (props: Props) => {
70
71
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
71
72
  const shapes = AVATAR_DROPZONE_SVG_SHAPES[size!]
72
73
 
73
- const classes = useStyles()
74
-
75
74
  return (
76
75
  <div
77
- className={cx(classes.root, classes[`root${capitalize(size)}`])}
76
+ className={twJoin(
77
+ '[pointer-events:unset] relative bg-transparent',
78
+ rootClassBySize[size]
79
+ )}
78
80
  data-testid={dataTestId}
79
81
  >
80
82
  <svg
81
- className={cx(classes.svg, classes[`svg${capitalize(size)}`])}
83
+ className={twJoin('m-[-3px]', svgClassBySize[size])}
82
84
  fill='none'
83
85
  xmlns='http://www.w3.org/2000/svg'
84
86
  >
85
87
  <path
86
- className={cx(classes.background, {
87
- [classes.dragActive]: isDragActive,
88
- [classes.disabled]: disabled,
89
- [classes.error]: error,
90
- [classes.focused]: focused,
91
- [classes.hovered]: hovered,
92
- })}
88
+ className={twJoin(
89
+ 'transition-colors duration-350 ease-out',
90
+ 'active:fill-blue-500/[0.24]',
91
+ getBackgroundFillClass({ hovered, isDragActive, disabled })
92
+ )}
93
93
  fillRule='evenodd'
94
94
  clipRule='evenodd'
95
95
  d={shapes.background}
96
96
  />
97
97
  <path
98
- className={cx(classes.outline, {
99
- [classes.focused]: focused,
100
- [classes.error]: error,
101
- })}
98
+ className={twJoin(
99
+ 'hidden',
100
+ focused && !isDragActive && '[display:initial]',
101
+ error ? 'stroke-red-500' : 'stroke-blue-500'
102
+ )}
102
103
  fillRule='evenodd'
103
104
  clipRule='evenodd'
104
105
  d={shapes.outline}
@@ -107,11 +108,10 @@ export const DropzoneSvg = (props: Props) => {
107
108
  strokeLinejoin='round'
108
109
  />
109
110
  <path
110
- className={cx(classes.border, {
111
- [classes.error]: error,
112
- [classes.focused]: focused,
113
- [classes.hovered]: hovered,
114
- })}
111
+ className={twJoin(
112
+ 'transition-[stroke] duration-350',
113
+ getBordersStrokeClass({ hovered, error })
114
+ )}
115
115
  fillRule='evenodd'
116
116
  clipRule='evenodd'
117
117
  d={shapes.borders}