import { UxTask } from 'App/services/UxtestingService'; import React from 'react'; import { Button, Input, Switch, Typography } from 'antd'; function StepsModal({ onAdd, onHide, editTask, typingEnabled, }: { onAdd: (step: UxTask) => void; onHide: () => void; editTask?: UxTask; typingEnabled?: boolean; }) { const [title, setTitle] = React.useState(editTask?.title ?? ''); const [description, setDescription] = React.useState(editTask?.description ?? ''); const [isAnswerEnabled, setIsAnswerEnabled] = React.useState(editTask?.allowTyping ?? typingEnabled); const save = () => { onAdd({ title: title, description: description || '', allowTyping: Boolean(isAnswerEnabled), }); onHide(); }; return (
Add a task or question
Title/Question setTitle(e.target.value)} placeholder={'Task title'} className={'mb-4'} /> Instructions setDescription(e.target.value)} placeholder={'Task instructions'} className={'mb-4'} /> Allow participants to type an answer setIsAnswerEnabled(checked)} checkedChildren="Yes" unCheckedChildren="No" />
Enabling this option will show a text field for participants to type their answer.
); } export default StepsModal;