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/tame-rockets-compete.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
---
'@primer/react': patch
---

Fix inconsistent border treatment when there is one avatar in an AvatarStack
6 changes: 6 additions & 0 deletions src/AvatarStack/AvatarStack.features.stories.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -88,3 +88,9 @@ export const CustomSizeOnChildrenResponsive = () => (
/>
</AvatarStack>
)

export const WithSingleAvatar = () => (
<AvatarStack>
<Avatar alt="Primer logo" src="https://avatars.githubusercontent.com/primer" />
</AvatarStack>
)
5 changes: 3 additions & 2 deletions src/AvatarStack/AvatarStack.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -46,7 +46,8 @@ const AvatarStackWrapper = styled.span<StyledAvatarStackWrapperProps>`
flex-shrink: 0;
height: var(--avatar-stack-size);
width: var(--avatar-stack-size);
box-shadow: 0 0 0 var(--avatar-border-width) ${get('colors.canvas.default')};
box-shadow: 0 0 0 var(--avatar-border-width)
${props => (props.count === 1 ? get('colors.avatar.border') : get('colors.canvas.default'))};
position: relative;
overflow: hidden;

Expand DownExpand Up@@ -136,7 +137,7 @@ const AvatarStackWrapper = styled.span<StyledAvatarStackWrapperProps>`
margin-left: ${get('space.1')};
opacity: 100%;
visibility: visible;
box-shadow: 0 0 0 4px ${get('colors.canvas.default')};
${props => (props.count === 1 ? '' : `box-shadow: 0 0 0 4px ${get('colors.canvas.default')};`)}
transition:
margin 0.2s ease-in-out,
opacity 0.2s ease-in-out,
Expand Down
10 changes: 8 additions & 2 deletions src/__tests__/__snapshots__/AvatarStack.test.tsx.snap
Original file line numberDiff line numberDiff line change
Expand Up@@ -122,11 +122,14 @@ exports[`Avatar renders consistently 1`] = `
margin-left: 4px;
opacity: 100%;
visibility: visible;
box-shadow: 0 0 0 4px #ffffff;
-webkit-transition: margin 0.2s ease-in-out,opacity 0.2s ease-in-out,visibility 0.2s ease-in-out,box-shadow 0.1s ease-in-out;
transition: margin 0.2s ease-in-out,opacity 0.2s ease-in-out,visibility 0.2s ease-in-out,box-shadow 0.1s ease-in-out;
}

.c0 .pc-AvatarStackBody:not(.pc-AvatarStack--disableExpand):hover .pc-AvatarItem box-shadow:0 0 0 4px function (props) {
return: (0,_core.get)(props.theme,path,fallback);
}

.c0 .pc-AvatarStackBody:not(.pc-AvatarStack--disableExpand):hover .pc-AvatarItem:first-child {
margin-left: 0;
}
Expand DownExpand Up@@ -284,11 +287,14 @@ exports[`Avatar respects alignRight props 1`] = `
margin-left: 4px;
opacity: 100%;
visibility: visible;
box-shadow: 0 0 0 4px #ffffff;
-webkit-transition: margin 0.2s ease-in-out,opacity 0.2s ease-in-out,visibility 0.2s ease-in-out,box-shadow 0.1s ease-in-out;
transition: margin 0.2s ease-in-out,opacity 0.2s ease-in-out,visibility 0.2s ease-in-out,box-shadow 0.1s ease-in-out;
}

.c0 .pc-AvatarStackBody:not(.pc-AvatarStack--disableExpand):hover .pc-AvatarItem box-shadow:0 0 0 4px function (props) {
return: (0,_core.get)(props.theme,path,fallback);
}

.c0 .pc-AvatarStackBody:not(.pc-AvatarStack--disableExpand):hover .pc-AvatarItem:first-child {
margin-left: 0;
}
Expand Down