Skip to content
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

πŸͺ„ Adds type safety for CareIcon names + ✨ reduced index.css size by 95% + Refactor string interpolated tw classes #6034

Merged
merged 8 commits into from
Aug 9, 2023

Conversation

rithviknishad
Copy link
Member

@rithviknishad rithviknishad commented Aug 9, 2023

WHAT

πŸ€– Generated by Copilot at 3ff1fd2

This pull request improves the UI components and icons used in various screens of the application. It refactors the CareIcon, Chip, CountBlock, and ButtonV2 components to use the Unicon icon library, the IconName type, and the variant prop for consistent and type-safe styling. It also simplifies the code for generating class names and removes unnecessary props. It updates the components that use these common UI elements to reflect the changes and to enhance the appearance and functionality. It moves the Chip and CountBlock components from ./src/CAREUI/display to ./src/Components/Common/components to make them more accessible.

Proposed Changes

Updated usage of CareIcon

<CareIcon icon="l-hospital" className="text-lg" />

Backwards compatible too

<CareIcon className="care-l-hospital text-lg" />

@coronasafe/care-fe-code-reviewers @coronasafe/code-reviewers

Merge Checklist

  • Add specs that demonstrate bug / test a new feature.
  • Update product documentation.
  • Ensure that UI text is kept in I18n files.
  • Prep screenshot or demo video for changelog entry, and attach it to issue.
  • Request for Peer Reviews
  • Completion of QA

HOW

πŸ€– Generated by Copilot at 3ff1fd2

  • Move Chip and CountBlock components to ./src/Components/Common/components folder to make them reusable (link, link)
  • Refactor CareIcon component to accept icon prop of type IconName and use effectiveClassName variable for icon transformation and re-rendering (link, link)
  • Use IconName type and Unicon icons for FACILITY_FEATURE_TYPES array in ./src/Common/constants.tsx (link, link)
  • Replace color prop with variant prop and use Unicon icons for Chip component in various components (link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link)
  • Use CountBlock component and Unicon icons for displaying total counts in various components (link, link, link, link, link)
  • Import ButtonVariant type from ./src/Components/Common/components/ButtonV2 to ./src/Components/Common/PatientCategoryBadge.tsx for defining PATIENT_CATEGORIES array (link)
  • Remove align prop from ButtonV2 component and its type definition as it was causing layout issues (link, link, link)
  • Use variant prop and classNames helper function for icon color in DropdownItem component in ./src/Components/Common/components/Menu.tsx (link)
  • Use classNames helper function for generating dynamic class names in FacilityCard component in ./src/Components/Facility/FacilityCard.tsx and PatientCategorySelect component in ./src/Components/Patient/PatientCategorySelect.tsx (link, link, link, link)
  • Use ButtonV2 component and wrap icon and text in a div element with flex classes for alignment in PrescriptionBuilder component in ./src/Components/Medicine/PrescriptionBuilder.tsx and various components in ./src/Components/Patient/PatientHome.tsx (link, link, link, link, link, link, link, link, link, link, link, link, link)
  • Remove align prop from ButtonV2 component in ./src/Components/Patient/PatientInfoCard.tsx (link)
  • Wrap icon and text in a span element with flex classes for alignment in ButtonV2 component in ./src/Components/Patient/PatientInfoCard.tsx (link, link)

@rithviknishad rithviknishad requested a review from a team August 9, 2023 07:30
@rithviknishad rithviknishad requested a review from a team as a code owner August 9, 2023 07:30
@vercel
Copy link

vercel bot commented Aug 9, 2023

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Comments Updated (UTC)
care-storybook βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Aug 9, 2023 11:00am

@netlify
Copy link

netlify bot commented Aug 9, 2023

βœ… Deploy Preview for care-egov-staging ready!

Name Link
πŸ”¨ Latest commit 665590c
πŸ” Latest deploy log https://app.netlify.com/sites/care-egov-staging/deploys/64d371caedcabd0008796403
😎 Deploy Preview https://deploy-preview-6034--care-egov-staging.netlify.app
πŸ“± Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@rithviknishad rithviknishad added needs testing Major Code Change This Tag represent PR, which will be causing major Code change in the platform labels Aug 9, 2023
@rithviknishad rithviknishad changed the title πŸͺ„ Adds type safety for CareIcon names + Refactor string interpolated tw classes + ✨ index.css down -7.6mb πŸͺ„ Adds type safety for CareIcon names + ✨ reduced index.css size by 95% + Refactor string interpolated tw classes Aug 9, 2023
@nihal467
Copy link
Member

nihal467 commented Aug 9, 2023

LGTM

@khavinshankar khavinshankar merged commit dc129fb into develop Aug 9, 2023
24 checks passed
@khavinshankar khavinshankar deleted the rm-tailwind-safelist branch August 9, 2023 11:37
@github-actions
Copy link

github-actions bot commented Aug 9, 2023

@rithviknishad We truly appreciate your efforts. Thank you for taking the time to contribute; this is a very valuable contribution to us πŸ₯‡. We always welcome your contribution πŸ™‚, so feel free to contribute to anything anytime, and never lose that spirit of innovation πŸ™Œ.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cypress passed Major Code Change This Tag represent PR, which will be causing major Code change in the platform tested
Projects
None yet
4 participants