Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive 'Full Customization Demo' to the shadcn example, featuring a complete authentication flow with three switchable themes (Doggo, Coffee Spark, and Grid). The implementation includes custom components, step-by-step forms for login, sign-up, phone authentication, and multi-factor authentication (MFA) enrollment, as well as lazy loading with error boundaries. The code review identified several improvement opportunities: adding an ESLint disable comment for a deliberate empty dependency array in useEffect, addressing potential runtime crashes in reauth.tsx by replacing non-null assertions with defensive null checks, and refactoring the initialization of state with the useDefaultCountry hook to avoid executing it on every render.
…the Professional theme The resolver cleanup now lives on a stable host, so switching theme mid-challenge no longer cancels the sign in, and the reauth hooks move to a shared module to break an import cycle. Also shows email link errors on the link screen, uses a solid focus ring, native radios for factor choice, a described and highlighted password mismatch, the example's dark mode toggle, and a confirm step before removing a factor.
… demo Ports the Professional theme from the shadcn demo with native elements and Material Symbols icons, moves reauth into a shared module so both dialog styles use one flow, keeps the MFA challenge across theme switches, and centres the themed reauth dialog.
russellwheatley
left a comment
There was a problem hiding this comment.
A few small things below, mainly the theme count copy.
| <ItemContent> | ||
| <ItemTitle>Full Customization Demo</ItemTitle> | ||
| <ItemDescription className="text-xs"> | ||
| A complete sign in flow built from this example's shadcn/ui components, with three switchable themes. |
There was a problem hiding this comment.
This says three themes, but with Professional there are four now. Same text in examples/react/src/App.tsx too.
There was a problem hiding this comment.
Updated to four in both examples.
| // The full customization demo draws its own chrome, so the example-wide toggles stay out of its way. | ||
| function GlobalToggles() { | ||
| const { pathname } = useLocation(); | ||
| if (pathname.startsWith("/full-customization")) return null; |
There was a problem hiding this comment.
Professional follows the light/dark toggle, but the toggle is hidden on this route, so you have to go back to the example list to try dark mode. Might be worth keeping just the light/dark toggle here, or adding it to the theme switcher?
There was a problem hiding this comment.
Added a light/dark toggle to the theme switcher while Professional is active, since it's the only theme that uses it.
| class ChunkErrorBoundary extends Component<{ children: ReactNode }, { failed: boolean }> { | ||
| state = { failed: false }; | ||
|
|
||
| static getDerivedStateFromError() { |
There was a problem hiding this comment.
This catches every render error in the demo, not only a failed chunk, so a runtime bug would show up as "failed to load". Fine for an example, maybe just reword to "Something went wrong" or log the error.
There was a problem hiding this comment.
Reworded to "Something went wrong" and it now logs the error.
…idy the demo copy The example's light/dark toggle is hidden on the demo route, so the theme switcher gets its own while Professional is active, fitted to phone widths. Also counts four themes on the example list and has the demo error boundary log the error and say something went wrong rather than blaming a failed load.
Adds the full customization demo to the shadcn example, the shadcn/ui counterpart of the React demo. The screens and auth logic carry over unchanged, the UI is built from this example's shadcn/ui components, and each Figma theme becomes a set of shadcn theme variables.
Changes
/full-customizationroute with the same flows as the React demo: email entry, login, sign up, phone, MFA challenge and enrollment, reauthentication and an account page.Button,Input,Card,Select,InputOTPand a newDialog. Each theme sets--primary,--secondary,--radiusand the rest, plus a few extras shadcn has no token for, such as hard offset shadows.<body>so the portalled dialog and country menu are themed too. The route is lazy loaded and hides the global toggles.Preview
fc-shadcn-themes.mp4
fc-shadcn-email-sign-in.mp4
fc-shadcn-phone-sign-in.mp4
fc-shadcn-two-factor.mp4
fc-shadcn-professional.mp4
fc-shadcn-professional-dark.mp4
fc-react-professional.mp4
fc-react-professional-dark.mp4
Maintainer note: Fixes internal CPRN-661