chore: switch to react-router v7

This commit is contained in:
Aarnav Tale 2024-12-31 10:30:14 +05:30
parent 39504e2487
commit aa9872a45b
No known key found for this signature in database
101 changed files with 3825 additions and 6796 deletions

View file

@ -1,18 +1,18 @@
import { XIcon } from '@primer/octicons-react'
import { Form, useSubmit } from '@remix-run/react'
import { useState } from 'react'
import { XIcon } from '@primer/octicons-react';
import { Form, useSubmit } from 'react-router';
import { useState } from 'react';
import Button from '~/components/Button'
import Code from '~/components/Code'
import Dialog from '~/components/Dialog'
import Button from '~/components/Button';
import Code from '~/components/Code';
import Dialog from '~/components/Dialog';
interface Props {
username: string
username: string;
}
export default function Remove({ username }: Props) {
const submit = useSubmit()
const dialogState = useState(false)
const submit = useSubmit();
const dialogState = useState(false);
return (
<>
@ -25,41 +25,26 @@ export default function Remove({ username }: Props) {
</Button>
<Dialog control={dialogState}>
<Dialog.Panel control={dialogState}>
{close => (
{(close) => (
<>
<Dialog.Title>
Delete
{' '}
{username}
?
</Dialog.Title>
<Dialog.Title>Delete {username}?</Dialog.Title>
<Dialog.Text className="mb-8">
Are you sure you want to delete
{' '}
{username}
?
{' '}
A deleted user cannot be recovered.
Are you sure you want to delete {username}? A deleted user
cannot be recovered.
</Dialog.Text>
<Form
method="POST"
onSubmit={(event) => {
submit(event.currentTarget)
submit(event.currentTarget);
}}
>
<input type="hidden" name="_method" value="delete" />
<input type="hidden" name="username" value={username} />
<div className="mt-6 flex justify-end gap-2 mt-6">
<Dialog.Action
variant="cancel"
onPress={close}
>
<Dialog.Action variant="cancel" onPress={close}>
Cancel
</Dialog.Action>
<Dialog.Action
variant="confirm"
onPress={close}
>
<Dialog.Action variant="confirm" onPress={close}>
Delete
</Dialog.Action>
</div>
@ -69,5 +54,5 @@ export default function Remove({ username }: Props) {
</Dialog.Panel>
</Dialog>
</>
)
);
}