Skip to content

Commit 479ce07

Browse files
committed
Button and input text
1 parent 77777fb commit 479ce07

File tree

5 files changed

+80
-127
lines changed

5 files changed

+80
-127
lines changed

site/mui.d.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
1-
import { Theme } from "@mui/material/styles"
1+
import { PaletteColor, PaletteColorOptions, Theme } from "@mui/material/styles"
2+
3+
declare module "@mui/styles/defaultTheme" {
4+
interface DefaultTheme extends Theme {}
5+
}
26

37
declare module "@mui/material/styles" {
48
interface TypeBackground {
59
paperLight: string
610
}
11+
12+
interface Palette {
13+
neutral: PaletteColor
14+
}
15+
16+
interface PaletteOptions {
17+
neutral?: PaletteColorOptions
18+
}
719
}
820

9-
declare module "@mui/styles/defaultTheme" {
10-
interface DefaultTheme extends Theme {}
21+
declare module "@mui/material/Button" {
22+
interface ButtonPropsColorOverrides {
23+
neutral: true
24+
}
1125
}

site/src/components/SignInForm/OAuthSignInForm.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export const OAuthSignInForm: FC<OAuthSignInFormProps> = ({
4343
fullWidth
4444
type="submit"
4545
variant="outlined"
46+
size="large"
4647
>
4748
{Language.githubSignIn}
4849
</Button>
@@ -57,6 +58,7 @@ export const OAuthSignInForm: FC<OAuthSignInFormProps> = ({
5758
)}`}
5859
>
5960
<Button
61+
size="large"
6062
startIcon={
6163
authMethods.oidc.iconUrl ? (
6264
<img

site/src/components/SignInForm/PasswordSignInForm.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const PasswordSignInForm: FC<PasswordSignInFormProps> = ({
4141

4242
return (
4343
<form onSubmit={form.handleSubmit}>
44-
<Stack>
44+
<Stack spacing={2.5}>
4545
<TextField
4646
{...getFieldHelpers("email")}
4747
onChange={onChangeTrimmed(form)}
@@ -63,6 +63,7 @@ export const PasswordSignInForm: FC<PasswordSignInFormProps> = ({
6363
/>
6464
<div>
6565
<LoadingButton
66+
size="large"
6667
loading={isSigningIn}
6768
fullWidth
6869
type="submit"

site/src/components/SignInForm/SignInForm.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ export const SignInForm: FC<React.PropsWithChildren<SignInFormProps>> = ({
141141

142142
<Button
143143
fullWidth
144+
size="large"
144145
onClick={() => setShowPasswordAuth(true)}
145146
variant="outlined"
146147
startIcon={<EmailIcon className={styles.icon} />}

site/src/theme/theme.ts

Lines changed: 58 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import { colors } from "./colors"
22
import { ThemeOptions, createTheme, Theme } from "@mui/material/styles"
3-
import { BODY_FONT_FAMILY, borderRadius, borderRadiusSm } from "./constants"
3+
import { BODY_FONT_FAMILY, borderRadius } from "./constants"
4+
5+
// MUI does not have aligned heights for buttons and inputs so we have to "hack" it a little bit
6+
const INPUT_HEIGHT = 46
7+
const BUTTON_LG_HEIGHT = 46
48

59
export type PaletteIndex = keyof Theme["palette"]
610
export type PaletteStatusIndex = Extract<
@@ -55,6 +59,9 @@ export let dark = createTheme({
5559
action: {
5660
hover: colors.gray[14],
5761
},
62+
neutral: {
63+
main: colors.gray[1],
64+
},
5865
},
5966
typography: {
6067
fontFamily: BODY_FONT_FAMILY,
@@ -125,23 +132,22 @@ export let dark = createTheme({
125132
letterSpacing: 1.5,
126133
},
127134
},
135+
shape: {
136+
borderRadius,
137+
},
128138
})
129139

130140
dark = createTheme(dark, {
131141
components: {
132142
MuiCssBaseline: {
133-
styleOverrides: {
134-
"@global": {
135-
body: {
136-
backgroundImage: `linear-gradient(to right bottom, ${dark.palette.background.default}, ${colors.gray[17]})`,
137-
backgroundRepeat: "no-repeat",
138-
backgroundAttachment: "fixed",
139-
},
140-
":root": {
141-
colorScheme: dark.palette.mode,
142-
},
143-
},
144-
},
143+
styleOverrides: `
144+
input:-webkit-autofill,
145+
input:-webkit-autofill:hover,
146+
input:-webkit-autofill:focus,
147+
input:-webkit-autofill:active {
148+
-webkit-box-shadow: 0 0 0 100px ${dark.palette.background.default} inset !important;
149+
}
150+
`,
145151
},
146152
MuiAvatar: {
147153
styleOverrides: {
@@ -166,78 +172,23 @@ dark = createTheme(dark, {
166172
},
167173
MuiButton: {
168174
defaultProps: {
169-
variant: "contained",
175+
variant: "outlined",
176+
color: "neutral",
170177
},
171178
styleOverrides: {
172-
root: {
173-
// Prevents a loading button from collapsing!
174-
minHeight: 40,
175-
height: 40, // Same size of input height
176-
fontWeight: "normal",
177-
fontSize: 16,
178-
textTransform: "none",
179-
letterSpacing: "none",
180-
border: `1px solid ${dark.palette.divider}`,
181-
whiteSpace: "nowrap",
182-
183-
"&:focus-visible": {
184-
outline: `2px solid ${dark.palette.primary.dark}`,
185-
},
186-
},
179+
root: ({ ownerState }) => {
180+
let height: number | undefined = undefined
187181

188-
contained: {
189-
boxShadow: "none",
190-
color: dark.palette.text.primary,
191-
backgroundColor: colors.gray[13],
192-
borderColor: colors.gray[12],
182+
if (ownerState.size === "large") {
183+
height = BUTTON_LG_HEIGHT
184+
}
193185

194-
"&:hover:not(:disabled):not(.MuiButton-containedPrimary):not(.MuiButton-containedSecondary)":
195-
{
196-
boxShadow: "none",
197-
backgroundColor: colors.gray[12],
198-
borderColor: colors.gray[11],
199-
},
200-
201-
"&.Mui-disabled:not(.MuiButton-containedPrimary):not(.MuiButton-containedSecondary)":
202-
{
203-
color: colors.gray[9],
204-
backgroundColor: colors.gray[14],
205-
cursor: "not-allowed",
206-
pointerEvents: "auto",
207-
},
208-
},
209-
sizeSmall: {
210-
padding: `0 16px`,
211-
fontSize: 14,
212-
minHeight: 36,
213-
height: 36,
214-
borderRadius: borderRadiusSm,
215-
},
216-
iconSizeSmall: {
217-
width: 14,
218-
height: 14,
219-
marginLeft: "0 !important",
220-
marginRight: 8,
221-
222-
"& svg:not(.MuiCircularProgress-svg)": {
223-
width: 14,
224-
height: 14,
225-
},
226-
},
227-
outlined: {
228-
border: `1px solid ${colors.gray[11]}`,
229-
230-
"&:hover:not(:disabled)": {
231-
borderColor: colors.gray[1],
232-
background: "none",
233-
},
234-
235-
"&.Mui-disabled": {
236-
color: colors.gray[9],
237-
border: `1px solid ${colors.gray[12]}`,
238-
pointerEvents: "auto",
239-
cursor: "not-allowed",
240-
},
186+
return {
187+
height,
188+
textTransform: "none",
189+
letterSpacing: "normal",
190+
fontWeight: 500,
191+
}
241192
},
242193
},
243194
},
@@ -310,30 +261,6 @@ dark = createTheme(dark, {
310261
},
311262
},
312263
},
313-
MuiInputBase: {
314-
styleOverrides: {
315-
root: {
316-
borderRadius,
317-
},
318-
},
319-
},
320-
MuiOutlinedInput: {
321-
styleOverrides: {
322-
root: {
323-
"& .MuiOutlinedInput-notchedOutline": {
324-
borderColor: dark.palette.divider,
325-
},
326-
327-
"& input:-webkit-autofill": {
328-
WebkitBoxShadow: `0 0 0 1000px ${dark.palette.background.paper} inset`,
329-
},
330-
331-
"&:hover:not(.Mui-focused) .MuiOutlinedInput-notchedOutline": {
332-
borderColor: dark.palette.divider,
333-
},
334-
},
335-
},
336-
},
337264
MuiLink: {
338265
styleOverrides: {
339266
root: {
@@ -352,18 +279,6 @@ dark = createTheme(dark, {
352279
},
353280
},
354281
},
355-
MuiFormHelperText: {
356-
styleOverrides: {
357-
contained: {
358-
marginLeft: 0,
359-
marginRight: 0,
360-
},
361-
362-
marginDense: {
363-
marginTop: 8,
364-
},
365-
},
366-
},
367282
MuiSkeleton: {
368283
styleOverrides: {
369284
root: {
@@ -434,15 +349,35 @@ dark = createTheme(dark, {
434349
},
435350
MuiTextField: {
436351
defaultProps: {
437-
margin: "dense",
438-
variant: "outlined",
439-
spellCheck: false,
352+
InputLabelProps: {
353+
shrink: true,
354+
},
440355
},
441356
},
442-
MuiFormControl: {
357+
MuiInputBase: {
443358
defaultProps: {
444-
variant: "outlined",
445-
margin: "dense",
359+
color: "primary",
360+
},
361+
styleOverrides: {
362+
root: ({ ownerState }) => {
363+
let height: number | undefined = undefined
364+
365+
if (ownerState.size === "medium") {
366+
height = INPUT_HEIGHT
367+
}
368+
369+
return {
370+
height,
371+
}
372+
},
373+
},
374+
},
375+
MuiFormHelperText: {
376+
defaultProps: {
377+
sx: {
378+
marginLeft: 0,
379+
marginTop: 1,
380+
},
446381
},
447382
},
448383
MuiList: {

0 commit comments

Comments
 (0)