Skip to content

feat(ui-components): implement Modal component with headlessui - #54044

Merged
ahmaxed merged 8 commits into
freeCodeCamp:mainfrom
huyenltnguyen:feat/modal-implementation-headless-ui
Mar 14, 2024
Merged

ahmaxed merged 8 commits into
freeCodeCamp:mainfrom
huyenltnguyen:feat/modal-implementation-headless-ui

Conversation

@huyenltnguyen

@huyenltnguyen huyenltnguyen commented Mar 11, 2024 •

Copy link
Copy Markdown
Member

Checklist:

This PR:

I decided to switch because:

  • @radix-ui/react-dialog comes with a Trigger component, which is responsible for 'triggering' the modal appearance. In order for the Modal to behave properly, we are required to include this Trigger in the Modal implementation. This is unfortunately not compatible with our use cases, as we want to give the consumers total control of the Modal appearance via the open prop, and the prop should be the single source of truth for the open/close state
  • The pieces that we need to put together are a little cumbersome, compared to headlessui's
  • The headlessui Modal is more customizable, and its documentation is more comprehensive
  • We already use headlessui in ui-components, so we can just keep using it instead of introducing another dependency

Screenshots

Screenshots of the Modal component
Light Dark
Default Screenshot 2024-03-11 at 15 28 47 Screenshot 2024-03-11 at 15 28 57
Large Screenshot 2024-03-11 at 15 29 42 Screenshot 2024-03-11 at 15 29 51
Danger Screenshot 2024-03-11 at 15 30 38 Screenshot 2024-03-11 at 15 30 28
Without close button Screenshot 2024-03-11 at 15 31 16 Screenshot 2024-03-11 at 15 31 25
Transition transition transition

@github-actions github-actions Bot added the scope: tools/scripts Scripts for supporting dev work, generating config and build artifacts, etc. label Mar 11, 2024
@huyenltnguyen
huyenltnguyen force-pushed the feat/modal-implementation-headless-ui branch from 0202513 to 17b5b4a Compare March 11, 2024 07:59
@huyenltnguyen huyenltnguyen changed the title feat(ui-components): implement Modal component with headless-ui feat(ui-components): implement Modal component with headlessui Mar 11, 2024
Co-authored-by: Sboonny <[email protected]>
@huyenltnguyen
huyenltnguyen force-pushed the feat/modal-implementation-headless-ui branch from 17b5b4a to 28b6e41 Compare March 11, 2024 09:20
Comment thread tools/ui-components/tailwind.config.js Resolved
Comment thread tools/ui-components/src/modal/types.ts Resolved
Comment thread tools/ui-components/src/modal/modal.tsx Resolved
Comment thread tools/ui-components/src/modal/modal.tsx Resolved
Comment thread tools/ui-components/src/modal/modal.tsx Resolved
@huyenltnguyen
huyenltnguyen marked this pull request as ready for review March 11, 2024 15:48
@huyenltnguyen
huyenltnguyen requested a review from a team March 11, 2024 15:48
@ahmaxed

ahmaxed commented Mar 14, 2024

Copy link
Copy Markdown
Member

Might be unrelated but the close button does not change color on hover.

@ahmaxed
ahmaxed enabled auto-merge (squash) March 14, 2024 09:44
@ahmaxed
ahmaxed merged commit ce2bb3a into freeCodeCamp:main Mar 14, 2024
@huyenltnguyen
huyenltnguyen deleted the feat/modal-implementation-headless-ui branch March 19, 2024 04:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: tools/scripts Scripts for supporting dev work, generating config and build artifacts, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[UI Components] Create Modal component

3 participants