Skip to content

Commit

Permalink
Merge branch 'main' into caleb/otp-delay
Browse files Browse the repository at this point in the history
  • Loading branch information
RobChangCA authored Jan 27, 2025
2 parents e77b059 + 80a0132 commit 1cff615
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @moldy530 @rthomare @dancoombs @mokok123 @dphilipson @linnall @adamegyed @howydev @zer0dot @jaypaik @blu-j @noam-alchemy @jakehobbs
* @moldy530 @rthomare @dancoombs @mokok123 @dphilipson @linnall @adamegyed @howydev @zer0dot @jaypaik @blu-j @noam-alchemy @jakehobbs @archit2407
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export const CompletingOAuth = () => {
provider={authStep.config.authProviderId}
auth0Connection={authStep.config.auth0Connection}
logoUrl={authStep.config.logoUrl}
logoUrlDark={authStep.config.logoUrlDark}
/>
}
/>
Expand Down
20 changes: 18 additions & 2 deletions account-kit/react/src/components/auth/sections/OAuth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,25 @@ export const OAuth = memo(({ ...config }: Props) => {
return (
<Button
variant="social"
icon={<img src={config.logoUrl} alt={config.auth0Connection} />}
icon={
<>
<img
src={config.logoUrl}
alt={config.auth0Connection}
className="dark:hidden"
/>
<img
// Fallback to light logo if no dark logo provided.
src={config.logoUrlDark ?? config.logoUrl}
alt={config.auth0Connection}
className="hidden dark:block"
/>
</>
}
onClick={authenticate}
></Button>
>
{config.displayName}
</Button>
);
default:
assertNever(
Expand Down
2 changes: 2 additions & 0 deletions account-kit/react/src/components/auth/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ export type AuthType =
auth0Connection?: string;
displayName: string;
logoUrl: string;
logoUrlDark?: string;
}
| {
authProviderId: KnownAuthProvider;
isCustomProvider?: false;
auth0Connection?: never;
displayName?: never;
logoUrl?: never;
logoUrlDark?: never;
}
) &
OauthRedirectConfig);
Expand Down
11 changes: 10 additions & 1 deletion account-kit/react/src/icons/oauth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ interface ContinueWithOAuthProps {
interface OAuthConnectionFailedWithProps {
provider: KnownAuthProvider;
logoUrl?: string;
logoUrlDark?: string;
auth0Connection?: string;
}

Expand All @@ -27,6 +28,7 @@ export function ContinueWithOAuth({ provider }: ContinueWithOAuthProps) {
export function OAuthConnectionFailed({
provider,
logoUrl,
logoUrlDark,
auth0Connection,
}: OAuthConnectionFailedWithProps) {
return (
Expand All @@ -52,7 +54,14 @@ export function OAuthConnectionFailed({
{(provider === "google" && <GoogleIcon />) ||
(provider === "facebook" && <FacebookIcon />) ||
(provider === "auth0" && logoUrl && (
<img src={logoUrl} alt={auth0Connection} />
<>
<img src={logoUrl} alt={auth0Connection} className="dark:hidden" />
<img
src={logoUrlDark ?? logoUrl}
alt={auth0Connection}
className="hidden dark:block"
/>
</>
))}
</div>
);
Expand Down
3 changes: 3 additions & 0 deletions examples/ui-demo/public/images/twitter-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/ui-demo/src/app/sections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export function getSectionsForConfig(
auth0Connection: "twitter",
displayName: "X",
logoUrl: "/images/twitter.svg",
logoUrlDark: "/images/twitter-dark.svg",
scope: "openid profile",
});

Expand Down
2 changes: 1 addition & 1 deletion examples/ui-demo/src/components/icons/discord.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const DiscordLogo = ({
xmlns="http://www.w3.org/2000/svg"
{...props}
>
<g clip-path="url(#a)">
<g clipPath="url(#a)">
<path
d="M15.9785 0H5.35352C2.76468 0 .666016 2.09867.666016 4.6875v10.625C.666016 17.9013 2.76468 20 5.35352 20H15.9785c2.5889 0 4.6875-2.0987 4.6875-4.6875V4.6875C20.666 2.09867 18.5674 0 15.9785 0Z"
fill="#5865F2"
Expand Down
2 changes: 2 additions & 0 deletions site/pages/react/ui-components.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ type SocialAuthType = {
auth0Connection?: string;
// URL for the provider's logo
logoUrl: string;
// URL for the provider's logo in dark mode (optional, `logoUrl` is used for both light & dark mode if not provided)
logoUrlDark?: string;
}
| {
// For using a known authentication provider other than Auth0: "google", "facebook", "apple"
Expand Down

0 comments on commit 1cff615

Please sign in to comment.