summaryrefslogtreecommitdiffhomepage
path: root/cloud/web/src/ui/dialog-string.tsx
diff options
context:
space:
mode:
authorFrank <[email protected]>2025-08-29 23:32:17 -0400
committerFrank <[email protected]>2025-08-29 23:32:17 -0400
commit37f284f9a97d3354143d64fc76c2eb9f7d9ccf9e (patch)
tree053db9abcb2178c71b22ebeadd07f920750ef5d2 /cloud/web/src/ui/dialog-string.tsx
parent0178eab29bda2f1b37a29543cd313ede48ad3977 (diff)
downloadopencode-37f284f9a97d3354143d64fc76c2eb9f7d9ccf9e.tar.gz
opencode-37f284f9a97d3354143d64fc76c2eb9f7d9ccf9e.zip
wip: cloud
Diffstat (limited to 'cloud/web/src/ui/dialog-string.tsx')
-rw-r--r--cloud/web/src/ui/dialog-string.tsx70
1 files changed, 0 insertions, 70 deletions
diff --git a/cloud/web/src/ui/dialog-string.tsx b/cloud/web/src/ui/dialog-string.tsx
deleted file mode 100644
index af2174786..000000000
--- a/cloud/web/src/ui/dialog-string.tsx
+++ /dev/null
@@ -1,70 +0,0 @@
-import { z } from "zod"
-import { onMount } from "solid-js"
-import { createDialog } from "./context-dialog"
-import { Button } from "./button"
-
-export const DialogString = createDialog({
- size: "sm",
- schema: z.object({
- title: z.string(),
- placeholder: z.string(),
- action: z.string(),
- onSubmit: z.function().args(z.string()).returns(z.void()),
- }),
- render: (ctx) => {
- let input: HTMLInputElement
- onMount(() => {
- setTimeout(() => {
- input.focus()
- input.value = ""
- }, 50)
- })
-
- function submit() {
- const value = input.value.trim()
- if (value) {
- ctx.input.onSubmit(value)
- ctx.control.close()
- }
- }
-
- return (
- <>
- <div data-slot="header">
- <label
- data-size="md"
- data-slot="title"
- data-component="label"
- for={`dialog-string-${ctx.input.title}`}
- >
- {ctx.input.title}
- </label>
- </div>
- <div data-slot="main">
- <input
- data-slot="input"
- data-size="lg"
- data-component="input"
- ref={(r) => (input = r)}
- placeholder={ctx.input.placeholder}
- id={`dialog-string-${ctx.input.title}`}
- onKeyDown={(e) => {
- if (e.key === "Enter") {
- e.preventDefault()
- submit()
- }
- }}
- />
- </div>
- <div data-slot="footer">
- <Button size="md" color="ghost" onClick={() => ctx.control.close()}>
- Cancel
- </Button>
- <Button size="md" color="secondary" onClick={submit}>
- {ctx.input.action}
- </Button>
- </div>
- </>
- )
- },
-})