Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/angry-brooms-knock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': minor
---

Added className prop to the AvatarStack component
25 changes: 18 additions & 7 deletions packages/react/src/AvatarStack/AvatarStack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,17 +183,28 @@ export type AvatarStackProps = {
alignRight?: boolean
disableExpand?: boolean
size?: number | ResponsiveValue<number>
className?: string
children: React.ReactNode
} & SxProp

const AvatarStack = ({children, alignRight, disableExpand, size, sx: sxProp = defaultSxProp}: AvatarStackProps) => {
const AvatarStack = ({
children,
alignRight,
disableExpand,
size,
className,
sx: sxProp = defaultSxProp,
}: AvatarStackProps) => {
const count = React.Children.count(children)
const wrapperClassNames = clsx({
'pc-AvatarStack--two': count === 2,
'pc-AvatarStack--three': count === 3,
'pc-AvatarStack--three-plus': count > 3,
'pc-AvatarStack--right': alignRight,
})
const wrapperClassNames = clsx(
{
'pc-AvatarStack--two': count === 2,
'pc-AvatarStack--three': count === 3,
'pc-AvatarStack--three-plus': count > 3,
'pc-AvatarStack--right': alignRight,
},
className,
)
const bodyClassNames = clsx('pc-AvatarStackBody', {
'pc-AvatarStack--disableExpand': disableExpand,
})
Expand Down
Loading