Skip to content

Commit

Permalink
Don't use fixed footer
Browse files Browse the repository at this point in the history
  • Loading branch information
tarrencev committed Jan 15, 2025
1 parent fee85b1 commit 19891c9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 26 deletions.
2 changes: 1 addition & 1 deletion packages/keychain/src/components/layout/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function Content({
return (
<div
className={cn(
"w-full px-4 pb-[var(--footer-height)] flex flex-col items-stretch gap-2",
"w-full px-4 flex flex-col items-stretch gap-2 max-h-[400px] overflow-y-auto",
className,
)}
>
Expand Down
26 changes: 2 additions & 24 deletions packages/keychain/src/components/layout/footer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { forwardRef, memo, PropsWithChildren, useEffect, useRef } from "react";
import { forwardRef, memo, PropsWithChildren, useRef } from "react";
import { cn } from "@cartridge/ui-next";
import { Link } from "react-router-dom";

Expand All @@ -9,32 +9,10 @@ export function Footer({
}: PropsWithChildren & { className?: string; showCatridgeLogo?: boolean }) {
const ref = useRef<HTMLDivElement | null>(null);

useEffect(() => {
if (!ref.current) {
document.documentElement.style.setProperty("--footer-height", "0px");
return;
}

const observer = new ResizeObserver((entries) => {
const rect = entries[0].contentRect;
if (!rect.height) return;
document.documentElement.style.setProperty(
"--footer-height",
`${rect.height + 16 * 2}px`,
);
});

observer.observe(ref.current);

return () => {
observer.disconnect();
};
}, []);

return (
<div
className={cn(
"flex flex-col gap-2 w-full pt-4 fixed md:absolute left-0 bottom-0 bg-background",
"flex flex-col gap-2 w-full pt-4 left-0 bottom-0 bg-background",
!showCatridgeLogo && "pb-4",
className,
)}
Expand Down
1 change: 0 additions & 1 deletion packages/keychain/src/components/slot/consent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export function Consent() {
>
<Footer>
<Button onClick={onSubmit}>approve</Button>

<Button variant="secondary" onClick={onDeny}>
deny
</Button>
Expand Down

0 comments on commit 19891c9

Please sign in to comment.