@im-ian/react-survey
Version:
2018~2019년에 제작했던 React 설문 모듈입니다. 아카이브 용도로 업로드 되었습니다.
69 lines (49 loc) • 1.97 kB
Markdown
2018~2019년에 제작했던 React 설문 모듈입니다. 아카이브 용도로 업로드 되었습니다.
설문 폼을 생성하는 `Editor`와 생성된 폼을 기반으로 응답을 수집하는 `Viewer`가 포함되어 있습니다.

```shell
npm install @im-ian/react-survey
yarn add @im-ian/react-survey
```
```javascript
import { useState } from 'react';
import { Editor, Viewer, EditorType } from '@im-ian/react-survey';
const View = () => {
const [survey, setSurvey] = useState<EditorType.ISurveyResult>();
return (
<>
<Editor onSubmit={survey => setSurvey(survey)} />
{survey && (
<Viewer
survey={survey}
onSubmit={result => {
console.log(result);
}}
/>
)}
</>
);
};
export default View;
```
```css
@import url(https://cdn.syncfusion.com/ej2/material.css);
```
| property | required | value |
| ------------------- | -------- | ------------------------------------------ |
| submitButtonOptions | N | { text: string; visible: boolean; } |
| defaultValue | N | {}: EditorType.ISurveyResult |
| onChange | N | (result: EditorType.ISurveyResult) => void |
| onSubmit | N | (result: EditorType.ISurveyResult) => void |
| property | required | value |
| ------------------- | -------- | ------------------------------------------ |
| survey | Y | EditorType.ISurveyResult |
| submitButtonOptions | N | { text: string; visible: boolean; } |
| onSubmit | N | (result: EditorType.ISurveyResult) => void |