How Credenza works: Responsive Modal and Drawer
mainCredenza is a responsive component that automatically switches its UI pattern based on the screen size. It uses a MOBILE_BREAKPOINT of 768px to determine behavior:
- Desktop (>= 768px): Renders as a standard
Dialog(modal). - Mobile (< 768px): Renders as a
Drawer(bottom sheet).
It uses a CredenzaContext to share the isMobile state across all sub-components (CredenzaTrigger, CredenzaContent, etc.), ensuring that the entire component tree switches to the appropriate primitive (Dialog vs. Drawer) simultaneously.