mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-11-24 21:55:38 +08:00
737f1b0189
* feat: add a close button to the modal * fix: replace modal close icon
51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
import { IconX } from '@tabler/icons-solidjs'
|
|
import { Component, Show } from 'solid-js'
|
|
import { MODAL } from '~/constants'
|
|
import { allConnections } from '~/signals'
|
|
import { Button } from './Button'
|
|
|
|
export const ConnectionsTableDetailsModal: Component<{
|
|
selectedConnectionID?: string
|
|
}> = (props) => {
|
|
const modalID = MODAL.CONNECTIONS_TABLE_DETAILS
|
|
|
|
return (
|
|
<dialog id={modalID} class="modal modal-bottom sm:modal-middle">
|
|
<div class="modal-box">
|
|
<div class="sticky top-0 z-50 flex items-center justify-end">
|
|
<Button
|
|
class="btn-circle btn-sm"
|
|
onClick={() => {
|
|
const modal = document.querySelector(
|
|
`#${modalID}`,
|
|
) as HTMLDialogElement | null
|
|
|
|
modal?.close()
|
|
}}
|
|
>
|
|
<IconX size={20} />
|
|
</Button>
|
|
</div>
|
|
|
|
<Show when={props.selectedConnectionID}>
|
|
<pre>
|
|
<code>
|
|
{JSON.stringify(
|
|
allConnections().find(
|
|
({ id }) => id === props.selectedConnectionID,
|
|
),
|
|
null,
|
|
2,
|
|
)}
|
|
</code>
|
|
</pre>
|
|
</Show>
|
|
</div>
|
|
|
|
<form method="dialog" class="modal-backdrop">
|
|
<button />
|
|
</form>
|
|
</dialog>
|
|
)
|
|
}
|