import { Form, useSubmit } from 'react-router'; import { useState } from 'react'; import Code from '~/components/Code'; import Dialog from '~/components/Dialog'; import TextField from '~/components/TextField'; interface Props { magic?: string; } export default function Add({ magic }: Props) { const [username, setUsername] = useState(''); const submit = useSubmit(); return ( Add a new user {(close) => ( <> Add a new user Enter a username to create a new user.{' '} {magic ? ( <> Since Magic DNS is enabled, machines will be accessible via{' '} [machine]. .{magic}. ) : undefined}
{ submit(event.currentTarget); setUsername(''); }} > Cancel Create )}
); }