import styled, { css } from 'styled-components'; import { spacing } from '../../spacing'; import { Button } from '../buttonv2/Buttonv2.component'; import { Icon, IconName } from '../icon/Icon.component'; import { LargeText } from '../text/Text.component'; import { CoreUITheme } from '../../style/theme'; import { useNavigate } from 'react-router'; export type Props = { listedResource: { singular: string; plural: string; }; icon: IconName; link?: string; backgroundColor?: keyof CoreUITheme; /** * The resource to create before browsing the listed resource * Only used when resource to create is different from listed resource */ resourceToCreate?: string; }; const EmptystateContainer = styled.div<{ backgroundColor?: keyof CoreUITheme }>` ${(props) => { const { theme, backgroundColor } = props; return css` color: ${theme.textSecondary}; background-color: ${backgroundColor ? theme[backgroundColor] : 'transparent'}; `; }} display: flex; flex-direction: column; width: 100%; padding-top: 10%; `; export const EmptyStateRow = styled.div` display: flex; justify-content: space-around; margin-bottom: ${spacing.r24}; `; export const ActionWrapper = styled.div` display: flex; justify-content: space-around; `; function EmptyState(props: Props) { const { icon, listedResource, link, resourceToCreate, backgroundColor } = props; const navigate = useNavigate(); return ( {`A list of ${listedResource.plural} will appear here.`} {!resourceToCreate ? `There are no ${listedResource.plural} created yet, let's create your first ${listedResource.singular}.` : `Before browsing your ${listedResource.plural}, create your first ${resourceToCreate}.`} {link && (