diff --git a/front/src/app/layout.tsx b/front/src/app/layout.tsx index 96df3a6..b833a0e 100644 --- a/front/src/app/layout.tsx +++ b/front/src/app/layout.tsx @@ -29,7 +29,7 @@ export default function RootLayout({ children }: { children: React.ReactNode }) - + {children} diff --git a/front/src/components/OnBoarding/index.tsx b/front/src/components/OnBoarding/index.tsx index 4fc2e62..654932e 100644 --- a/front/src/components/OnBoarding/index.tsx +++ b/front/src/components/OnBoarding/index.tsx @@ -1,24 +1,44 @@ -import { WebAuthn } from "@/libs/web-authn/service/web-authn"; import { useMe } from "@/providers/MeProvider"; -import { ReloadIcon } from "@radix-ui/react-icons"; -import { Button, Flex, Link, TextField } from "@radix-ui/themes"; +import { GitHubLogoIcon, ReloadIcon, SunIcon, MoonIcon } from "@radix-ui/react-icons"; +import { + Button, + Flex, + Heading, + Link, + TextField, + Blockquote, + Text, + Kbd, + Switch, +} from "@radix-ui/themes"; import { CSSProperties, useEffect, useState } from "react"; +import styled from "@emotion/styled"; +import { useTheme } from "next-themes"; +import ThemeButton from "../ThemeButton"; const css: CSSProperties = { flexGrow: 1, gap: "1rem", }; -const cssBtn: CSSProperties = { - // opacity: 0, - cursor: "pointer", - width: "100%", - // height: "100%", - // background: "transparent", - // outline: "none", - // border: "none", - //position: "absolute", -}; +const Container = styled(Flex)` + position: relative; + width: 100%; + gap: 2rem; + background-color: "red"; +`; + +const Hero = styled(Flex)` + margin-top: 2rem; + display: flex; + flex-direction: column; + align-items: center; + gap: 0.5rem; +`; + +const Title = styled(Heading)` + text-align: center; +`; export default function OnBoarding() { const [username, setUsername] = useState(""); @@ -28,17 +48,68 @@ export default function OnBoarding() { if (!createForm) { return ( - + + + + + Smart Wallet + + + + + passkeys-4337 + + + + {isLoading && } - {!isLoading && } - {!isLoading && setCreateForm(true)}>or create a new account} - + {!isLoading && ( + + )} + !isLoading && setCreateForm(true)} size={"2"}> + or create a new account + + ); } return ( - + + + + + Smart Wallet + + + + + passkeys-4337 + + + +
{ e.preventDefault(); username && create(username); @@ -48,15 +119,23 @@ export default function OnBoarding() { required value={username} onChange={(e) => setUsername(e.target.value)} - placeholder="account name" + placeholder="Name" disabled={isLoading} + size={"3"} + style={{ width: "200px", padding: "0.5rem" }} /> - {!isLoading && } + {!isLoading && ( + + )} {isLoading && } {!isLoading && ( - setCreateForm(false)}>or sign in to an existing account + setCreateForm(false)} size={"2"}> + or sign in to an existing account + )} -
+ ); } diff --git a/front/src/components/ThemeButton/index.tsx b/front/src/components/ThemeButton/index.tsx new file mode 100644 index 0000000..aa42a4b --- /dev/null +++ b/front/src/components/ThemeButton/index.tsx @@ -0,0 +1,47 @@ +"use client"; + +import { SunIcon, MoonIcon } from "@radix-ui/react-icons"; +import { Button } from "@radix-ui/themes"; +import { useTheme } from "next-themes"; +import { CSSProperties, useEffect, useState } from "react"; + +type Props = { + style?: CSSProperties; +}; + +export default function ThemeButton({ style }: Props) { + const { theme, setTheme, systemTheme } = useTheme(); + + const [mounted, setMounted] = useState(false); + + useEffect(() => setMounted(true), []); + + if (!mounted) return null; + + return ( + + ); +} diff --git a/front/src/providers/MeProvider/index.tsx b/front/src/providers/MeProvider/index.tsx index 3f7e8c5..850f3a8 100644 --- a/front/src/providers/MeProvider/index.tsx +++ b/front/src/providers/MeProvider/index.tsx @@ -17,7 +17,11 @@ export type Me = { function useMeHook() { const [isLoading, setIsLoading] = useState(false); - const [me, setMe] = useState(null); + const [me, setMe] = useState( + typeof window !== "undefined" + ? JSON.parse(localStorage.getItem("hocuspocus.me") ?? "null") + : null, + ); const [isReturning, setIsReturning] = useState(false); function disconnect() {