-
Notifications
You must be signed in to change notification settings - Fork 824
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Login and error page redesign (#4777)
## Description <img width="1512" alt="image" src="https://github.com/user-attachments/assets/c61e93e0-f981-428d-8d8f-7101cdf43c2b" /> <img width="449" alt="image" src="https://github.com/user-attachments/assets/f030d9c2-ddaf-481d-9292-d2e5619939b7" /> <img width="1507" alt="image" src="https://github.com/user-attachments/assets/14bc4742-5d87-47f7-8704-db83674b115e" /> 1. What is this PR about (link the issue and add a short description) ## Steps for reproduction 1. click button 2. expect xyz ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 0000) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env` file
- Loading branch information
Showing
9 changed files
with
156 additions
and
197 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,44 @@ | ||
import { Button, Flex, InputField, theme } from "@webstudio-is/design-system"; | ||
import { CommitIcon } from "@webstudio-is/icons"; | ||
import { useState } from "react"; | ||
import { authPath } from "~/shared/router-utils"; | ||
import { BrandButton } from "./brand-button"; | ||
|
||
export const SecretLogin = () => { | ||
const [isSecretLoginOpen, setIsSecretLoginOpen] = useState(false); | ||
if (isSecretLoginOpen) { | ||
const [show, setShow] = useState(false); | ||
if (show) { | ||
const action = authPath({ provider: "dev" }); | ||
return ( | ||
<Flex | ||
as="form" | ||
action={authPath({ provider: "dev" })} | ||
method="post" | ||
css={{ | ||
width: "fit-content", | ||
flexDirection: "row", | ||
gap: theme.spacing[5], | ||
}} | ||
> | ||
<Flex gap="2"> | ||
<InputField | ||
name="secret" | ||
type="text" | ||
type="password" | ||
minLength={2} | ||
required | ||
autoFocus | ||
placeholder="Auth secret" | ||
css={{ flexGrow: 1 }} | ||
formAction={authPath({ provider: "dev" })} | ||
onKeyDown={(event) => { | ||
const form = event.currentTarget.form; | ||
if (event.key === "Enter" && form) { | ||
form.action = action; | ||
form.submit(); | ||
} | ||
}} | ||
/> | ||
<Button>Login</Button> | ||
<Button type="submit" formAction={action}> | ||
Login | ||
</Button> | ||
</Flex> | ||
); | ||
} | ||
|
||
return ( | ||
<BrandButton | ||
onClick={() => setIsSecretLoginOpen(true)} | ||
icon={<CommitIcon size={22} />} | ||
<Button | ||
onClick={() => setShow(true)} | ||
color="neutral" | ||
css={{ height: theme.spacing[15] }} | ||
> | ||
Login with Secret | ||
</BrandButton> | ||
</Button> | ||
); | ||
}; |
Oops, something went wrong.