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

Delay session details to appear for better animation #303

Merged
merged 1 commit into from
May 24, 2024
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
12 changes: 11 additions & 1 deletion packages/keychain/src/components/PortalFooter/SessionDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,30 @@ import {
} from "@chakra-ui/react";
import { CodeUtilIcon, WedgeRightIcon } from "@cartridge/ui";
import { Policy } from "@cartridge/controller";
import { motion } from "framer-motion";

export function SessionDetails({
hostname,
policies,
isOpen,
}: {
hostname: string;
policies: Policy[];
isOpen: boolean;
}) {
if (!policies) {
return null;
}

return (
<VStack marginY={4} alignItems="flex">
<VStack
marginY={4}
alignItems="flex"
as={motion.div}
layoutScroll
animate={{ display: isOpen ? "flex" : "none", transition: { delay: 0.3 } }}
display="none"
>
<VStack
align="flex-start"
borderTopRadius="md"
Expand Down
3 changes: 1 addition & 2 deletions packages/keychain/src/components/PortalFooter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ export function PortalFooter({
<WedgeUpIcon
boxSize={10}
color="text.secondary"
rotate={isOpen ? 180 : 0}
transform={isOpen ? "rotate(180deg)" : "rotate(0deg)"}
/>
}
Expand Down Expand Up @@ -115,7 +114,7 @@ export function PortalFooter({
/>

{isOpen && hostname && policies && (
<SessionDetails hostname={hostname} policies={policies} />
<SessionDetails hostname={hostname} policies={policies} isOpen={isOpen} />
)}

{/* TODO: starter pack
Expand Down
Loading