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

feat: add UI config defaults, better back navigation to auth UI #827

Merged
merged 4 commits into from
Jul 12, 2024

Conversation

bswags
Copy link
Contributor

@bswags bswags commented Jul 10, 2024

Now that we have a useUiConfig hook for reading the provided UI configuration from the context, we can use it as a central place to set some configuration defaults that will be shared across the UI components. This also allows us to have fewer optional/nullable values and results in cleaner code.

Additionally, this PR cleans up the "go back" implementation in the auth components.

Pull Request Checklist


PR-Codex overview

This PR updates how UI configurations are handled in the Account Kit React components.

Detailed summary

  • Refactored UI configuration handling in components
  • Simplified use of UI configurations
  • Removed unnecessary props from illustration components

The following files were skipped due to too many changes: account-kit/react/src/components/auth/card/add-passkey.tsx, account-kit/react/src/icons/illustrations/added-passkey.tsx, account-kit/react/src/components/auth/card/index.tsx, account-kit/react/src/icons/illustrations/passkeys.tsx

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Copy link

vercel bot commented Jul 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
aa-sdk-site ❌ Failed (Inspect) Jul 11, 2024 10:44pm
aa-sdk-ui-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 11, 2024 10:44pm

@@ -49,7 +49,7 @@ export const AddPasskey = () => {
{BENEFITS.map(({ title, icon: Icon, description }) => (
<div key={title} className="flex gap-2">
<div className="h-5 w-5 flex items-center justify-center">
<Icon illustrationStyle={illustrationStyle ?? "flat"} />
<Icon illustrationStyle={illustrationStyle} />
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@moldy530 if you'd prefer I can move reading this from the hook into the icon components; it felt a bit weird to have icon components that read from a context to configure themselves but it could also be... not that weird, defer to you

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea I was thinking about that too, but since all of the components we're building are meant to be used internally I think it's ok since it removes a good bit of boilerplate

const canGoBack = useMemo(() => {
return ["email_verify"].includes(authStep.type);
return ["email_verify", "passkey_verify"].includes(authStep.type);
}, [authStep]);

const onBack = useCallback(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should also clear the QP (or at least the bundle QP)

@bswags bswags merged commit 14941f1 into v4.x.x Jul 12, 2024
5 of 6 checks passed
@bswags bswags deleted the brian/defaults-and-nav branch July 12, 2024 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants