-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3ee3d7f
commit 0c8f570
Showing
11 changed files
with
644 additions
and
43 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
declare module '*.svg' { | ||
export const ReactComponent: React.FunctionComponent< | ||
React.SVGProps<SVGSVGElement> | ||
>; | ||
} |
40 changes: 40 additions & 0 deletions
40
packages/app/src/systems/Core/components/EmptyCard/EmptyCard.stories.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,40 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { EmptyCard } from './EmptyCard'; | ||
|
||
const meta: Meta<typeof EmptyCard> = { | ||
title: 'Core/EmptyCard', | ||
component: EmptyCard, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof EmptyCard>; | ||
|
||
export const Usage: Story = { | ||
render: () => ( | ||
<EmptyCard className="w-[800px]"> | ||
<EmptyCard.Title>Empty Card</EmptyCard.Title> | ||
<EmptyCard.Description> | ||
Use this card when there is no data to show. | ||
</EmptyCard.Description> | ||
</EmptyCard> | ||
), | ||
}; | ||
|
||
export const JustTitle: Story = { | ||
render: () => ( | ||
<EmptyCard className="w-[800px]"> | ||
<EmptyCard.Title>Empty Card</EmptyCard.Title> | ||
</EmptyCard> | ||
), | ||
}; | ||
|
||
export const JustDescription: Story = { | ||
render: () => ( | ||
<EmptyCard className="w-[800px]"> | ||
<EmptyCard.Description> | ||
Use this card when there is no data to show. | ||
</EmptyCard.Description> | ||
</EmptyCard> | ||
), | ||
}; |
65 changes: 65 additions & 0 deletions
65
packages/app/src/systems/Core/components/EmptyCard/EmptyCard.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,65 @@ | ||
import type { CardProps, HeadingProps, TextProps } from '@fuels/ui'; | ||
import { Card, Heading, createComponent, Text, withNamespace } from '@fuels/ui'; | ||
import { tv } from 'tailwind-variants'; | ||
|
||
import { ReactComponent as EmptySvg } from './empty.svg'; | ||
|
||
export type EmptyCardProps = CardProps; | ||
export type EmptyCardTitleProps = HeadingProps; | ||
export type EmptyCardDescriptionProps = TextProps; | ||
|
||
export const EmptyCardRoot = createComponent<EmptyCardProps, typeof Card>({ | ||
id: 'EmptyCard', | ||
render: (_, { children, className, ...props }) => { | ||
const classes = styles({ className }); | ||
return ( | ||
<Card {...props} className={classes.root({ className })}> | ||
<EmptySvg | ||
width={80} | ||
height={80} | ||
viewBox="0 0 682.66 682.66" | ||
className={classes.image({ | ||
className: '[&_path]:stroke-[8] text-muted', | ||
})} | ||
/> | ||
{children} | ||
</Card> | ||
); | ||
}, | ||
}); | ||
|
||
export const EmptyCardTitle = createComponent< | ||
EmptyCardTitleProps, | ||
typeof Card.Title | ||
>({ | ||
id: 'EmptyCardTitle', | ||
render: (_, { className, ...props }) => { | ||
const classes = styles({ className }); | ||
return <Heading {...props} as="h4" size="5" className={classes.title()} />; | ||
}, | ||
}); | ||
|
||
export const EmptyCardDescription = createComponent< | ||
EmptyCardDescriptionProps, | ||
typeof Text | ||
>({ | ||
id: 'EmptyCardDescription', | ||
render: (_, { className, ...props }) => { | ||
const classes = styles({ className }); | ||
return <Text {...props} className={classes.description()} />; | ||
}, | ||
}); | ||
|
||
export const EmptyCard = withNamespace(EmptyCardRoot, { | ||
Title: EmptyCardTitle, | ||
Description: EmptyCardDescription, | ||
}); | ||
|
||
const styles = tv({ | ||
slots: { | ||
root: 'p-6 text-center flex flex-col items-center gap-0', | ||
image: 'mb-6', | ||
title: 'font-semibold text-heading', | ||
description: 'text-sm text-secondary mt-2', | ||
}, | ||
}); |
142 changes: 142 additions & 0 deletions
142
packages/app/src/systems/Core/components/EmptyCard/empty.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.