import React from "react"; import { Alert, Button, Checkbox, DatePicker, DateRangePicker, FileUploader, Input, Radio, RadioGroup, Select, Switch, TextArea, useToastProvider, VariantType, } from "@openfun/cunningham-react"; import { faker } from "@faker-js/faker"; import { Character, database, randomDates } from "./Character"; import { Page, PageProps } from "./App"; export const Create = ({ changePage }: PageProps) => { const { toast } = useToastProvider(); const inputRef = React.useRef(null); const submit = () => { const character: Character = { id: faker.string.uuid(), name: inputRef.current?.value || "", gender: "male", isGuest: false, ...randomDates(), }; database.unshift(character); changePage(Page.HOME); toast("Character created successfully", VariantType.SUCCESS); }; return (

Add a character

General Information

You are about to add a new character to the collection