ported parts of node editor

This commit is contained in:
ari committed 2021-12-01 17:07:43 -05:00
1 parent 0764feb432
commit 59542abad7
11 files changed
+227 -75

No files matched your search

-19
View File
@@ -1,25 +1,6 @@
import { ButtonHTMLAttributes, FC } from "react";
import { createAppUseStyles } from "styles/theme";
import { useButtonStyles } from "./styles";
// const useButtonStyles = createAppUseStyles(theme => ({
// button: {
// backgroundColor: theme.secondary,
// color: theme.primaryAccent,
// borderColor: theme.primaryAccent,
// borderStyle: 'solid',
// borderWidth: 1,
// padding: '2.5%',
// marginLeft: '5%',
// marginRight: '5%',
// borderRadius: '5px',
// cursor: 'pointer',
// '&:hover': {
// backgroundColor: theme.primary,
// borderColor: theme.secondaryAccent,
// }
// }
// }))
export const Button: FC<ButtonHTMLAttributes<HTMLButtonElement>> = props => {
const { classes } = useButtonStyles({});
return <button {...props} className={`${classes.input} ${props.className ?? ''}`} />
+22 -22
View File
@@ -3,28 +3,28 @@ import { useInputListStyles } from "./styles";
export interface Props<T extends string> {
current: T;
options: readonly T[];
onChange: (n: T) => void;
id?: string;
className?: string;
label: string;
current: T;
options: readonly T[];
onChange: (n: T) => void;
id?: string;
className?: string;
label: string;
}
export default function InputList<T extends string>({
current, options, onChange, label,
...selattr
current, options, onChange, label,
...selattr
}: Props<T>) {
const {classes} = useInputListStyles({});
return <InputWrapper label={label} labelSize={'small'} noMargin>
<select
className={classes.input}
{...selattr} value={current}
onChange={e => {
e.preventDefault();
onChange(e.currentTarget.value);
}}
>
{options.map((t, i) => <option id={String(i)} key={i}>{t}</option>)}
</select>
</InputWrapper>
}
const { classes } = useInputListStyles({});
return <InputWrapper label={label} labelSize={'small'} noMargin>
<select
className={classes.input}
{...selattr} value={current}
onChange={e => {
e.preventDefault();
onChange(e.currentTarget.value as any);
}}
>
{options.map((t, i) => <option id={String(i)} key={i}>{t}</option>)}
</select>
</InputWrapper>
}
+6 -1
View File
@@ -28,7 +28,11 @@ const commonInputStyle = (theme: AppTheme) => ({
})
export const useButtonStyles = createAppUseStyles<{}>(theme => ({
...commonInputStyle(theme),
input: {
...commonInputStyle(theme).input,
paddingTop: '2%',
paddingBottom: '2%',
},
}));
export const useInputWrapperStyles = createAppUseStyles<{
@@ -50,6 +54,7 @@ export const useInputWrapperStyles = createAppUseStyles<{
top: labelSize === 'normal' ? '0.5em' : '0.25em',
fontWeight: 'bold',
transition: 'all 200ms',
color: theme.primaryAccent,
})
}
})