mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-27 19:37:07 +02:00
prettify, sorry for the big ass commit
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Wrapper around material-ui's TextField component that styles it with
|
||||
* Wrapper around material-ui's TextField component that styles it with
|
||||
* Bitburner's UI theme
|
||||
*/
|
||||
|
||||
@@ -7,71 +7,75 @@ import React from "react";
|
||||
import { makeStyles, TextField, TextFieldProps } from "@material-ui/core";
|
||||
|
||||
const backgroundColorStyles = {
|
||||
backgroundColor: 'rgba(57, 54, 54, 0.9)',
|
||||
'&:hover': {
|
||||
backgroundColor: 'rgba(70, 70, 70, 0.9)',
|
||||
},
|
||||
backgroundColor: "rgba(57, 54, 54, 0.9)",
|
||||
"&:hover": {
|
||||
backgroundColor: "rgba(70, 70, 70, 0.9)",
|
||||
},
|
||||
};
|
||||
|
||||
const formControlStyles = {
|
||||
border: '1px solid #e2e2e1',
|
||||
overflow: 'hidden',
|
||||
borderRadius: 4,
|
||||
color: 'white',
|
||||
...backgroundColorStyles,
|
||||
border: "1px solid #e2e2e1",
|
||||
overflow: "hidden",
|
||||
borderRadius: 4,
|
||||
color: "white",
|
||||
...backgroundColorStyles,
|
||||
};
|
||||
|
||||
const useStyles = makeStyles({
|
||||
root: {
|
||||
...formControlStyles,
|
||||
},
|
||||
root: {
|
||||
...formControlStyles,
|
||||
},
|
||||
});
|
||||
|
||||
const useInputStyles = makeStyles({
|
||||
root: {
|
||||
...backgroundColorStyles,
|
||||
color: 'white',
|
||||
},
|
||||
focused: {
|
||||
backgroundColor: 'rgba(70, 70, 70, 0.9)',
|
||||
},
|
||||
disabled: {
|
||||
color: 'white',
|
||||
},
|
||||
root: {
|
||||
...backgroundColorStyles,
|
||||
color: "white",
|
||||
},
|
||||
focused: {
|
||||
backgroundColor: "rgba(70, 70, 70, 0.9)",
|
||||
},
|
||||
disabled: {
|
||||
color: "white",
|
||||
},
|
||||
});
|
||||
|
||||
const useLabelStyles = makeStyles({
|
||||
root: {
|
||||
color: 'white',
|
||||
},
|
||||
focused: {
|
||||
color: 'white !important', // Need important to override styles from FormLabel
|
||||
},
|
||||
disabled: {
|
||||
color: 'white !important', // Need important to override styles from FormLabel
|
||||
},
|
||||
})
|
||||
root: {
|
||||
color: "white",
|
||||
},
|
||||
focused: {
|
||||
color: "white !important", // Need important to override styles from FormLabel
|
||||
},
|
||||
disabled: {
|
||||
color: "white !important", // Need important to override styles from FormLabel
|
||||
},
|
||||
});
|
||||
|
||||
export const MuiTextField: React.FC<TextFieldProps> = (props: TextFieldProps) => {
|
||||
return (
|
||||
<TextField {...props}
|
||||
classes={{
|
||||
...useStyles(),
|
||||
...props.classes,
|
||||
}}
|
||||
InputProps={{
|
||||
classes: {
|
||||
...useInputStyles(),
|
||||
...props.InputProps?.classes,
|
||||
},
|
||||
...props.InputProps,
|
||||
}}
|
||||
InputLabelProps={{
|
||||
classes: {
|
||||
...useLabelStyles(),
|
||||
...props.InputLabelProps?.classes,
|
||||
},
|
||||
...props.InputLabelProps,
|
||||
}} />
|
||||
)
|
||||
}
|
||||
export const MuiTextField: React.FC<TextFieldProps> = (
|
||||
props: TextFieldProps,
|
||||
) => {
|
||||
return (
|
||||
<TextField
|
||||
{...props}
|
||||
classes={{
|
||||
...useStyles(),
|
||||
...props.classes,
|
||||
}}
|
||||
InputProps={{
|
||||
classes: {
|
||||
...useInputStyles(),
|
||||
...props.InputProps?.classes,
|
||||
},
|
||||
...props.InputProps,
|
||||
}}
|
||||
InputLabelProps={{
|
||||
classes: {
|
||||
...useLabelStyles(),
|
||||
...props.InputLabelProps?.classes,
|
||||
},
|
||||
...props.InputLabelProps,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user