-
Notifications
You must be signed in to change notification settings - Fork 137
fix(AvatarStack): change ordering algorithm for correct logical order li #2480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,10 +43,17 @@ const AvatarStackComponent = React.forwardRef<HTMLUListElement, AvatarStackProps | |
| return; | ||
| } | ||
|
|
||
| const item = <AvatarStackItem key={visibleItems.length}>{child}</AvatarStackItem>; | ||
| const item = ( | ||
| <AvatarStackItem | ||
| key={visibleItems.length} | ||
| style={{zIndex: normalizedMax - visibleItems.length}} | ||
| > | ||
| {child} | ||
| </AvatarStackItem> | ||
| ); | ||
|
|
||
| if (visibleItems.length < normalizedMax) { | ||
| visibleItems.unshift(item); | ||
| visibleItems.push(item); | ||
| } | ||
| }); | ||
|
|
||
|
|
@@ -57,16 +64,16 @@ const AvatarStackComponent = React.forwardRef<HTMLUListElement, AvatarStackProps | |
| // to restore role manually | ||
| // eslint-disable-next-line jsx-a11y/no-redundant-roles | ||
| <ul className={b({'overlap-size': overlapSize}, className)} role={'list'} ref={ref}> | ||
| {visibleItems} | ||
| {hasMoreButton ? ( | ||
| <AvatarStackItem key="more-button"> | ||
| <AvatarStackItem key="more-button" style={{zIndex: 0}}> | ||
|
||
| {renderMore ? ( | ||
| renderMore({count: moreItems}) | ||
| ) : ( | ||
| <AvatarStackMore count={moreItems} size={size} /> | ||
| )} | ||
| </AvatarStackItem> | ||
| ) : null} | ||
| {visibleItems} | ||
| </ul> | ||
| ); | ||
| }, | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,10 +4,16 @@ import {block} from '../utils/cn'; | |||||||||
|
|
||||||||||
| const b = block('avatar-stack'); | ||||||||||
|
|
||||||||||
| type Props = React.PropsWithChildren<{}>; | ||||||||||
| type Props = React.PropsWithChildren<{ | ||||||||||
| style?: React.CSSProperties; | ||||||||||
| }>; | ||||||||||
|
||||||||||
| type Props = React.PropsWithChildren<{ | |
| style?: React.CSSProperties; | |
| }>; | |
| type Props = React.PropsWithChildren<Pick<HTMLLIElement, 'style'>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like some mistyping, can you return empty line here please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This selector is necessary for determining the correct size of the container.

With
&:not..Without

&:not..