@im-ian/react-survey
Version:
2018~2019년에 제작했던 React 설문 모듈입니다. 아카이브 용도로 업로드 되었습니다.
61 lines (51 loc) • 1.35 kB
text/typescript
import { FilePondErrorDescription, FilePondFile } from "filepond";
import { SelectableOption } from "../../@types/block";
export interface SelectorProps<T = SelectableOption[]> {
items: T;
selectedIndex?: number;
onChange?: (value: SelectableOption, index: number) => void;
}
export interface OptionProps {
isChecked: boolean;
}
export interface OptionEditorProps<T = SelectableOption[]> {
items: T;
onChange?: (update: T) => void;
}
export interface CheckBoxProps {
shape: "square" | "circle";
value: boolean;
onChange?: (value: boolean) => void;
}
type SelectMode = "multiple" | "single";
export interface OptionSelectorProps<
M extends SelectMode,
I = SelectableOption,
S = M extends "multiple" ? string[] : string | null
> {
items: I[];
value: S;
onChange?: (select: S) => void;
}
export interface SwitchProps {
width?: number;
disabled?: boolean;
value?: boolean;
onChange?: (value: boolean) => void;
}
export interface RangeSelectorProps {
min: number;
max: number;
value: number;
onChange?: (value: number) => void;
}
export interface FileUploaderProps {
files: string[];
multiple: boolean;
onAddFile?: (file: FilePondFile) => void;
onRemoveFile?: (file: FilePondFile) => void;
onError?: (
error: FilePondErrorDescription,
file: FilePondFile | undefined
) => void;
}