Front: Pretty and Lint (#225)

This commit is contained in:
Arthur Jamet
2023-06-17 07:01:23 +01:00
committed by GitHub
parent 399c7d0d9e
commit c5d465df97
94 changed files with 3627 additions and 3089 deletions

View File

@@ -1,24 +1,26 @@
import { Button, Text } from "native-base"
import Translate from "./Translate";
import { Button, Text } from 'native-base';
import Translate from './Translate';
import { RequireExactlyOne } from 'type-fest';
type TextButtonProps = Parameters<typeof Button>[0] & RequireExactlyOne<{
label: string;
translate: Parameters<typeof Translate>[0];
}>
type TextButtonProps = Parameters<typeof Button>[0] &
RequireExactlyOne<{
label: string;
translate: Parameters<typeof Translate>[0];
}>;
const TextButton = (props: TextButtonProps) => {
// accepts undefined variant, as it is the default variant
const textColor = !props.variant || props.variant == 'solid'
? 'light.50'
: undefined;
const textColor = !props.variant || props.variant == 'solid' ? 'light.50' : undefined;
return <Button {...props}>
{ props.label !== undefined
? <Text color={textColor}>{props.label}</Text>
: <Translate color={textColor} {...props.translate} />
}
</Button>
}
return (
<Button {...props}>
{props.label !== undefined ? (
<Text color={textColor}>{props.label}</Text>
) : (
<Translate color={textColor} {...props.translate} />
)}
</Button>
);
};
export default TextButton
export default TextButton;