diff --git a/app/components/Action.tsx b/app/components/Action.tsx deleted file mode 100644 index 218302c..0000000 --- a/app/components/Action.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import clsx from 'clsx' -import { type HTMLProps } from 'react' - -type Properties = HTMLProps & { - readonly isDestructive?: boolean; - readonly isDisabled?: boolean; -} - -export default function Action(properties: Properties) { - return ( - - ) -} diff --git a/app/components/Button.tsx b/app/components/Button.tsx new file mode 100644 index 0000000..058df8e --- /dev/null +++ b/app/components/Button.tsx @@ -0,0 +1,26 @@ +import clsx from 'clsx' +import { type ButtonHTMLAttributes, type DetailedHTMLProps } from 'react' + +type Properties = { + readonly variant?: 'emphasized' | 'normal' | 'destructive'; +} & DetailedHTMLProps, HTMLButtonElement> + +export default function Action(properties: Properties) { + return ( + + ) +} diff --git a/app/components/Input.tsx b/app/components/Input.tsx index 21e26d1..2c3e39f 100644 --- a/app/components/Input.tsx +++ b/app/components/Input.tsx @@ -2,7 +2,7 @@ import clsx from 'clsx' import { type DetailedHTMLProps, type InputHTMLAttributes } from 'react' type Properties = { - readonly isEmbedded?: boolean; + readonly variant?: 'embedded' | 'normal'; } & DetailedHTMLProps, HTMLInputElement> export default function Input(properties: Properties) { @@ -14,11 +14,11 @@ export default function Input(properties: Properties) { 'border-gray-300 dark:border-zinc-700', 'focus:outline-none focus:ring', 'focus:ring-blue-500 dark:focus:ring-blue-300', - properties.isEmbedded ? 'bg-transparent' : 'dark:bg-zinc-800', - properties.isEmbedded ? 'p-0' : 'px-2.5 py-1.5', - properties.isEmbedded ? 'border-none' : 'border', - properties.isEmbedded ? 'focus:ring-0' : 'focus:ring-1', - properties.isEmbedded ? 'rounded-none' : 'rounded-lg', + properties.variant === 'embedded' ? 'bg-transparent' : 'dark:bg-zinc-800', + properties.variant === 'embedded' ? 'p-0' : 'px-2.5 py-1.5', + properties.variant === 'embedded' ? 'border-none' : 'border', + properties.variant === 'embedded' ? 'focus:ring-0' : 'focus:ring-1', + properties.variant === 'embedded' ? 'rounded-none' : 'rounded-lg', properties.className )} /> diff --git a/app/routes/_data.dns._index/domains.tsx b/app/routes/_data.dns._index/domains.tsx index a0a0146..1538fcf 100644 --- a/app/routes/_data.dns._index/domains.tsx +++ b/app/routes/_data.dns._index/domains.tsx @@ -20,7 +20,7 @@ import { useFetcher } from '@remix-run/react' import clsx from 'clsx' import { useEffect, useState } from 'react' -import Action from '~/components/Action' +import Button from '~/components/Button' import Input from '~/components/Input' import TableList from '~/components/TableList' @@ -102,7 +102,7 @@ export default function Domains({ baseDomain, searchDomains }: Properties) { - { fetcher.submit({ // eslint-disable-next-line @typescript-eslint/naming-convention @@ -127,7 +127,7 @@ export default function Domains({ baseDomain, searchDomains }: Properties) { }} > Add - + @@ -177,8 +177,8 @@ function Domain({ domain, id, localDomains, isDrag }: DomainProperties) { {domain}

{isDrag ? undefined : ( - { fetcher.submit({ @@ -191,7 +191,7 @@ function Domain({ domain, id, localDomains, isDrag }: DomainProperties) { }} > Remove - + )} ) diff --git a/app/routes/_data.dns._index/magic.tsx b/app/routes/_data.dns._index/magic.tsx index 2a5076c..d980e1f 100644 --- a/app/routes/_data.dns._index/magic.tsx +++ b/app/routes/_data.dns._index/magic.tsx @@ -3,26 +3,27 @@ import { useFetcher } from '@remix-run/react' import clsx from 'clsx' import { useState } from 'react' +import Button from '~/components/Button' + type Properties = { readonly isEnabled: boolean; - readonly baseDomain: string; } -export default function Modal({ isEnabled, baseDomain }: Properties) { +export default function Modal({ isEnabled }: Properties) { const [isOpen, setIsOpen] = useState(false) const fetcher = useFetcher() return ( <> - + { @@ -39,11 +40,12 @@ export default function Modal({ isEnabled, baseDomain }: Properties) { Devices will no longer be accessible via your tailnet domain. The search domain will also be disabled. - + diff --git a/app/routes/_data.dns._index/rename.tsx b/app/routes/_data.dns._index/rename.tsx index cf79efb..9884fb0 100644 --- a/app/routes/_data.dns._index/rename.tsx +++ b/app/routes/_data.dns._index/rename.tsx @@ -4,6 +4,7 @@ import { Dialog } from '@headlessui/react' import { useFetcher } from '@remix-run/react' import { useState } from 'react' +import Button from '~/components/Button' import Code from '~/components/Code' import Input from '~/components/Input' @@ -32,23 +33,21 @@ export default function Modal({ name }: Properties) { { event.target.select() }} /> - + { diff --git a/app/routes/_data.dns._index/route.tsx b/app/routes/_data.dns._index/route.tsx index 94a6ead..4652031 100644 --- a/app/routes/_data.dns._index/route.tsx +++ b/app/routes/_data.dns._index/route.tsx @@ -4,7 +4,7 @@ import { json, useFetcher, useLoaderData } from '@remix-run/react' import clsx from 'clsx' import { useState } from 'react' -import Action from '~/components/Action' +import Button from '~/components/Button' import Code from '~/components/Code' import Input from '~/components/Input' import TableList from '~/components/TableList' @@ -94,8 +94,8 @@ export default function Page() { // eslint-disable-next-line react/no-array-index-key

{ns}

- { fetcher.submit({ @@ -108,12 +108,12 @@ export default function Page() { }} > Remove - +
))} - { fetcher.submit({ // eslint-disable-next-line @typescript-eslint/naming-convention @@ -138,7 +138,7 @@ export default function Page() { }} > Add - + {/* TODO: Split DNS and Custom A Records */} @@ -162,7 +162,7 @@ export default function Page() { {' '} when Magic DNS is enabled.

- + ) diff --git a/app/routes/_data.tsx b/app/routes/_data.tsx index a414069..0bea678 100644 --- a/app/routes/_data.tsx +++ b/app/routes/_data.tsx @@ -38,7 +38,7 @@ export async function loader({ request }: LoaderFunctionArgs) { export default function Layout() { return ( <> -
+