style: update OAuth buttons UI (#3061)

This commit is contained in:
Aaryan Khandelwal 2023-12-11 15:52:21 +05:30 committed by GitHub
parent 26d37fbd38
commit dd87bd0ee2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 41 additions and 35 deletions

View File

@ -8,12 +8,12 @@ import { useTheme } from "next-themes";
import githubBlackImage from "public/logos/github-black.svg"; import githubBlackImage from "public/logos/github-black.svg";
import githubWhiteImage from "public/logos/github-white.svg"; import githubWhiteImage from "public/logos/github-white.svg";
export interface GithubLoginButtonProps { type Props = {
handleSignIn: React.Dispatch<string>; handleSignIn: React.Dispatch<string>;
clientId: string; clientId: string;
} };
export const GithubLoginButton: FC<GithubLoginButtonProps> = (props) => { export const GitHubSignInButton: FC<Props> = (props) => {
const { handleSignIn, clientId } = props; const { handleSignIn, clientId } = props;
// states // states
const [loginCallBackURL, setLoginCallBackURL] = useState(undefined); const [loginCallBackURL, setLoginCallBackURL] = useState(undefined);

View File

@ -1,12 +1,12 @@
import { FC, useEffect, useRef, useCallback, useState } from "react"; import { FC, useEffect, useRef, useCallback, useState } from "react";
import Script from "next/script"; import Script from "next/script";
export interface IGoogleLoginButton { type Props = {
clientId: string; clientId: string;
handleSignIn: React.Dispatch<any>; handleSignIn: React.Dispatch<any>;
} };
export const GoogleLoginButton: FC<IGoogleLoginButton> = (props) => { export const GoogleSignInButton: FC<Props> = (props) => {
const { handleSignIn, clientId } = props; const { handleSignIn, clientId } = props;
// refs // refs
const googleSignInButton = useRef<HTMLDivElement>(null); const googleSignInButton = useRef<HTMLDivElement>(null);
@ -30,6 +30,7 @@ export const GoogleLoginButton: FC<IGoogleLoginButton> = (props) => {
size: "large", size: "large",
logo_alignment: "center", logo_alignment: "center",
text: "signin_with", text: "signin_with",
width: 384,
} as GsiButtonConfiguration // customization attributes } as GsiButtonConfiguration // customization attributes
); );
} catch (err) { } catch (err) {
@ -53,7 +54,7 @@ export const GoogleLoginButton: FC<IGoogleLoginButton> = (props) => {
return ( return (
<> <>
<Script src="https://accounts.google.com/gsi/client" async defer onLoad={loadScript} /> <Script src="https://accounts.google.com/gsi/client" async defer onLoad={loadScript} />
<div className="w-full overflow-hidden rounded" id="googleSignInButton" ref={googleSignInButton} /> <div className="!w-full overflow-hidden rounded" id="googleSignInButton" ref={googleSignInButton} />
</> </>
); );
}; };

View File

@ -1,5 +1,5 @@
export * from "./github-login-button"; export * from "./github-sign-in";
export * from "./google-login"; export * from "./google-sign-in";
export * from "./onboarding-form"; export * from "./onboarding-form";
export * from "./user-logged-in"; export * from "./user-logged-in";
export * from "./sign-in-forms"; export * from "./sign-in-forms";

View File

@ -7,7 +7,7 @@ import { AppConfigService } from "services/app-config.service";
// hooks // hooks
import useToast from "hooks/use-toast"; import useToast from "hooks/use-toast";
// components // components
import { GithubLoginButton, GoogleLoginButton } from "components/accounts"; import { GitHubSignInButton, GoogleSignInButton } from "components/accounts";
type Props = { type Props = {
handleSignInRedirection: () => Promise<void>; handleSignInRedirection: () => Promise<void>;
@ -73,12 +73,12 @@ export const OAuthOptions: React.FC<Props> = observer((props) => {
<p className="mx-3 flex-shrink-0 text-center text-sm text-onboarding-text-400">Or continue with</p> <p className="mx-3 flex-shrink-0 text-center text-sm text-onboarding-text-400">Or continue with</p>
<hr className="w-full border-onboarding-border-100" /> <hr className="w-full border-onboarding-border-100" />
</div> </div>
<div className="mx-auto flex flex-col items-center gap-2 overflow-hidden pt-7 sm:w-96 sm:flex-row"> <div className="mx-auto space-y-4 overflow-hidden pt-7 sm:w-96">
{envConfig?.google_client_id && ( {envConfig?.google_client_id && (
<GoogleLoginButton clientId={envConfig?.google_client_id} handleSignIn={handleGoogleSignIn} /> <GoogleSignInButton clientId={envConfig?.google_client_id} handleSignIn={handleGoogleSignIn} />
)} )}
{envConfig?.github_client_id && ( {envConfig?.github_client_id && (
<GithubLoginButton clientId={envConfig?.github_client_id} handleSignIn={handleGitHubSignIn} /> <GitHubSignInButton clientId={envConfig?.github_client_id} handleSignIn={handleGitHubSignIn} />
)} )}
</div> </div>
</> </>

View File

@ -20,7 +20,11 @@ export const LatestFeatureBlock = () => {
</Link> </Link>
</p> </p>
</div> </div>
<div className="mx-auto mt-8 overflow-hidden rounded-md border border-onboarding-border-200 bg-onboarding-background-100 object-cover sm:h-52 sm:w-96"> <div
className={`mx-auto mt-8 overflow-hidden rounded-md border border-onboarding-border-200 object-cover sm:h-52 sm:w-96 ${
resolvedTheme === "dark" ? "bg-onboarding-background-100" : "bg-custom-primary-70"
}`}
>
<div className="h-[90%]"> <div className="h-[90%]">
<Image <Image
src={latestFeatures} src={latestFeatures}

View File

@ -9,12 +9,12 @@ import { useTheme } from "next-themes";
import githubLightModeImage from "/public/logos/github-black.png"; import githubLightModeImage from "/public/logos/github-black.png";
import githubDarkModeImage from "/public/logos/github-dark.svg"; import githubDarkModeImage from "/public/logos/github-dark.svg";
export interface GithubLoginButtonProps { type Props = {
handleSignIn: React.Dispatch<string>; handleSignIn: React.Dispatch<string>;
clientId: string; clientId: string;
} };
export const GithubLoginButton: FC<GithubLoginButtonProps> = (props) => { export const GitHubSignInButton: FC<Props> = (props) => {
const { handleSignIn, clientId } = props; const { handleSignIn, clientId } = props;
// states // states
const [loginCallBackURL, setLoginCallBackURL] = useState(undefined); const [loginCallBackURL, setLoginCallBackURL] = useState(undefined);

View File

@ -1,12 +1,12 @@
import { FC, useEffect, useRef, useCallback, useState } from "react"; import { FC, useEffect, useRef, useCallback, useState } from "react";
import Script from "next/script"; import Script from "next/script";
export interface IGoogleLoginButton { type Props = {
handleSignIn: React.Dispatch<any>; handleSignIn: React.Dispatch<any>;
clientId: string; clientId: string;
} };
export const GoogleLoginButton: FC<IGoogleLoginButton> = (props) => { export const GoogleSignInButton: FC<Props> = (props) => {
const { handleSignIn, clientId } = props; const { handleSignIn, clientId } = props;
// refs // refs
const googleSignInButton = useRef<HTMLDivElement>(null); const googleSignInButton = useRef<HTMLDivElement>(null);
@ -30,6 +30,7 @@ export const GoogleLoginButton: FC<IGoogleLoginButton> = (props) => {
size: "large", size: "large",
logo_alignment: "center", logo_alignment: "center",
text: "signin_with", text: "signin_with",
width: 384,
} as GsiButtonConfiguration // customization attributes } as GsiButtonConfiguration // customization attributes
); );
} catch (err) { } catch (err) {
@ -53,7 +54,7 @@ export const GoogleLoginButton: FC<IGoogleLoginButton> = (props) => {
return ( return (
<> <>
<Script src="https://accounts.google.com/gsi/client" async defer onLoad={loadScript} /> <Script src="https://accounts.google.com/gsi/client" async defer onLoad={loadScript} />
<div className="w-full overflow-hidden rounded" id="googleSignInButton" ref={googleSignInButton} /> <div className="!w-full overflow-hidden rounded" id="googleSignInButton" ref={googleSignInButton} />
</> </>
); );
}; };

View File

@ -1,5 +1,5 @@
export * from "./sign-in-forms"; export * from "./sign-in-forms";
export * from "./deactivate-account-modal"; export * from "./deactivate-account-modal";
export * from "./github-login-button"; export * from "./github-sign-in";
export * from "./google-login"; export * from "./google-sign-in";
export * from "./email-signup-form"; export * from "./email-signup-form";

View File

@ -6,7 +6,7 @@ import { AuthService } from "services/auth.service";
// hooks // hooks
import useToast from "hooks/use-toast"; import useToast from "hooks/use-toast";
// components // components
import { GithubLoginButton, GoogleLoginButton } from "components/account"; import { GitHubSignInButton, GoogleSignInButton } from "components/account";
type Props = { type Props = {
handleSignInRedirection: () => Promise<void>; handleSignInRedirection: () => Promise<void>;
@ -73,12 +73,12 @@ export const OAuthOptions: React.FC<Props> = observer((props) => {
<p className="mx-3 flex-shrink-0 text-center text-sm text-onboarding-text-400">Or continue with</p> <p className="mx-3 flex-shrink-0 text-center text-sm text-onboarding-text-400">Or continue with</p>
<hr className="w-full border-onboarding-border-100" /> <hr className="w-full border-onboarding-border-100" />
</div> </div>
<div className="mx-auto flex flex-col items-center gap-2 overflow-hidden pt-7 sm:w-96 sm:flex-row"> <div className="mx-auto space-y-4 overflow-hidden mt-7 sm:w-96">
{envConfig?.google_client_id && ( {envConfig?.google_client_id && (
<GoogleLoginButton clientId={envConfig?.google_client_id} handleSignIn={handleGoogleSignIn} /> <GoogleSignInButton clientId={envConfig?.google_client_id} handleSignIn={handleGoogleSignIn} />
)} )}
{envConfig?.github_client_id && ( {envConfig?.github_client_id && (
<GithubLoginButton clientId={envConfig?.github_client_id} handleSignIn={handleGitHubSignIn} /> <GitHubSignInButton clientId={envConfig?.github_client_id} handleSignIn={handleGitHubSignIn} />
)} )}
</div> </div>
</> </>

View File

@ -20,14 +20,18 @@ export const LatestFeatureBlock = () => {
</Link> </Link>
</p> </p>
</div> </div>
<div className="mx-auto mt-8 overflow-hidden rounded-md border border-onboarding-border-200 bg-onboarding-background-100 object-cover sm:h-52 sm:w-96"> <div
className={`mx-auto mt-8 overflow-hidden rounded-md border border-onboarding-border-200 object-cover sm:h-52 sm:w-96 ${
resolvedTheme === "dark" ? "bg-onboarding-background-100" : "bg-custom-primary-70"
}`}
>
<div className="h-[90%]"> <div className="h-[90%]">
<Image <Image
src={latestFeatures} src={latestFeatures}
alt="Plane Issues" alt="Plane Issues"
className={`-mt-2 ml-10 h-full rounded-md ${ className={`-mt-2 ml-10 h-full rounded-md ${
resolvedTheme === "dark" ? "bg-onboarding-background-100" : "bg-custom-primary-70" resolvedTheme === "dark" ? "bg-onboarding-background-100" : "bg-custom-primary-70"
} `} }`}
/> />
</div> </div>
</div> </div>

View File

@ -1,7 +1,7 @@
import React, { useState } from "react"; import React, { useState } from "react";
// ui // ui
import { ChevronDown, PenSquare, Search } from "lucide-react"; import { ChevronUp, PenSquare, Search } from "lucide-react";
// hooks // hooks
import useLocalStorage from "hooks/use-local-storage"; import useLocalStorage from "hooks/use-local-storage";
// components // components
@ -37,7 +37,6 @@ export const WorkspaceSidebarQuickAction = observer(() => {
}} }}
fieldsToShow={["all"]} fieldsToShow={["all"]}
/> />
<div <div
className={`mt-4 flex w-full cursor-pointer items-center justify-between px-4 ${ className={`mt-4 flex w-full cursor-pointer items-center justify-between px-4 ${
isSidebarCollapsed ? "flex-col gap-1" : "gap-2" isSidebarCollapsed ? "flex-col gap-1" : "gap-2"
@ -74,10 +73,7 @@ export const WorkspaceSidebarQuickAction = observer(() => {
isSidebarCollapsed ? "hidden" : "block" isSidebarCollapsed ? "hidden" : "block"
}`} }`}
> >
<ChevronDown <ChevronUp className="h-4 w-4 transform !text-custom-sidebar-text-300 transition-transform duration-300 rotate-180 group-hover:rotate-0" />
size={16}
className="rotate-0 transform !text-custom-sidebar-text-300 transition-transform duration-300 group-hover:rotate-180"
/>
</button> </button>
<div <div