File size: 1,346 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
{
  "type": "composition",
  "npmDependencies": [],
  "fileDependencies": [],
  "id": "empty-state",
  "file": {
    "name": "empty-state.tsx",
    "content": "import { EmptyState as ChakraEmptyState, VStack } from \"@chakra-ui/react\"\nimport * as React from \"react\"\n\nexport interface EmptyStateProps extends ChakraEmptyState.RootProps {\n  title: string\n  description?: string\n  icon?: React.ReactNode\n}\n\nexport const EmptyState = React.forwardRef<HTMLDivElement, EmptyStateProps>(\n  function EmptyState(props, ref) {\n    const { title, description, icon, children, ...rest } = props\n    return (\n      <ChakraEmptyState.Root ref={ref} {...rest}>\n        <ChakraEmptyState.Content>\n          {icon && (\n            <ChakraEmptyState.Indicator>{icon}</ChakraEmptyState.Indicator>\n          )}\n          {description ? (\n            <VStack textAlign=\"center\">\n              <ChakraEmptyState.Title>{title}</ChakraEmptyState.Title>\n              <ChakraEmptyState.Description>\n                {description}\n              </ChakraEmptyState.Description>\n            </VStack>\n          ) : (\n            <ChakraEmptyState.Title>{title}</ChakraEmptyState.Title>\n          )}\n          {children}\n        </ChakraEmptyState.Content>\n      </ChakraEmptyState.Root>\n    )\n  },\n)\n"
  },
  "component": "EmptyState"
}