refactor: use the new button component on forms and dialogs (#16050)

This is a significant PR that will impact many parts of the UI, so I’d
like to ask you, @jaaydenh, for a very thorough review of the Storybook
stories on Chromatic. I know it’s a bit of a hassle with around 180
stories affected, but it’s all for a good cause 💪

Main changes:
- Update the `Button` component to match the [new buttons
design](https://www.figma.com/design/WfqIgsTFXN2BscBSSyXWF8/Coder-kit?node-id=3-1756&p=f&m=dev).
- Update forms and dialogs to use the new `Button` component.

Related to https://github.com/coder/coder/issues/14978
This commit is contained in:
Bruno Quaresma
2025-01-07 14:28:58 -03:00
committed by GitHub
parent 289338f19e
commit cb6facb53a
54 changed files with 443 additions and 500 deletions

View File

@ -4,12 +4,14 @@ import TextField from "@mui/material/TextField";
import { hasApiFieldErrors, isApiError } from "api/errors";
import type * as TypesGen from "api/typesGenerated";
import { ErrorAlert } from "components/Alert/ErrorAlert";
import { FormFooter } from "components/FormFooter/FormFooter";
import { Button } from "components/Button/Button";
import { FormFooter } from "components/Form/Form";
import { FullPageForm } from "components/FullPageForm/FullPageForm";
import { PasswordField } from "components/PasswordField/PasswordField";
import { Spinner } from "components/Spinner/Spinner";
import { Stack } from "components/Stack/Stack";
import { type FormikContextType, useFormik } from "formik";
import { type FC, useEffect } from "react";
import type { FC } from "react";
import {
displayNameValidator,
getFormHelpers,
@ -202,11 +204,16 @@ export const CreateUserForm: FC<
label={Language.passwordLabel}
/>
</Stack>
<FormFooter
submitLabel="Create user"
onCancel={onCancel}
isLoading={isLoading}
/>
<FormFooter className="mt-8">
<Button onClick={onCancel} variant="outline">
Cancel
</Button>
<Button type="submit" disabled={isLoading}>
{isLoading && <Spinner />}
Save
</Button>
</FormFooter>
</form>
</FullPageForm>
);