Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

improved form design

Steven Tey1da8b7e0e269
diff --git a/apps/web/app/app.dub.co/(auth)/login/form.tsx b/apps/web/app/app.dub.co/(auth)/login/form.tsx
index 73f0dcd27d..e03e2ff2f3 100644
--- a/apps/web/app/app.dub.co/(auth)/login/form.tsx
+++ b/apps/web/app/app.dub.co/(auth)/login/form.tsx
@@ -28,30 +28,32 @@ export default function LoginForm() {
return (
<>
- <Button
- text="Continue with Google"
- onClick={() => {
- setClickedGoogle(true);
- signIn("google", {
- ...(next && next.length > 0 ? { callbackUrl: next } : {}),
- });
- }}
- loading={clickedGoogle}
- disabled={clickedEmail || clickedSSO}
- icon={<Google className="h-4 w-4" />}
- />
- <Button
- text="Continue with GitHub"
- onClick={() => {
- setClickedGithub(true);
- signIn("github", {
- ...(next && next.length > 0 ? { callbackUrl: next } : {}),
- });
- }}
- loading={clickedGitub}
- disabled={clickedEmail || clickedSSO}
- icon={<Github className="h-4 w-4" />}
- />
+ <div className="flex space-x-2">
+ <Button
+ variant="secondary"
+ onClick={() => {
+ setClickedGoogle(true);
+ signIn("google", {
+ ...(next && next.length > 0 ? { callbackUrl: next } : {}),
+ });
+ }}
+ loading={clickedGoogle}
+ disabled={clickedEmail || clickedSSO}
+ icon={<Google className="h-5 w-5" />}
+ />
+ <Button
+ variant="secondary"
+ onClick={() => {
+ setClickedGithub(true);
+ signIn("github", {
+ ...(next && next.length > 0 ? { callbackUrl: next } : {}),
+ });
+ }}
+ loading={clickedGitub}
+ disabled={clickedEmail || clickedSSO}
+ icon={<Github className="h-5 w-5 text-black" />}
+ />
+ </div>
<form
onSubmit={async (e) => {
e.preventDefault();
@@ -202,7 +204,6 @@ export default function LoginForm() {
>
Sign up
</Link>
- .
</p>
)}
</>
diff --git a/apps/web/app/app.dub.co/(auth)/login/page.tsx b/apps/web/app/app.dub.co/(auth)/login/page.tsx
index 36570b226c..ae6dd119e2 100644
--- a/apps/web/app/app.dub.co/(auth)/login/page.tsx
+++ b/apps/web/app/app.dub.co/(auth)/login/page.tsx
@@ -18,7 +18,7 @@ export default function LoginPage() {
Sign in to {process.env.NEXT_PUBLIC_APP_NAME}
</h3>
<p className="text-sm text-gray-500">
- Start creating short links with superpowers.
+ Start creating short links with superpowers
</p>
</div>
<div className="flex flex-col space-y-3 bg-gray-50 px-4 py-8 sm:px-16">
diff --git a/apps/web/app/app.dub.co/(auth)/register/form.tsx b/apps/web/app/app.dub.co/(auth)/register/form.tsx
index 18f8a4f45f..64e0e6e671 100644
--- a/apps/web/app/app.dub.co/(auth)/register/form.tsx
+++ b/apps/web/app/app.dub.co/(auth)/register/form.tsx
@@ -15,6 +15,7 @@ export default function RegisterForm() {
return (
<>
<Button
+ variant="secondary"
text="Continue with Google"
onClick={() => {
setClickedGoogle(true);
@@ -44,7 +45,6 @@ export default function RegisterForm() {
>
Sign in
</Link>
- .
</p>
</>
);
diff --git a/packages/ui/src/button.tsx b/packages/ui/src/button.tsx
index 7557c02054..fbf7dc8569 100644
--- a/packages/ui/src/button.tsx
+++ b/packages/ui/src/button.tsx
@@ -6,7 +6,7 @@ import { LoadingSpinner } from "./icons";
import { Tooltip } from "./tooltip";
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
- text: string;
+ text?: string;
variant?: "primary" | "secondary" | "outline" | "success" | "danger";
loading?: boolean;
icon?: ReactNode;
@@ -42,13 +42,13 @@ export function Button({
// if onClick is passed, it's a "button" type, otherwise it's being used in a form, hence "submit"
type={props.onClick ? "button" : "submit"}
className={cn(
- "group flex h-10 w-full items-center justify-center space-x-2 rounded-md border px-4 text-sm transition-all focus:outline-none",
+ "group flex h-10 w-full items-center justify-center space-x-2 rounded-md border px-4 text-sm transition-all",
props.disabled || loading
? "cursor-not-allowed border-gray-200 bg-gray-100 text-gray-400"
: {
"border-black bg-black text-white hover:bg-white hover:text-black":
variant === "primary",
- "border-gray-200 bg-white text-gray-500 hover:border-black hover:text-black":
+ "border-gray-200 bg-white text-gray-600 hover:bg-gray-100":
variant === "secondary",
"border-transparent text-gray-500 transition-all duration-75 hover:bg-gray-100":
variant === "outline",
@@ -63,7 +63,7 @@ export function Button({
{...props}
>
{loading ? <LoadingSpinner /> : icon ? icon : null}
- <p>{text}</p>
+ {text && <p>{text}</p>}
{shortcut && (
<kbd className="hidden rounded bg-zinc-700 px-2 py-0.5 text-xs font-light text-gray-400 transition-all duration-75 group-hover:bg-gray-100 group-hover:text-gray-500 md:inline-block">
{shortcut}
diff --git a/packages/ui/src/icons/google.tsx b/packages/ui/src/icons/google.tsx
index 1523a3e55d..8bc4e31a33 100644
--- a/packages/ui/src/icons/google.tsx
+++ b/packages/ui/src/icons/google.tsx
@@ -2,11 +2,28 @@ export default function Google({ className }: { className?: string }) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
- viewBox="0 0 488 512"
- fill="currentColor"
+ height="24"
+ viewBox="0 0 24 24"
+ width="24"
className={className}
>
- <path d="M488 261.8C488 403.3 391.1 504 248 504 110.8 504 0 393.2 0 256S110.8 8 248 8c66.8 0 123 24.5 166.3 64.9l-67.5 64.9C258.5 52.6 94.3 116.6 94.3 256c0 86.5 69.1 156.6 153.7 156.6 98.2 0 135-70.4 140.8-106.9H248v-85.3h236.1c2.3 12.7 3.9 24.9 3.9 41.4z" />
+ <path
+ d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"
+ fill="#4285F4"
+ />
+ <path
+ d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
+ fill="#34A853"
+ />
+ <path
+ d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
+ fill="#FBBC05"
+ />
+ <path
+ d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
+ fill="#EA4335"
+ />
+ <path d="M1 1h22v22H1z" fill="none" />
</svg>
);
}