mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-18 23:43:55 +01:00
Custom HTTP method names
This commit is contained in:
@@ -10,10 +10,11 @@ export interface PromptProps {
|
||||
onResult: (value: string) => void;
|
||||
label: InputProps['label'];
|
||||
name: InputProps['name'];
|
||||
defaultValue: InputProps['defaultValue'];
|
||||
defaultValue?: InputProps['defaultValue'];
|
||||
placeholder?: InputProps['placeholder'];
|
||||
}
|
||||
|
||||
export function Prompt({ onHide, label, name, defaultValue, onResult }: PromptProps) {
|
||||
export function Prompt({ onHide, label, name, defaultValue, placeholder, onResult }: PromptProps) {
|
||||
const [value, setValue] = useState<string>(defaultValue ?? '');
|
||||
const handleSubmit = useCallback(
|
||||
(e: FormEvent<HTMLFormElement>) => {
|
||||
@@ -33,6 +34,7 @@ export function Prompt({ onHide, label, name, defaultValue, onResult }: PromptPr
|
||||
hideLabel
|
||||
require
|
||||
autoSelect
|
||||
placeholder={placeholder}
|
||||
label={label}
|
||||
name={name}
|
||||
defaultValue={defaultValue}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { dialog } from '@tauri-apps/api';
|
||||
import type { DialogProps } from '../components/core/Dialog';
|
||||
import { useDialog } from '../components/DialogContext';
|
||||
import type { PromptProps } from './Prompt';
|
||||
@@ -11,20 +12,17 @@ export function usePrompt() {
|
||||
name,
|
||||
label,
|
||||
defaultValue,
|
||||
}: {
|
||||
title: DialogProps['title'];
|
||||
description?: DialogProps['description'];
|
||||
name: PromptProps['name'];
|
||||
label: PromptProps['label'];
|
||||
defaultValue: PromptProps['defaultValue'];
|
||||
}) =>
|
||||
placeholder,
|
||||
}: Pick<DialogProps, 'title' | 'description'> &
|
||||
Pick<PromptProps, 'name' | 'label' | 'defaultValue' | 'placeholder'>) =>
|
||||
new Promise((onResult: PromptProps['onResult']) => {
|
||||
dialog.show({
|
||||
title,
|
||||
description,
|
||||
hideX: true,
|
||||
size: 'sm',
|
||||
render: ({ hide }) => Prompt({ onHide: hide, onResult, name, label, defaultValue }),
|
||||
render: ({ hide }) =>
|
||||
Prompt({ onHide: hide, onResult, name, label, defaultValue, placeholder }),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user