-
Notifications
You must be signed in to change notification settings - Fork 0
[SSF-206] Add empty state components for dashboard #181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| import React from 'react'; | ||
| import { Box, Button } from '@chakra-ui/react'; | ||
| import { CircleCheck } from 'lucide-react'; | ||
| import { useNavigate } from 'react-router-dom'; | ||
|
|
||
| interface PageEmptyStateProps { | ||
| entity?: string; | ||
| subtitle?: string; | ||
| primaryButtonText: string; | ||
| primaryButtonLink: string; | ||
| secondaryButtonText: string; | ||
| secondaryButtonLink: string; | ||
| } | ||
|
|
||
| const PageEmptyState: React.FC<PageEmptyStateProps> = ({ | ||
| entity, | ||
| subtitle, | ||
| primaryButtonText, | ||
| primaryButtonLink, | ||
| secondaryButtonText, | ||
| secondaryButtonLink, | ||
| }) => { | ||
| const navigate = useNavigate(); | ||
| const message = subtitle ?? `You have no ${entity} at this time`; | ||
|
|
||
| return ( | ||
| <Box | ||
| display="flex" | ||
| flexDirection="column" | ||
| alignItems="center" | ||
| justifyContent="center" | ||
| textAlign="center" | ||
| fontFamily="'Inter', sans-serif" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. our repo theme already maps this line using fonts.inter - can you use that instead? |
||
| fontSize="sm" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we also have project pixel defined scale values of textStyle = "p/ p2/ p3/ h4" ~ consider which one would fit the best for this size! |
||
| color="neutral.600" | ||
| py={10} | ||
| gap={2} | ||
| > | ||
| <Box mb={2}> | ||
| <CircleCheck size={24} color="#262626" /> | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use neutral.800 here! |
||
| </Box> | ||
| <Box fontWeight="600" fontSize="lg" color="neutral.800"> | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use for text content - it's also what makes the testStyle work! |
||
| Nothing to see here. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit - designs end with exclamation mark instead of period |
||
| </Box> | ||
| <Box color="neutral.700" fontWeight="400"> | ||
| {message} | ||
| </Box> | ||
| <Box display="flex" gap={3} mt={4}> | ||
| <Button | ||
| bg="neutral.700" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we make this size=sm to match the thinner designed buttons? nice job using our repo frontend values here~ |
||
| color="white" | ||
| _hover={{ bg: 'neutral.800' }} | ||
| onClick={() => navigate(primaryButtonLink)} | ||
| > | ||
| {primaryButtonText} | ||
| </Button> | ||
| <Button | ||
| bg="neutral.300" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add size="sm" here too good example is the outline button in adminOrderManagement.tsx:387-394 - take their outline and border (variant="outline", borderColor="") use neutral.200 as border color. |
||
| color="neutral.700" | ||
| _hover={{ bg: 'neutral.50' }} | ||
| onClick={() => navigate(secondaryButtonLink)} | ||
| > | ||
| {secondaryButtonText} | ||
| </Button> | ||
| </Box> | ||
| </Box> | ||
| ); | ||
| }; | ||
|
|
||
| export default PageEmptyState; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import { Box } from '@chakra-ui/react'; | ||
| import { CircleCheck } from 'lucide-react'; | ||
|
|
||
| interface EmptyStateProps { | ||
| entity?: string; | ||
| subtitle?: string; | ||
| } | ||
|
|
||
| const SectionEmptyState: React.FC<EmptyStateProps> = ({ entity, subtitle }) => { | ||
| const message = subtitle ?? `You have no ${entity} at this time.`; | ||
| return ( | ||
| <Box | ||
| display="flex" | ||
| flexDirection="column" | ||
| alignItems="center" | ||
| justifyContent="center" | ||
| textAlign="center" | ||
| fontFamily="'Inter', sans-serif" | ||
| fontSize="sm" | ||
| color="neutral.600" | ||
| py={10} | ||
| gap={2} | ||
| > | ||
| <Box mb={2}> | ||
| <CircleCheck size={24} color="#262626" /> | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: designs don't have the circle check for section empty states! |
||
| </Box> | ||
| <Box fontWeight="600" fontSize="lg" color="neutral.800"> | ||
| Nothing to see here. | ||
| </Box> | ||
| <Box color="neutral.700" fontWeight="400"> | ||
| {message} | ||
| </Box> | ||
| </Box> | ||
| ); | ||
| }; | ||
|
|
||
| export default SectionEmptyState; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make sure you implement the empty-state dashboard for FMs too Edit: Sorry, just realized the FM dashboard isn't merged yet. Not sure if we want to wait to merge this PR until we can also add an empty state for the FM dashboard.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes fm dashboard should be in soon~ let's wait to merge until we can add empty state there! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
our files are named in camelCase~ could you rename the empty state files accordingly?