-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: differentiate action popup and popup, improve responsiveness a…
…nd refactor footers, ref #5260
- Loading branch information
1 parent
9e7d404
commit 2cae2a2
Showing
49 changed files
with
815 additions
and
860 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!doctype html> | ||
<html class="mode__action-popup light"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<link href="/assets/base.css" rel="stylesheet" /> | ||
</head> | ||
<body> | ||
<div id="splash-screen"></div> | ||
<div id="app"></div> | ||
<script src="/assets/splash-screen.js"></script> | ||
<script src="browser-polyfill.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,110 @@ | ||
import { TooltipProvider } from '@radix-ui/react-tooltip'; | ||
import type { Meta } from '@storybook/react'; | ||
import { Box } from 'leather-styles/jsx'; | ||
import { Box, styled } from 'leather-styles/jsx'; | ||
|
||
import { Button } from '@leather.io/ui'; | ||
import { Button, Logo } from '@leather.io/ui'; | ||
|
||
import { Card as Component } from './card'; | ||
import { AvailableBalance, ButtonRow } from './index'; | ||
|
||
const meta: Meta<typeof Component> = { | ||
component: Component, | ||
tags: ['autodocs'], | ||
title: 'Layout/Card', | ||
decorators: [ | ||
Story => ( | ||
<TooltipProvider> | ||
<Story /> | ||
</TooltipProvider> | ||
), | ||
], | ||
}; | ||
|
||
export default meta; | ||
|
||
export function Card() { | ||
return ( | ||
<Component> | ||
<Box height="40vh">Card content</Box> | ||
</Component> | ||
); | ||
} | ||
|
||
export function CardWithButtonFooter() { | ||
return ( | ||
<Component | ||
footer={ | ||
<Button fullWidth onClick={() => null}> | ||
Create new account | ||
Button | ||
</Button> | ||
} | ||
> | ||
<Box height="200px" bg="lightModeRed.300" /> | ||
<Box height="40vh">Card content</Box> | ||
</Component> | ||
); | ||
} | ||
export function CardWithButtonRowFooter() { | ||
return ( | ||
<Component | ||
footer={ | ||
<ButtonRow flexDirection="row"> | ||
<Button flexGrow={1} onClick={() => null} variant="outline"> | ||
Cancel | ||
</Button> | ||
<Button flexGrow={1} onClick={() => null}> | ||
Confirm | ||
</Button> | ||
</ButtonRow> | ||
} | ||
> | ||
<Box height="40vh">Card content</Box> | ||
</Component> | ||
); | ||
} | ||
|
||
export function CardWithBalanceFooter() { | ||
return ( | ||
<Component | ||
footer={ | ||
<ButtonRow> | ||
<Button fullWidth onClick={() => null}> | ||
Continue | ||
</Button> | ||
<AvailableBalance balance="$10" /> | ||
</ButtonRow> | ||
} | ||
> | ||
<Box height="40vh">Card content</Box> | ||
</Component> | ||
); | ||
} | ||
|
||
export function CardWithBigHeader() { | ||
return ( | ||
<Component | ||
header={ | ||
<styled.h1 textStyle="heading.03" p="space.05"> | ||
choose asset <br /> to fund | ||
</styled.h1> | ||
} | ||
> | ||
<Box height="40vh">Card content</Box> | ||
</Component> | ||
); | ||
} | ||
|
||
export function CardWithLogo() { | ||
return ( | ||
<Component | ||
header={ | ||
<styled.h1 p="space.04" hideBelow="sm"> | ||
<Box px="space.02"> | ||
<Logo /> | ||
</Box> | ||
</styled.h1> | ||
} | ||
> | ||
<Box height="40vh">Card content</Box> | ||
</Component> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,65 @@ | ||
import type { ReactNode } from 'react'; | ||
|
||
import { Flex } from 'leather-styles/jsx'; | ||
import { Flex, FlexProps } from 'leather-styles/jsx'; | ||
import { token } from 'leather-styles/tokens'; | ||
|
||
interface CardProps { | ||
children: ReactNode; | ||
dataTestId?: string; | ||
header?: ReactNode; | ||
footer?: ReactNode; | ||
footerBorder?: boolean; | ||
contentStyle?: FlexProps; | ||
} | ||
|
||
export function Card({ children, dataTestId, header, footer }: CardProps) { | ||
export function Card({ | ||
children, | ||
dataTestId, | ||
header, | ||
footer, | ||
contentStyle, | ||
footerBorder = false, | ||
...props | ||
}: CardProps & FlexProps) { | ||
return ( | ||
<Flex data-testid={dataTestId} direction="column"> | ||
<Flex | ||
data-testid={dataTestId} | ||
direction="column" | ||
position={{ base: 'unset', sm: 'relative' }} | ||
border={{ base: 'unset', sm: 'default' }} | ||
rounded="lg" | ||
{...props} | ||
> | ||
{header} | ||
{children} | ||
{footer} | ||
<Flex | ||
flexDirection="column" | ||
width="100%" | ||
overflowY="auto" | ||
style={{ marginBottom: footer ? token('sizes.footerHeight') : 0 }} | ||
p="space.05" | ||
maxHeight={{ base: '70vh', md: '80vh' }} | ||
{...contentStyle} | ||
> | ||
{children} | ||
</Flex> | ||
{footer && ( | ||
<Flex | ||
bottom={0} | ||
position="absolute" | ||
gap="space.05" | ||
p="space.05" | ||
width="100vw" | ||
maxWidth="100%" | ||
zIndex={1} | ||
minHeight="footerHeight" | ||
bg="ink.background-primary" | ||
borderTop={footerBorder ? 'default' : 'unset'} | ||
borderBottomLeftRadius="lg" | ||
borderBottomRightRadius="lg" | ||
> | ||
{footer} | ||
</Flex> | ||
)} | ||
</Flex> | ||
); | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Flex, FlexProps } from 'leather-styles/jsx'; | ||
|
||
import { HasChildren } from '@app/common/has-children'; | ||
|
||
export function ButtonRow({ children, ...props }: HasChildren & FlexProps) { | ||
return ( | ||
<Flex flexDirection="column" gap="space.04" width="100%" {...props}> | ||
{children} | ||
</Flex> | ||
); | ||
} |
18 changes: 18 additions & 0 deletions
18
src/app/components/layout/card/components/summary-footer.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { HStack } from 'leather-styles/jsx'; | ||
|
||
import { CopyIcon, ExternalLinkIcon } from '@leather.io/ui'; | ||
|
||
import { InfoCardBtn } from '@app/components/info-card/info-card'; | ||
|
||
interface SummaryFooterProps { | ||
onClickLink(): void; | ||
onClickCopy(): void; | ||
} | ||
export function SummaryFooter({ onClickLink, onClickCopy }: SummaryFooterProps) { | ||
return ( | ||
<HStack gap="space.04" width="100%"> | ||
<InfoCardBtn icon={<ExternalLinkIcon />} label="View details" onClick={onClickLink} /> | ||
<InfoCardBtn icon={<CopyIcon />} label="Copy ID" onClick={onClickCopy} /> | ||
</HStack> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export { Card } from './card'; | ||
export { ButtonRow } from './components/button-row'; | ||
export { SummaryFooter } from './components/summary-footer'; | ||
export { AvailableBalance } from './components/available-balance'; |
Oops, something went wrong.