-
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.
feat(empty-state): add EmptyStateActions and EmptyStateIllustration c…
…omponents (#1592)
- Loading branch information
Showing
20 changed files
with
148 additions
and
36 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
29 changes: 29 additions & 0 deletions
29
packages/components/src/empty-state/empty-state-actions.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,29 @@ | ||
import type { ComponentPropsWithoutRef } from 'react' | ||
import React from 'react' | ||
import { forwardRef } from '@vtex/shoreline-utils' | ||
import { Compose } from '@vtex/shoreline-primitives' | ||
|
||
/** | ||
* Empty actions section | ||
* @status stable | ||
*/ | ||
export const EmptyStateActions = forwardRef< | ||
HTMLDivElement, | ||
EmptyStateActionsProps | ||
>(function EmptyStateActions(props, ref) { | ||
const { asChild = false, ...otherProps } = props | ||
const Comp = asChild ? Compose : 'div' | ||
|
||
return <Comp data-sl-empty-state-actions ref={ref} {...otherProps} /> | ||
}) | ||
|
||
export interface EmptyStateActionsOptions { | ||
/** | ||
* Children composition | ||
* @default false | ||
*/ | ||
asChild?: boolean | ||
} | ||
|
||
export type EmptyStateActionsProps = EmptyStateActionsOptions & | ||
ComponentPropsWithoutRef<'div'> |
29 changes: 29 additions & 0 deletions
29
packages/components/src/empty-state/empty-state-illustration.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,29 @@ | ||
import type { ComponentPropsWithoutRef } from 'react' | ||
import React from 'react' | ||
import { forwardRef } from '@vtex/shoreline-utils' | ||
import { Compose } from '@vtex/shoreline-primitives' | ||
|
||
/** | ||
* EmptyState illustration section | ||
* @status stable | ||
*/ | ||
export const EmptyStateIllustration = forwardRef< | ||
HTMLDivElement, | ||
EmptyStateIllustrationProps | ||
>(function EmptyStateIllustration(props, ref) { | ||
const { asChild = false, ...otherProps } = props | ||
const Comp = asChild ? Compose : 'div' | ||
|
||
return <Comp data-sl-empty-state-illustration ref={ref} {...otherProps} /> | ||
}) | ||
|
||
export interface EmptyStateIllustrationOptions { | ||
/** | ||
* Children composition | ||
* @default false | ||
*/ | ||
asChild?: boolean | ||
} | ||
|
||
export type EmptyStateIllustrationProps = EmptyStateIllustrationOptions & | ||
ComponentPropsWithoutRef<'div'> |
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 |
---|---|---|
@@ -1 +1,3 @@ | ||
export * from './empty-state' | ||
export * from './empty-state-actions' | ||
export * from './empty-state-illustration' |
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
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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import React from 'react' | ||
import { Button, EmptyState, Heading, Slot } from '@vtex/shoreline' | ||
import { Button, EmptyState, Heading, EmptyStateActions } from '@vtex/shoreline' | ||
|
||
export default function Example() { | ||
return ( | ||
<EmptyState> | ||
<Heading>Title goes here</Heading> | ||
<Slot name="actions"> | ||
<EmptyStateActions> | ||
<Button variant="primary">label</Button> | ||
</Slot> | ||
</EmptyStateActions> | ||
</EmptyState> | ||
) | ||
} |
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 @@ | ||
{ | ||
"empty-state-actions": "EmptyStateActions", | ||
"empty-state-illustration": "EmptyStateIllustration" | ||
} |
7 changes: 7 additions & 0 deletions
7
packages/docs/pages/components/empty-state/empty-state-actions.mdx
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,7 @@ | ||
# EmptyStateActions | ||
|
||
<ComponentDescription name="empty-state-actions" /> | ||
|
||
## Optional props | ||
|
||
<PropsDocs name="empty-state-actions" /> |
7 changes: 7 additions & 0 deletions
7
packages/docs/pages/components/empty-state/empty-state-illustration.mdx
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,7 @@ | ||
# EmptyStateIllustration | ||
|
||
<ComponentDescription name="empty-state-illustration" /> | ||
|
||
## Optional props | ||
|
||
<PropsDocs name="empty-state-illustration" /> |
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,17 @@ | ||
# API Reference | ||
|
||
<ComponentDescription name="page-header-row" /> | ||
|
||
```jsx | ||
<Page> | ||
<PageHeader> | ||
<PageHeaderRow> | ||
<PageHeading>Title</PageHeading> | ||
</PageHeaderRow> | ||
</PageHeader> | ||
</Page> | ||
``` | ||
|
||
## Optional props | ||
|
||
<PropsDocs name="page-header-row" /> |
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