Skip to content

Commit

Permalink
Update animate state control for Collapse (#188)
Browse files Browse the repository at this point in the history
* fix: allow for downstream control for initial animation on mount

* chore(changesets): add changeset for Collapse update
  • Loading branch information
hobbescodes authored Dec 21, 2023
1 parent f168727 commit 4c8e2cc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/real-suns-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@animareflection/ui": minor
---

Add control for `Collapse` initial animation on mount
4 changes: 3 additions & 1 deletion src/components/utility/Collapse/Collapse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type { ReactElement, ReactNode } from "react";

export interface Props extends FlexProps {
label?: string;
animateOnMount?: boolean;
icon?: ReactElement;
isOpen?: boolean;
onOpen?: () => void;
Expand All @@ -26,6 +27,7 @@ export interface Props extends FlexProps {
*/
const Collapse = ({
label,
animateOnMount = false,
icon,
isOpen: isOpenProp,
onOpen,
Expand Down Expand Up @@ -76,7 +78,7 @@ const Collapse = ({
{icon ?? defaultIcon}
</Icon>
</Button>
<AnimatePresence>
<AnimatePresence initial={animateOnMount}>
{isOpen && (
<motion.div
style={{ overflow: "hidden" }}
Expand Down

1 comment on commit 4c8e2cc

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for ui-storybook ready!

✅ Preview
https://ui-storybook-rji10u1vh-animareflection.vercel.app

Built with commit 4c8e2cc.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.