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

Don't use fixed footer #1277

Merged
merged 2 commits into from
Jan 15, 2025
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/keychain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"storybook": "storybook dev -p 6001",
"storybook:build": "storybook build",
"storybook:serve": "pnpm storybook:build --quiet && pnpm http-server -c-1 storybook-static --port 6006 --silent",
"test:storybook:update": "start-server-and-test 'pnpm storybook:serve' 6006 'pnpm test-storybook -u'",
"test-storybook": "test-storybook",
"test:storybook": "start-server-and-test 'pnpm storybook:serve' 6006 'pnpm test-storybook'"
},
"dependencies": {
Expand Down
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
16 changes: 16 additions & 0 deletions packages/keychain/src/components/slot/Consent.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { Meta, StoryObj } from "@storybook/react";
import { Consent } from "./consent";

const meta: Meta<typeof Consent> = {
title: "Slot/Consent",
component: Consent,
decorators: [(Story) => <Story />],
parameters: {
layout: "centered",
},
};

export default meta;
type Story = StoryObj<typeof meta>;

export const Default: Story = {};
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
1 change: 1 addition & 0 deletions packages/ui-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"storybook": "storybook dev -p 6003",
"storybook:build": "storybook build",
"storybook:serve": "pnpm storybook:build --quiet && pnpm http-server -c-1 storybook-static --port 6007 --silent",
"test-storybook": "test-storybook",
"test:storybook:update": "start-server-and-test 'pnpm storybook:serve' 6007 'pnpm test-storybook --url http://127.0.0.1:6007 -u'",
"test:storybook": "start-server-and-test 'pnpm storybook:serve' 6007 'pnpm test-storybook --url http://127.0.0.1:6007'"
},
Expand Down
19 changes: 14 additions & 5 deletions scripts/update-storybook-snapshot.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
#!/bin/bash

# Run the container with all necessary options
# Check for required arguments
if [ "$#" -lt 2 ]; then
echo "Usage: $0 <package-name> <port>"
echo "Example: $0 @cartridge/keychain 6006"
exit 1
fi

PACKAGE=$1
PORT=$2

# Run the test updates in container
docker run \
--rm \
--network="host" \
-v "$(pwd)":/app \
-v /app/node_modules \
--ipc=host \
-ti \
ghcr.io/cartridge-gg/controller/storybook-env:sha-91a2d36 \
bash -c "
pnpm install --frozen-lockfile && \
pnpm test:storybook:update
"
bash -c "pnpm i && pnpm --filter $PACKAGE test-storybook -u --url http://host.docker.internal:$PORT"
Loading