diff --git a/packages/keychain/src/components/layout/container/header/Banner.stories.tsx b/packages/keychain/src/components/layout/container/header/Banner.stories.tsx index de13bda55..720ef45d3 100644 --- a/packages/keychain/src/components/layout/container/header/Banner.stories.tsx +++ b/packages/keychain/src/components/layout/container/header/Banner.stories.tsx @@ -1,5 +1,6 @@ import type { Meta, StoryObj } from "@storybook/react"; import { Banner } from "./Banner"; +import { EthereumIcon, TransferDuoIcon } from "@cartridge/ui-next"; const meta: Meta = { component: Banner, @@ -10,6 +11,11 @@ const meta: Meta = { values: [{ name: "dark", value: "#161a17" }], }, }, + args: { + variant: "compressed", + title: "Welcome to Keychain", + description: "Secure your digital assets", + }, } satisfies Meta; export default meta; @@ -17,21 +23,29 @@ export default meta; type Story = StoryObj; export const Expanded: Story = { - parameters: { + args: { variant: "expanded", }, +}; + +export const Compressed: Story = {}; + +export const IconComponentProp: Story = { args: { - title: "Welcome to Keychain", - description: "Secure your digital assets", + Icon: TransferDuoIcon, }, }; -export const Compressed: Story = { - parameters: { - variant: "compressed", +export const IconElementProp: Story = { + args: { + icon: , }, +}; + +export const VeryLongTitle: Story = { args: { - title: "Welcome to Keychain", - description: "Secure your digital assets", + title: "This is a very long title that should be truncated", + description: + "This is a very long description that should be wrapped and demonstrate how text behaves when it extends beyond multiple lines. It's important to test how the UI handles lengthy content to ensure proper wrapping, readability, and overall visual appeal. How does this much longer description look in the component?", }, }; diff --git a/packages/keychain/src/components/layout/container/header/Banner.tsx b/packages/keychain/src/components/layout/container/header/Banner.tsx index b359516c6..5f251626d 100644 --- a/packages/keychain/src/components/layout/container/header/Banner.tsx +++ b/packages/keychain/src/components/layout/container/header/Banner.tsx @@ -1,16 +1,5 @@ -import { - VStack, - Circle, - Text, - Center, - Flex, - Image, - Square, - HStack, -} from "@chakra-ui/react"; import { useControllerTheme } from "@/hooks/theme"; -import { TOP_BAR_HEIGHT } from "./TopBar"; -import { IconProps } from "@cartridge/ui-next"; +import { cn, IconProps } from "@cartridge/ui-next"; export type BannerProps = { Icon?: React.ComponentType; @@ -29,149 +18,115 @@ export function Banner({ description, variant = "compressed", }: BannerProps) { - const theme = useControllerTheme(); - switch (variant) { case "expanded": return ( - - -
- - - - - {Icon ? ( - - - - ) : icon ? ( - - {icon} - - ) : ( - Controller Icon - )} - - - - - - {title} - - - {description && ( - - {description} - - )} - - -
-
-
+
+
+ + +
+
); case "compressed": default: return ( - - +
+
+
+ + +
+
+ ); + } +} - - {Icon ? ( - - - - ) : icon ? ( - - {icon} - - ) : ( - Controller Icon - )} +function HeaderIcon({ + variant, + Icon, + icon, +}: Pick) { + const theme = useControllerTheme(); - - - {title} - + return ( + + {(() => { + if (Icon) { + return ; + } - {description && ( - - {description} - - )} - - - + if (icon) { + return icon; + } + + return ( + Controller Header Icon + ); + })()} + + ); +} + +function IconWrapper({ + variant, + children, +}: { + variant?: BannerVariant; + children: React.ReactNode; +}) { + switch (variant) { + case "expanded": + return ( +
+
+ {children} +
+
+ ); + default: + case "compressed": + return ( +
+ {children} +
); } } -const ICON_SIZE = 80; -const ICON_OFFSET = 40; +function Headline({ + variant, + title, + description, +}: Pick) { + return ( +
+
+ {title} +
+ + {description && ( +
+ {description} +
+ )} +
+ ); +} diff --git a/packages/keychain/src/components/layout/container/header/TopBar.tsx b/packages/keychain/src/components/layout/container/header/TopBar.tsx index c0529d427..afb0485de 100644 --- a/packages/keychain/src/components/layout/container/header/TopBar.tsx +++ b/packages/keychain/src/components/layout/container/header/TopBar.tsx @@ -1,4 +1,3 @@ -import { Spacer, HStack } from "@chakra-ui/react"; import { CloseButton } from "./CloseButton"; import { SettingsButton } from "./SettingsButton"; import { BackButton } from "./BackButton"; @@ -26,42 +25,29 @@ export function TopBar({ ); return ( - +
{onBack ? ( ) : ( )} - +
+ {!hideNetwork && chainId && } - {!hideNetwork && chainId && } - - {!hideAccount && ( - <> - {/* {!!address && ( + {!hideAccount && ( + <> + {/* {!!address && ( <> {chainId && } )} */} - - )} + + )} - {showSettings && openSettings()} />} - + {showSettings && openSettings()} />} +
+
); } - -export const TOP_BAR_HEIGHT = 56;