Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Create a Reusable Empty State Component #158

Closed
8 tasks done
mahid797 opened this issue Jan 12, 2025 · 0 comments · Fixed by #166
Closed
8 tasks done

Create a Reusable Empty State Component #158

mahid797 opened this issue Jan 12, 2025 · 0 comments · Fixed by #166
Assignees
Labels
Frontend Frontend Related Issue UX/UI Change Highlights changes affecting user experience or interface design
Milestone

Comments

@mahid797
Copy link
Collaborator

mahid797 commented Jan 12, 2025

Develop a global reusable component for empty states that can be used across multiple pages, starting with the Contacts Page for the MVP. This component will display a central message, an optional icon/logo, and an optional button. It will serve as a placeholder for "No Data" scenarios.


Tasks

Component Development

  • Create a reusable EmptyState component with the following props:
    • message (required): A string to display as the central message.
    • icon (optional): A React component or MUI Icon to display above the message.
    • buttonText (optional): Text to display on an optional button.
    • buttonAction (optional): A function or URL for the button action.
    • children (optional): Custom JSX elements for more complex empty states (e.g., multiple buttons or additional text).

Component Behavior

  • The EmptyState component should:
    • Render the provided message in a visually prominent way.
    • Display the icon or logo above the message if provided.
    • Include a button below the message if buttonText and buttonAction are provided.
    • Render any children passed to it below the message, replacing the button if present.

Styling

  • Center-align the message, icon, and button within the container.
  • Use globalTheme for styling consistency (e.g., typography, spacing, and colors).
  • Ensure the component is responsive across tablet and desktop resolutions.

Implementation Guidelines

  • The parent component will handle the condition for displaying the empty state (e.g., passing a Boolean or checking data length). For example:
    {!data.length && <EmptyState message="No contacts found." icon={ContactsIcon} />}
  • Add an example implementation for the Contacts Page.

Testing

  • Manually test the component to ensure:
    • It displays correctly with all props provided.
    • It functions without optional props (e.g., no button or icon).
    • It renders properly when custom children are passed.

Deliverables

  • A reusable EmptyState component integrated into the Contacts Page.
  • Example usage documentation or inline comments for implementing the component on other pages.

Notes

@mahid797 mahid797 added New Feature New feature to be implemented Frontend Frontend Related Issue UX/UI Change Highlights changes affecting user experience or interface design labels Jan 12, 2025
@mahid797 mahid797 added this to the 1.0 milestone Jan 12, 2025
@SepidehShahbazi SepidehShahbazi linked a pull request Jan 16, 2025 that will close this issue
@mahid797 mahid797 removed the New Feature New feature to be implemented label Jan 16, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Frontend Frontend Related Issue UX/UI Change Highlights changes affecting user experience or interface design
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants