This commit is contained in:
ari committed 2022-07-04 22:40:20 -04:00
1 parent 905a5ac4d7
commit 550795bf7f
3 files changed
+120 -189

No files matched your search

+120 -185
View File
@@ -5,10 +5,10 @@ const commonInputStyle = (theme: AppTheme) => ({
backgroundColor: theme.secondary,
color: theme.secondaryAccent,
borderColor: theme.primaryAccent,
borderStyle: 'solid',
borderStyle: "solid",
borderWidth: 1,
borderRadius: 5,
padding: '1em',
padding: "1em",
fontSize: 16,
"&:hover": {
@@ -16,91 +16,93 @@ const commonInputStyle = (theme: AppTheme) => ({
borderColor: theme.secondaryAccent,
},
"&:disabled": {
backgroundColor: '#403f3f',
borderColor: '#403f3f',
cursor: 'not-allowed',
backgroundColor: "#403f3f",
borderColor: "#403f3f",
cursor: "not-allowed",
},
}
})
},
});
export const useButtonStyles = createAppUseStyles<{}>(theme => ({
export const useButtonStyles = createAppUseStyles<{}>((theme) => ({
input: {
...commonInputStyle(theme).input,
paddingTop: '0.5em',
paddingBottom: '0.5em',
cursor: 'pointer',
paddingTop: "0.5em",
paddingBottom: "0.5em",
cursor: "pointer",
},
}));
export const useInputWrapperStyles = createAppUseStyles<{
labelSize: 'normal' | 'small',
noMargin: boolean,
hasError: boolean,
}>(theme => {
labelSize: "normal" | "small";
noMargin: boolean;
hasError: boolean;
}>((theme) => {
return {
wrapper: ({ noMargin }) => ({
position: 'relative',
display: 'flex',
flexDirection: 'column',
marginTop: noMargin ? 0 : '0.5em',
marginBottom: noMargin ? 0 : '0.5em',
position: "relative",
display: "flex",
flexDirection: "column",
marginTop: noMargin ? 0 : "0.5em",
marginBottom: noMargin ? 0 : "0.5em",
}),
label: ({ labelSize }) => ({
fontSize: labelSize === 'normal' ? 16 : 10,
position: 'absolute',
left: labelSize === 'normal' ? '0.75em' : '1em',
top: labelSize === 'normal' ? '0.5em' : '0.25em',
fontWeight: 'bold',
fontSize: labelSize === "normal" ? 16 : 10,
position: "absolute",
left: labelSize === "normal" ? "0.75em" : "1em",
top: labelSize === "normal" ? "0.5em" : "0.25em",
fontWeight: "bold",
color: theme.primaryAccent,
}),
error: ({ hasError }) => (hasError ? {
textAlign: 'center',
color: theme.red,
padding: '0.25em',
border: `1px solid ${theme.red}`,
borderTop: 'none',
borderBottomRightRadius: 5,
borderBottomLeftRadius: 5,
} : {})
}
})
error: ({ hasError }) =>
hasError
? {
textAlign: "center",
color: theme.red,
padding: "0.25em",
border: `1px solid ${theme.red}`,
borderTop: "none",
borderBottomRightRadius: 5,
borderBottomLeftRadius: 5,
}
: {},
};
});
export const useInputTextStyles = createAppUseStyles<{}>(theme => ({
export const useInputTextStyles = createAppUseStyles<{}>((theme) => ({
...commonInputStyle(theme),
}));
export const useInputTimeStyles = createAppUseStyles<{}>(theme => ({
export const useInputTimeStyles = createAppUseStyles<{}>((theme) => ({
input: {
...commonInputStyle(theme).input,
flex: 1,
},
wrapper: {
flexDirection: 'row !important',
justifyContent: 'center',
alignItems: 'center',
flexDirection: "row !important",
justifyContent: "center",
alignItems: "center",
},
cancel: {
cursor: 'pointer',
cursor: "pointer",
maxWidth: "2em",
maxHeight: "2em",
fontSize: '1em',
fontSize: "1em",
padding: "0.25em 0.5em",
borderRadius: '20px',
borderRadius: "20px",
background: theme.primary,
color: theme.primaryAccent,
borderColor: theme.primaryAccent,
borderStyle: "solid",
borderWidth: '1.5px',
borderWidth: "1.5px",
},
}));
export const useInputNumberStyles = createAppUseStyles<{}>(theme => {
export const useInputNumberStyles = createAppUseStyles<{}>((theme) => {
const styles = commonInputStyle(theme);
return {
input: {
...styles.input,
textAlign: 'center'
textAlign: "center",
},
deleteIcon: {
position: "absolute",
@@ -109,207 +111,140 @@ export const useInputNumberStyles = createAppUseStyles<{}>(theme => {
color: theme.secondaryAccent,
backgroundColor: theme.secondary,
borderWidth: 1,
borderStyle: 'solid',
borderStyle: "solid",
borderColor: theme.secondaryAccent,
borderRadius: 5,
cursor: 'pointer',
cursor: "pointer",
padding: "1px 5px",
"&:hover": {
backgroundColor: theme.primary,
}
},
},
}
};
});
export const useInputListStyles = createAppUseStyles<{
invalidCurrent: boolean;
}>(theme => {
}>((theme) => {
const styles = commonInputStyle(theme);
return {
input: ({ invalidCurrent }) => ({
...styles.input,
cursor: 'pointer',
cursor: "pointer",
borderColor: invalidCurrent ? theme.redAccent : styles.input.borderColor,
color: invalidCurrent ? theme.redLight : styles.input.color,
}),
}
};
});
export const useInputMultiSelectStyles = createAppUseStyles<{
open: boolean;
selected: number[];
maxedOut: boolean;
}>(theme => {
}>((theme) => {
const styles = commonInputStyle(theme);
return {
root: {
},
root: {},
input: {
...styles.input,
position: 'relative',
cursor: 'pointer',
display: 'flex',
gap: '1em',
position: "relative",
cursor: "pointer",
display: "flex",
gap: "1em",
"&> label": {
cursor: 'pointer',
userSelect: 'none',
cursor: "pointer",
userSelect: "none",
},
"&:hover": {
color: theme.primaryAccent,
}
},
},
numberSelected: (({ selected }) => ({
display: selected.length > 0 ? 'block' : 'none',
numberSelected: ({ selected }) => ({
display: selected.length > 0 ? "block" : "none",
background: theme.primary,
borderColor: theme.primaryAccent,
borderStyle: 'solid',
borderWidth: '1px',
borderRadius: '60%',
padding: '0em 0.4em'
})),
optionsWrapper: (({ open }) => ({
borderStyle: "solid",
borderWidth: "1px",
borderRadius: "60%",
padding: "0em 0.4em",
}),
optionsWrapper: ({ open }) => ({
background: theme.primary,
borderColor: theme.primaryAccent,
borderStyle: "solid",
borderWidth: 1,
position: 'absolute',
display: open ? 'flex' : 'none',
flexDirection: 'column',
gap: '0.25em',
left: '0',
top: 'calc(100% + 0.25em)',
userSelect: 'none',
overflow: 'hidden',
position: "absolute",
display: open ? "flex" : "none",
flexDirection: "column",
gap: "0.25em",
left: "0",
top: "calc(100% + 0.25em)",
userSelect: "none",
overflow: "hidden",
width: "100%",
zIndex: 10,
})),
arrow: (({ open }) => ({
position: 'absolute',
right: '1em',
top: '1em',
transform: open ? 'rotate(90deg)' : 'rotate(270deg)',
})),
option: (({ maxedOut }) => ({
display: 'flex',
flexDirection: 'row',
gap: '0.25em',
width: '100%',
padding: '0.25em 0.5em',
}),
arrow: ({ open }) => ({
position: "absolute",
right: "1em",
top: "1em",
transform: open ? "rotate(90deg)" : "rotate(270deg)",
}),
option: ({ maxedOut }) => ({
display: "flex",
flexDirection: "row",
gap: "0.25em",
width: "100%",
padding: "0.25em 0.5em",
'&.unselected span:nth-child(2)': {
display: 'none'
"&.unselected span:nth-child(2)": {
display: "none",
},
'&.selected span:nth-child(2)': {
"&.selected span:nth-child(2)": {
background: theme.primary,
borderColor: theme.primaryAccent,
borderStyle: 'solid',
borderWidth: '1px',
borderRadius: '40%',
padding: '0em 0.4em'
borderStyle: "solid",
borderWidth: "1px",
borderRadius: "40%",
padding: "0em 0.4em",
},
'&.unselected': {
cursor: maxedOut ? 'not-allowed' : 'pointer',
"&.unselected": {
cursor: maxedOut ? "not-allowed" : "pointer",
},
'&.selected': {
cursor: 'pointer',
"&.selected": {
cursor: "pointer",
},
"&:hover": {
color: theme.secondary,
backgroundColor: theme.secondaryAccent,
}
})),
}
},
}),
};
});
export const useInputTextAreaStyles = createAppUseStyles<{ resizable: boolean }>(theme => {
export const useInputTextAreaStyles = createAppUseStyles<{
resizable: boolean;
}>((theme) => {
const styles = commonInputStyle(theme);
return {
input: ({ resizable }) => ({
...styles.input,
resize: resizable ? 'both' : 'none',
resize: resizable ? "both" : "none",
minWidth: "calc(100% - 2em)",
maxWidth: "calc(100% - 2em)",
minHeight: "8em"
})
}
minHeight: "8em",
}),
};
});
export const useInputViewEditStyles = createAppUseStyles<{
isEditing: boolean;
}>(theme => ({
}>((theme) => ({
...commonInputStyle(theme),
inputView: {
},
checkmark: {
},
pencil: {
}
inputView: {},
checkmark: {},
pencil: {},
}));
export const useInputBubblesStyles = createAppUseStyles<{}>(theme => ({
bubbles: {
display: 'flex',
flexDirection: 'row',
maxHeight: 50,
maxWidth: '100%',
overflowX: 'auto',
overflowY: 'hidden',
scrollbarWidth: 'thin',
},
bubble: {
position: 'relative',
border: `1px solid ${theme.primaryAccent}`,
borderRadius: 10,
backgroundColor: theme.greenOpaque,
color: theme.primaryLight,
fontSize: 16,
marginLeft: 1,
padding: 5,
width: 'fit-content',
whiteSpace: 'nowrap',
cursor: 'pointer',
"&:hover": {
backgroundColor: theme.redOpaque,
color: theme.primaryLightOpaque,
},
"&:hover $deleteIcon": {
display: 'block',
}
},
deleteIcon: {
display: 'none',
position: "absolute",
left: "48%",
top: 5,
color: "white",
},
addBtn: {
position: "absolute",
top: 10,
right: 10,
fontSize: 20,
cursor: 'pointer',
borderStyle: 'solid',
borderWidth: 1,
borderColor: theme.secondary,
backgroundColor: theme.secondary,
color: theme.secondaryAccent,
padding: "3px 7px",
"&:hover": {
borderRadius: 100,
backgroundColor: theme.greenOpaque,
borderColor: theme.secondaryAccent,
},
}
}));