Caution
This repository hosts a project completed as part of my OpenClassrooms training program. Having successfully completed the program, the project has now been archived and will no longer be actively maintained. Please be aware that while the repository will remain accessible for reference, some links or features may no longer function as intended.
In this project, I was required to select and convert a plugin from this project to React. I opted to recreate a dialog plugin.
This dialog, along with its variants, is built on top of the Radix Dialog and Radix Alert Dialog primitives to ensure accessibility. For styling, I've used Tailwind CSS.
pnpm install @oc-wh/react-dialog
An interruptive modal dialog presenting important content and expecting a user response.
-
Imports
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from '@oc-wh/react-dialog'
-
Anatomy
<AlertDialog> <AlertDialogTrigger></AlertDialogTrigger> <AlertDialogContent> <AlertDialogHeader> <AlertDialogTitle></AlertDialogTitle> <AlertDialogDescription></AlertDialogDescription> </AlertDialogHeader> <AlertDialogFooter> <AlertDialogCancel></AlertDialogCancel> <AlertDialogAction></AlertDialogAction> </AlertDialogFooter> </AlertDialogContent> </AlertDialog>
A window overlaying either the primary window or another dialog window, rendering the underlying content inactive.
-
Imports
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger, } from '@oc-wh/react-dialog'
-
Anatomy
<Dialog> <DialogTrigger></DialogTrigger> <DialogContent> <DialogHeader> <DialogTitle></DialogTitle> <DialogDescription></DialogDescription> </DialogHeader> </DialogContent> </Dialog>
An extension of the Dialog component, displaying complementary content to the main content of the screen.
-
Imports
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, SheetTrigger, } from '@oc-wh/react-dialog'
-
Anatomy
<Sheet> <SheetTrigger></SheetTrigger> <SheetContent> <SheetHeader> <SheetTitle></SheetTitle> <SheetDescription></SheetDescription> </SheetHeader> </SheetContent> </Sheet>
Use the side
property on the <SheetContent />
to specify the screen edge where the component will appear. Acceptable values are top
, right
, bottom
, or left
.
All components are fully customizable with the className
property. When using Tailwind CSS
, the plugin employs clsx and Tailwind merge. This allows you to use all the Tailwind CSS classes without bloating your bundle size.
This project is licensed under the MIT License. For more details, see the LICENSE file.