-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
T79384 feat: create EmptyStateCard component (#1453)
## π Changes - Creates `EmptyStateCard` component ## β Checklist Easy UI has certain UX standards that must be met. In general, non-trivial changes should meet the following criteria: - [x] Visuals match Design Specs in Figma - [x] Stories accompany any component changes - [x] Code is in accordance with our style guide - [x] Design tokens are utilized - [x] Unit tests accompany any component changes - [x] TSDoc is written for any API surface area - [x] Specs are up-to-date - [x] Console is free from warnings - [x] No accessibility violations are reported - [x] Cross-browser check is performed (Chrome, Safari, Firefox) - [x] Changeset is added ~Strikethrough~ any items that are not applicable to this pull request.
- Loading branch information
1 parent
e6c8040
commit 712edb9
Showing
7 changed files
with
659 additions
and
38 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,5 @@ | ||
--- | ||
"@easypost/easy-ui": minor | ||
--- | ||
|
||
feat: create EmptyStateCard 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
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,50 @@ | ||
import React from "react"; | ||
import { ArgTypes, Canvas, Meta, Controls } from "@storybook/blocks"; | ||
import { EmptyStateCard } from "./EmptyStateCard"; | ||
import * as EmptyStateCardStories from "./EmptyStateCard.stories"; | ||
|
||
<Meta of={EmptyStateCardStories} /> | ||
|
||
# EmptyStateCard | ||
|
||
An `<EmptyStateCard />` is a styled container with a header, body, and action sections, designed to display relevant information when there is no nearby data to display. | ||
|
||
It is a simple compound component consisting of `<EmptyStateCard.Header />`, `<EmptyStateCard.HeaderText />`, `<EmptyStateCard.Body />`, `<EmptyStateCard.BodyText />`, and `<EmptyStateCard.Action />`. | ||
|
||
## Gap | ||
|
||
Use `blockGap` and `textGap`to configure the content spacing. | ||
|
||
<Canvas of={EmptyStateCardStories.Gap} /> | ||
|
||
<Controls of={EmptyStateCardStories.Gap} /> | ||
|
||
## Positioning | ||
|
||
Use `contentAlignment` to configure the content alignment. | ||
|
||
<Canvas of={EmptyStateCardStories.Position} /> | ||
|
||
<Controls of={EmptyStateCardStories.Position} /> | ||
|
||
## Properties | ||
|
||
### EmptyStateCard | ||
|
||
<ArgTypes of={EmptyStateCard} /> | ||
|
||
### EmptyStateCard.Header | ||
|
||
<ArgTypes of={EmptyStateCard.Header} /> | ||
|
||
### EmptyStateCard.HeaderText | ||
|
||
<ArgTypes of={EmptyStateCard.HeaderText} /> | ||
|
||
### EmptyStateCard.Body | ||
|
||
<ArgTypes of={EmptyStateCard.Body} /> | ||
|
||
### EmptyStateCard.BodyText | ||
|
||
<ArgTypes of={EmptyStateCard.BodyText} /> |
83 changes: 83 additions & 0 deletions
83
easy-ui-react/src/EmptyStateCard/EmptyStateCard.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,83 @@ | ||
import React from "react"; | ||
import { Meta, StoryObj } from "@storybook/react"; | ||
import { EmptyStateCard, EmptyStateCardProps } from "./EmptyStateCard"; | ||
import { Button } from "../Button"; | ||
import { getDesignTokensControl } from "../utilities/storybook"; | ||
|
||
type Story = StoryObj<typeof EmptyStateCard>; | ||
|
||
const Template = (args: EmptyStateCardProps) => { | ||
const { children, ...restArgs } = args; | ||
return <EmptyStateCard {...restArgs}>{children}</EmptyStateCard>; | ||
}; | ||
|
||
const meta: Meta<typeof EmptyStateCard> = { | ||
title: "Components/Cards/EmptyStateCard", | ||
component: EmptyStateCard, | ||
argTypes: { | ||
blockGap: getDesignTokensControl("space.{alias}"), | ||
textGap: getDesignTokensControl("space.{alias}"), | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
export const Gap: Story = { | ||
render: Template.bind({}), | ||
args: { | ||
children: ( | ||
<> | ||
<EmptyStateCard.Header> | ||
<EmptyStateCard.HeaderText> | ||
Shipment Insurance | ||
</EmptyStateCard.HeaderText> | ||
</EmptyStateCard.Header> | ||
<EmptyStateCard.Body> | ||
<EmptyStateCard.BodyText> | ||
Rest easy knowing if one of your customers orders is damaged, lost | ||
in transit or stolen you are covered! Automatically add insurance to | ||
all your shipments | ||
</EmptyStateCard.BodyText> | ||
</EmptyStateCard.Body> | ||
<EmptyStateCard.Action> | ||
<Button>Manage Insurance Settings</Button> | ||
</EmptyStateCard.Action> | ||
</> | ||
), | ||
blockGap: "2", | ||
textGap: "1", | ||
}, | ||
parameters: { | ||
controls: { | ||
include: ["blockGap", "textGap"], | ||
}, | ||
}, | ||
}; | ||
|
||
export const Position: Story = { | ||
render: Template.bind({}), | ||
args: { | ||
children: ( | ||
<> | ||
<EmptyStateCard.Header> | ||
<EmptyStateCard.HeaderText>Analytics</EmptyStateCard.HeaderText> | ||
</EmptyStateCard.Header> | ||
<EmptyStateCard.Body> | ||
<EmptyStateCard.BodyText> | ||
Start shipping to get insights on your shipping costs and | ||
performance. | ||
</EmptyStateCard.BodyText> | ||
</EmptyStateCard.Body> | ||
<EmptyStateCard.Action> | ||
<Button>Buy a Label</Button> | ||
</EmptyStateCard.Action> | ||
</> | ||
), | ||
contentAlignment: "center", | ||
}, | ||
parameters: { | ||
controls: { | ||
include: ["contentAlignment"], | ||
}, | ||
}, | ||
}; |
Oops, something went wrong.