Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

fix up login card a little bit, its still a pretty much just thrown together

Oleg Isonen866385891550
diff --git a/apps/designer/app/auth/components/login-button.tsx b/apps/designer/app/auth/components/login-button.tsx
deleted file mode 100644
index ed354bde07..0000000000
--- a/apps/designer/app/auth/components/login-button.tsx
+++ /dev/null
@@ -1,47 +0,0 @@
-import React from "react";
-import { Button, Tooltip } from "@webstudio-is/design-system";
-import env from "~/shared/env";
-
-const isPreviewEnvironment = env.VERCEL_ENV === "preview";
-
-export const LoginButton = ({
- children,
- isDevLogin = false,
- enabled,
- ...props
-}: {
- children: React.ReactChild;
- isDevLogin?: boolean;
- onClick?: () => void;
- enabled: boolean;
-}) => {
- const isSocialLoginInPreviewEnvironment =
- isPreviewEnvironment && isDevLogin === false;
- const showTooltip = isSocialLoginInPreviewEnvironment || enabled === false;
- if (showTooltip) {
- const content = isSocialLoginInPreviewEnvironment
- ? "Social login does not work in preview deployments"
- : "This login is not configured";
-
- return (
- <Tooltip content={content} delayDuration={0}>
- <span tabIndex={0} style={{ width: "100%", display: "block" }}>
- <Button
- {...props}
- css={{ width: "100%" }}
- size={3}
- type="submit"
- disabled
- >
- {children}
- </Button>
- </span>
- </Tooltip>
- );
- }
- return (
- <Button {...props} css={{ width: "100%" }} size={3} type="submit">
- {children}
- </Button>
- );
-};
diff --git a/apps/designer/app/auth/login-button.tsx b/apps/designer/app/auth/login-button.tsx
new file mode 100644
index 0000000000..745729932e
--- /dev/null
+++ b/apps/designer/app/auth/login-button.tsx
@@ -0,0 +1,51 @@
+import React from "react";
+import { Button, Flex, Tooltip } from "@webstudio-is/design-system";
+import env from "~/shared/env";
+
+const isPreviewEnvironment = env.VERCEL_ENV === "preview";
+
+export const LoginButton = ({
+ children,
+ isDevLogin = false,
+ disabled,
+ icon,
+ ...props
+}: {
+ children: React.ReactChild;
+ isDevLogin?: boolean;
+ onClick?: () => void;
+ disabled: boolean;
+ icon: JSX.Element;
+}) => {
+ const isSocialLoginInPreviewEnvironment =
+ isPreviewEnvironment && isDevLogin === false;
+
+ const button = (
+ <Button
+ {...props}
+ size={3}
+ type="submit"
+ disabled={disabled}
+ css={{ width: "100%" }}
+ >
+ <Flex gap="2" align="center">
+ <Flex css={{ size: "$spacing$10" }}>{icon}</Flex>
+ {children}
+ </Flex>
+ </Button>
+ );
+
+ if (isSocialLoginInPreviewEnvironment) {
+ const content = disabled
+ ? "Social login does not work in preview deployments"
+ : "This login is not configured";
+
+ return (
+ <Tooltip content={content} delayDuration={0}>
+ {button}
+ </Tooltip>
+ );
+ }
+
+ return button;
+};
diff --git a/apps/designer/app/auth/login.tsx b/apps/designer/app/auth/login.tsx
index 6736b17424..aa4153222c 100644
--- a/apps/designer/app/auth/login.tsx
+++ b/apps/designer/app/auth/login.tsx
@@ -11,7 +11,7 @@ import {
} from "@webstudio-is/design-system";
import interStyles from "~/shared/font-faces/inter.css";
import { GithubIcon, CommitIcon, GoogleIcon } from "@webstudio-is/icons";
-import { LoginButton } from "./components/login-button";
+import { LoginButton } from "./login-button";
import loginStyles from "./login.css";
import { authPath } from "~/shared/router-utils";
@@ -46,7 +46,7 @@ export const Login = ({ errorMessage }: { errorMessage: string }) => {
<Card size={2}>
<Flex direction="column" align="center" gap="3">
<Heading size="2">Login</Heading>
- <Flex direction="column" gap="4" css={{ width: 300 }}>
+ <Flex direction="column" gap="4">
{errorMessage.length ? (
<Text align="center" color="error">
{errorMessage}
@@ -54,23 +54,19 @@ export const Login = ({ errorMessage }: { errorMessage: string }) => {
) : null}
<Flex gap="2" direction="column">
<Form action={authPath({ provider: "github" })} method="post">
- <LoginButton enabled={data.isGithubEnabled}>
- <Flex gap="2" align="center">
- <Flex css={{ width: 20, height: 20 }}>
- <GithubIcon />
- </Flex>
- Login with GitHub
- </Flex>
+ <LoginButton
+ disabled={data.isGithubEnabled === false}
+ icon={<GithubIcon />}
+ >
+ Login with GitHub
</LoginButton>
</Form>
<Form action={authPath({ provider: "google" })} method="post">
- <LoginButton enabled={data.isGoogleEnabled}>
- <Flex gap="2" align="center">
- <Flex css={{ width: 20, height: 20 }}>
- <GoogleIcon />
- </Flex>
- Login with Google
- </Flex>
+ <LoginButton
+ disabled={data.isGoogleEnabled === false}
+ icon={<GoogleIcon />}
+ >
+ Login with Google
</LoginButton>
</Form>
{data.isDevLogin &&
@@ -97,16 +93,12 @@ export const Login = ({ errorMessage }: { errorMessage: string }) => {
</Flex>
) : (
<LoginButton
- enabled={data.isDevLogin}
+ disabled={data.isDevLogin === false}
isDevLogin
onClick={() => openDevLogin(true)}
+ icon={<CommitIcon />}
>
- <Flex gap="2" align="center">
- <Flex css={{ width: 20, height: 20 }}>
- <CommitIcon />
- </Flex>
- Dev Login
- </Flex>
+ Dev Login
</LoginButton>
))}
</Flex>
diff --git a/packages/design-system/src/components/card.tsx b/packages/design-system/src/components/card.tsx
index ceeaa84c01..33c969abac 100644
--- a/packages/design-system/src/components/card.tsx
+++ b/packages/design-system/src/components/card.tsx
@@ -38,7 +38,7 @@ export const Card = styled("div", {
padding: "$spacing$11",
},
2: {
- width: "$spacing$32",
+ width: "$spacing$34",
padding: "$spacing$17",
},
},