Skip to content

[feat]: redesign the Sign In Page #65

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"dependencies": {
"@livepeer/react": "^4.2.7",
"@radix-ui/react-popover": "^1.1.2",
"@tanstack/react-form": "^0.37.1",
"antd": "^5.21.5",
"axios": "^1.7.7",
"clsx": "^2.1.1",
Expand All @@ -24,7 +25,9 @@
"react-dom": "^18.3.1",
"react-icons": "^5.3.0",
"react-router-dom": "^6.27.0",
"react-spinners": "^0.14.1",
"react-toastify": "^10.0.6",
"tailwind-merge": "^2.4.0",
"zustand": "^5.0.0"
},
"devDependencies": {
Expand Down
Binary file added packages/frontend/src/assets/view-sp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions packages/frontend/src/lib/components/AccountInOutHeader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from "react";
// import digitDataLogo from "../assets/logo.webp";
import { LogoIcon } from "../../assets/svg-exports";

export default function AccountInOutHeader({ title, description }) {
return (
<div className="text-center">
<div className="flex flex-col items-center">
<LogoIcon theme="dark" />
</div>
<div className="space-y-2">
<h1 className="text-lg bg-gradient-to-b from-primary/60 to-primary text-transparent bg-clip-text">
{title}
</h1>
<p className="text-sm text-muted-foreground">{description}</p>
</div>
</div>
);
}
11 changes: 11 additions & 0 deletions packages/frontend/src/lib/components/FieldInfo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default function FieldInfo({ field }) {
return (
<p className="text-sm text-pink-500 mb-2">
{field.state.meta.isTouched && field.state.meta.errors.length ? (
<>{field.state.meta.errors.join(",")}</>
) : null}

{field.state.meta.isValidating ? "Validating..." : null}
</p>
);
}
37 changes: 37 additions & 0 deletions packages/frontend/src/lib/components/FormInput.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React from "react";
import FieldInfo from "./FieldInfo";
import { cn } from "../../utils/cn";

function FormInput({
fieldInfo: { name, placeholder, isRequired = true },
field,
}) {
return (
<>
<div className="relative my-6">
<input
name={name}
value={field.state.meta.value}
onBlur={field.handleBlur}
onChange={(e) => field.handleChange(e.target.value)}
className="w-full border border-primary/60 p-4 rounded-md text-sm peer placeholder:text-transparent bg-transparent outline-none"
placeholder={placeholder}
required={isRequired}
/>
<label
className={cn(
"text-sm",
"absolute -top-5 left-0",
"peer-placeholder-shown:text-gray-400 peer-placeholder-shown:top-4 peer-placeholder-shown:left-4 peer-focus:-top-6 peer-focus:left-0 peer-focus:text-muted-foreground peer-focus:after:text-red-500 peer-placeholder-shown:after:text-gray-400",
"after:content-['*'] transition-all"
)}
>
{placeholder}
</label>
<FieldInfo field={field} />
</div>
</>
);
}

export default FormInput;
31 changes: 31 additions & 0 deletions packages/frontend/src/lib/components/SubmitButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from "react";
import { cn } from "../../utils/cn";
import { BeatLoader } from "react-spinners";
import { buttonVariants } from "./ui/button";

export default function SubmitButton({ value, formSubscribe: form }) {
return (
<form.Subscribe
selector={(state) => [state.canSubmit, state.isSubmitting]}
children={([canSubmit, isSubmitting]) => {
return (
<button
className={cn(
"p-4 w-full rounded-md font-medium text-sm",
"bg-gray-900 hover:bg-gray-950 text-white",
"focus:ring focus:ring-gray-600",
"transition-all",
buttonVariants({
variant: "default",
})
)}
type="submit"
disabled={!canSubmit}
>
{isSubmitting ? <BeatLoader color="#ffffff" size="5px" /> : value}
</button>
);
}}
/>
);
}
56 changes: 56 additions & 0 deletions packages/frontend/src/lib/components/ui/button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import * as React from "react";
import { Slot } from "@radix-ui/react-slot";
import { cva, type VariantProps } from "class-variance-authority";

import { cn } from "../../../utils/cn";

const buttonVariants = cva(
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
{
variants: {
variant: {
default: "bg-primary text-primary-foreground hover:bg-primary/90",
destructive:
"bg-destructive text-destructive-foreground hover:bg-destructive/90",
outline:
"border border-input bg-background hover:bg-accent hover:text-accent-foreground",
secondary:
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
ghost: "hover:bg-accent hover:text-accent-foreground",
link: "text-primary underline-offset-4 hover:underline",
},
size: {
default: "h-10 px-4 py-2",
sm: "h-9 rounded-md px-3",
lg: "h-11 rounded-md px-8",
icon: "h-10 w-10",
},
},
defaultVariants: {
variant: "default",
size: "default",
},
}
);

export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> {
asChild?: boolean;
}

const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, size, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : "button";
return (
<Comp
className={cn(buttonVariants({ variant, size, className }))}
ref={ref}
{...props}
/>
);
}
);
Button.displayName = "Button";

export { Button, buttonVariants };
4 changes: 0 additions & 4 deletions packages/frontend/src/network/auth/auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { storeDataInCookie } from "../../utils/utils";
import instance from "../axios";
import { GoogleAuthUrlResponse, User } from "./types";



// export const login = async (payload: AddProjectProps) => {
// const { data } = await instance.post(`/project/create`, payload);
// return data;
Expand Down Expand Up @@ -42,8 +40,6 @@ export const getUserDetails = async (code: string, provider: string) => {
}
};



export const sendUserAuthOtpMail = async (email: string) => {
const { data } = await instance.get(`/auth/email/sign-in?email=${email}`);
return data;
Expand Down
Loading