-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOrkestratorOpplysning.tsx
37 lines (30 loc) · 1.27 KB
/
OrkestratorOpplysning.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { IOrkestratorBarnOpplysning } from "~/models/orkestrator-opplysning.server";
import { OrkestratorOpplysningTekst } from "./OrkestratorOpplysningTekst";
import { OrkestratorOpplysningLand } from "./OrkestratorOpplysningLand";
import { OrkestratorOpplysningBoolsk } from "./OrkestratorOpplysningBoolsk";
import { OrkestratorOpplysningDato } from "./OrkestratorOpplysningDato";
import { FormScope } from "@rvf/remix";
import { logger } from "~/utils/logger.utils";
interface IProps {
opplysning: IOrkestratorBarnOpplysning;
formScope: FormScope<string>;
}
export function OrkestratorOpplysning({ opplysning, formScope }: IProps) {
switch (opplysning.datatype) {
case "tekst":
return <OrkestratorOpplysningTekst opplysning={opplysning} formScope={formScope} />;
case "land":
return <OrkestratorOpplysningLand opplysning={opplysning} formScope={formScope} />;
case "boolsk":
return <OrkestratorOpplysningBoolsk opplysning={opplysning} formScope={formScope} />;
case "dato":
return <OrkestratorOpplysningDato opplysning={opplysning} formScope={formScope} />;
default:
logger.error(`Ukjent orkestrator datatype ${opplysning.datatype}`);
return (
<>
{opplysning.id}: {opplysning.verdi}
</>
);
}
}