Skip to content
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

Disables transition on AvatarStack children that are added after initial render #3709

Merged
merged 4 commits into from
Sep 6, 2023

Conversation

mperrotti
Copy link
Contributor

Only applies transition property when disableExpand is not passed.

Closes #3688

Screenshots

Kapture.2023-09-05.at.13.49.32.mp4

Merge checklist

  • Added/updated tests
  • [n/a] Added/updated documentation
  • Changes are SSR compatible
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.

@mperrotti mperrotti requested review from a team and joshblack September 5, 2023 17:51
@changeset-bot
Copy link

changeset-bot bot commented Sep 5, 2023

🦋 Changeset detected

Latest commit: ab19031

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@mperrotti mperrotti requested a review from gr2m September 5, 2023 17:51
@mperrotti
Copy link
Contributor Author

If you want to test these changes locally, you can replace the DisableExpandOnHover story with this:

export const DisableExpandOnHover = () => {
  const srcArr = [
    'https://avatars.githubusercontent.com/primer',
    'https://avatars.githubusercontent.com/github',
    'https://avatars.githubusercontent.com/atom',
    'https://avatars.githubusercontent.com/desktop',
  ]
  const [avatarSrcs, setAvatarSrcs] = React.useState([])
  const addAvatar = () => {
    setAvatarSrcs([...avatarSrcs, srcArr[avatarSrcs.length % srcArr.length]])
  }
  const removeAvatar = () => {
    setAvatarSrcs(avatarSrcs.slice(0, avatarSrcs.length - 1))
  }

  return (
    <div style={{display: 'flex', flexDirection: 'column', gap: '1em', alignItems: 'flex-start'}}>
      <div style={{display: 'flex', gap: '0.5em'}}>
        <Button onClick={addAvatar}>Add avatar</Button>
        <Button onClick={removeAvatar}>Remove avatar</Button>
      </div>
      <div>
        <AvatarStack disableExpand>
          {avatarSrcs.map(src => (
            <Avatar alt="Some avatar" src={src} key={src} />
          ))}
        </AvatarStack>
      </div>
    </div>
  )
}

@github-actions
Copy link
Contributor

github-actions bot commented Sep 5, 2023

size-limit report 📦

Path Size
dist/browser.esm.js 100.62 KB (-0.01% 🔽)
dist/browser.umd.js 101.19 KB (-0.01% 🔽)

@github-actions github-actions bot temporarily deployed to storybook-preview-3709 September 5, 2023 18:00 Inactive
@mperrotti mperrotti temporarily deployed to github-pages September 5, 2023 18:03 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3709 September 5, 2023 18:03 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AvatarStack: disableExpand does not disable animation when Avatar components within are changed
2 participants