@dt-dds/react-empty-state
v1.0.0-beta.125
Published
This package fills the width of the container where is placed and its height varies depending on the content in it. The usage of this package is to show a message to the user when there is no data to display. Furthermore, it can be used to show additional
Readme
EmptyState Package
This package fills the width of the container where is placed and its height varies depending on the content in it. The usage of this package is to show a message to the user when there is no data to display. Furthermore, it can be used to show additional information like a button, a link or an image as children.
Usage
import { EmptyState } from '@dt-dds/react';
export const App = () => {
const title = 'Some Title';
const description = 'Some Description';
return (
<EmptyState>
<img />
<EmptyState.Content title={title} description={description} />
<Button onClick={() => {}} variant='solid'>
Action
</Button>
</EmptyState>
);
};API
EmptyState
| Property | Type | Default | Description |
| ------------ | --------------------- | --------------- | ------------------------------------------------- |
| children | ReactNode | - | Child components to be rendered. |
| dataTestId | string | 'empty-state' | Customizable test identifier. |
| style | React.CSSProperties | - | Gives the EmptyState some specific css properties |
EmptyState.Content
| Property | Type | Default | Description |
| ------------- | --------------------- | ----------------------- | -------------------------------------------------------------------------- |
| dataTestId | string | 'empty-state-content' | Customizable test identifier. |
| style | React.CSSProperties | - | Gives the EmptyState Content some specific css properties |
| title | string | - | Text to be presented as Title within the Empty State. |
| description | ReactNode | - | Text/Custom element to be presented as Description within the Empty State. |
Stack
- TypeScript for static type checking
- React — JavaScript library for user interfaces
- Emotion — for writing css styles with JavaScript
- Storybook — UI component environment powered by Vite
- Jest - JavaScript Testing Framework
- React Testing Library - to test UI components in a user-centric way
- ESLint for code linting
- Prettier for code formatting
- Tsup — TypeScript bundler powered by esbuild
- Yarn from managing packages
Commands
yarn build- Build the packageyarn dev- Run the package locallyyarn lint- Lint all files within this packageyarn test- Run all unit testsyarn test:report- Open the test coverage reportyarn test:update:snapshot- Run all unit tests and update the snapshot
Compilation
Running yarn build from the root of the package will use tsup to compile the raw TypeScript and React code to plain JavaScript.
The /dist folder contains the compiled output.
empty-state
└── dist
├── index.d.ts <-- Types
├── index.js <-- CommonJS version
└── index.mjs <-- ES Modules version
...Versioning
Follows semantic versioning
© License
Licensed under MIT License
