From 97e804ecae6b7cb747dd7a27c2557bab377fb199 Mon Sep 17 00:00:00 2001
From: PopDaph
Date: Fri, 3 Nov 2023 23:11:11 +0100
Subject: [PATCH] Handle the signup buttons
---
front/components/Button.tsx | 101 +++++++++++++++++++++++++++++++++-
front/pages/index.tsx | 104 +++++++++++-------------------------
2 files changed, 130 insertions(+), 75 deletions(-)
diff --git a/front/components/Button.tsx b/front/components/Button.tsx
index 0d3a73edfb1f..14175a40beda 100644
--- a/front/components/Button.tsx
+++ b/front/components/Button.tsx
@@ -1,4 +1,12 @@
-import { Button } from "@dust-tt/sparkle";
+import {
+ Button,
+ DropdownMenu,
+ GithubLogo,
+ GoogleLogo,
+ Icon,
+ LoginIcon,
+ RocketIcon,
+} from "@dust-tt/sparkle";
import { classNames } from "@app/lib/utils";
@@ -41,3 +49,94 @@ export function SignInButton({
>
);
}
+
+export function SignInDropDownButton({
+ buttonVariant = "tertiary",
+ buttonLabel = "Sign in",
+ buttonIcon = LoginIcon,
+ buttonClassname = "",
+ shouldDisplayGithub,
+ onClickGithub,
+ onClickGoogle,
+}: {
+ buttonVariant?: "primary" | "secondary" | "tertiary";
+ buttonLabel?: string;
+ buttonIcon?: typeof Icon;
+ buttonClassname?: string;
+ shouldDisplayGithub: boolean;
+ onClickGithub: () => void;
+ onClickGoogle: () => void;
+}) {
+ return (
+
+
+
+
+
+
+
+ {shouldDisplayGithub && (
+
+ )}
+
+
+
+ );
+}
+
+export function SignUpDropDownButton({
+ buttonVariant = "primary",
+ buttonLabel = "Start with Dust",
+ buttonIcon = RocketIcon,
+ buttonClassname = "",
+ onClickGoogle,
+}: {
+ buttonVariant?: "primary" | "secondary" | "tertiary";
+ buttonLabel?: string;
+ buttonIcon?: typeof Icon;
+ buttonClassname?: string;
+ onClickGoogle: () => void;
+}) {
+ return (
+
+
+
+
+
+
+
+
+
+
+ );
+}
diff --git a/front/pages/index.tsx b/front/pages/index.tsx
index 73a9a82ea9da..34722802ddb5 100644
--- a/front/pages/index.tsx
+++ b/front/pages/index.tsx
@@ -2,11 +2,8 @@ import {
AnthropicLogo,
Button,
DriveLogo,
- DropdownMenu,
- GithubLogo,
GithubWhiteLogo,
GoogleLogo,
- LoginIcon,
Logo,
LogoHorizontalWhiteLogo,
MicrosoftLogo,
@@ -14,8 +11,6 @@ import {
MoreIcon,
NotionLogo,
OpenaiLogo,
- PlayIcon,
- RocketIcon,
SlackLogo,
} from "@dust-tt/sparkle";
import { GetServerSideProps, InferGetServerSidePropsType } from "next";
@@ -41,7 +36,10 @@ import {
const defaultFlexClasses = "flex flex-col gap-4";
-import { GoogleSignInButton } from "@app/components/Button";
+import {
+ SignInDropDownButton,
+ SignUpDropDownButton,
+} from "@app/components/Button";
import Particles from "@app/components/home/particles";
import ScrollingHeader from "@app/components/home/scrollingHeader";
import { PricePlans } from "@app/components/PlansTables";
@@ -133,68 +131,30 @@ export default function Home({
*/}
-
- {!(router.query.signIn && router.query.signIn !== "github") && (
-
- Sign in with{" "}
- {
- void signIn("github", {
- callbackUrl: getCallbackUrl(router.query),
- });
- }}
- >
- GitHub
- {" "}
- or
-
- )}
-
+
+
+ signIn("google", {
+ callbackUrl: getCallbackUrl(router.query),
+ })
+ }
+ />
+ {
+ void signIn("github", {
+ callbackUrl: getCallbackUrl(router.query),
+ });
+ }}
+ onClickGoogle={() =>
signIn("google", {
callbackUrl: getCallbackUrl(router.query),
})
}
- >
-
- Sign in with Google
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -250,17 +210,13 @@ export default function Home({
is a competitive edge.
-
-