1
- import React from 'react'
2
- import styled from 'styled-components'
1
+ import React , { type HTMLProps } from 'react'
3
2
import type { AvatarProps } from '../Avatar'
4
3
import Avatar from '../Avatar'
5
- import { get } from '../constants'
6
- import Box , { type BoxProps } from '../Box'
7
4
import { SkeletonAvatar } from '../experimental/Skeleton/SkeletonAvatar'
5
+ import classes from './AvatarPair.module.css'
6
+ import { clsx } from 'clsx'
8
7
9
- const StyledAvatarPair = styled ( Box ) `
10
- position: relative;
11
- display: inline-flex;
8
+ export type AvatarPairProps = HTMLProps < HTMLDivElement >
12
9
13
- [data-component='Avatar']:last-child,
14
- [data-component='SkeletonAvatar']:last-child {
15
- position: absolute;
16
- right: -15%;
17
- bottom: -9%;
18
- box-shadow: ${ get ( 'shadows.avatar.childShadow' ) } ;
19
- }
20
-
21
- [data-component='SkeletonAvatar']:last-child {
22
- box-shadow: inset ${ get ( 'shadows.avatar.childShadow' ) } ;
23
- }
24
- `
25
-
26
- export type AvatarPairProps = BoxProps
27
-
28
- const AvatarPair = ( { children, ...rest } : AvatarPairProps ) => {
10
+ const AvatarPair = ( { children, className, ...rest } : AvatarPairProps ) => {
29
11
const avatars = React . Children . map ( children , ( child , i ) => {
30
12
if ( ! React . isValidElement ( child ) ) {
31
13
return child
@@ -39,13 +21,16 @@ const AvatarPair = ({children, ...rest}: AvatarPairProps) => {
39
21
return < SkeletonAvatar { ...child . props } size = { 20 } />
40
22
}
41
23
42
- return < Avatar bg = "canvas.default" { ...child . props } size = { 20 } />
24
+ return < Avatar className = { clsx ( child . props . className , classes . AvatarChild ) } { ...child . props } size = { 20 } />
43
25
} )
44
26
45
- return < StyledAvatarPair { ...rest } > { avatars } </ StyledAvatarPair >
27
+ return (
28
+ < div className = { clsx ( className , classes . AvatarPair ) } { ...rest } >
29
+ { avatars }
30
+ </ div >
31
+ )
46
32
}
47
33
48
- // styled() changes this
49
34
AvatarPair . displayName = 'AvatarPair'
50
35
51
36
export default AvatarPair
0 commit comments