Front: Typecheck Elements

This commit is contained in:
Arthur Jamet
2023-06-08 10:42:59 +01:00
parent ff0fc7a8ae
commit 63d4b10ebb
8 changed files with 1438 additions and 1204 deletions
+5 -25
View File
@@ -2,14 +2,7 @@ import React from "react";
import { StyleProp, ViewStyle } from "react-native";
import { Element } from "./Element";
import useColorScheme from "../../hooks/colorScheme";
import {
ElementTextProps,
ElementToggleProps,
ElementDropdownProps,
ElementRangeProps,
ElementType,
} from "./ElementTypes";
import { ElementProps } from "./ElementTypes";
import {
Box,
@@ -17,21 +10,6 @@ import {
Divider,
} from "native-base";
export type ElementProps = {
title: string;
icon?: React.ReactNode;
type?: ElementType;
helperText?: string;
description?: string;
disabled?: boolean;
data?:
| ElementTextProps
| ElementToggleProps
| ElementDropdownProps
| ElementRangeProps
| React.ReactNode;
};
type ElementListProps = {
elements: ElementProps[];
style?: StyleProp<ViewStyle>;
@@ -42,9 +20,11 @@ const ElementList = ({ elements, style }: ElementListProps) => {
const isDark = colorScheme === "dark";
const elementStyle = {
borderRadius: 10,
boxShadow: isDark ? "0px 0px 3px 0px rgba(255,255,255,0.6)" : "0px 0px 3px 0px rgba(0,0,0,0.4)",
boxShadow: isDark
? "0px 0px 3px 0px rgba(255,255,255,0.6)"
: "0px 0px 3px 0px rgba(0,0,0,0.4)",
overflow: "hidden",
};
} as const;
return (
<Column style={[style, elementStyle]}>