Browse Source

changed input to text area in options component

develop
Ajay_S 3 years ago
parent
commit
4961364eb4
5 changed files with 9 additions and 11 deletions
  1. +1
    -1
      src/mockData/QuizDetails.ts
  2. +1
    -2
      src/pages/quiz/Options.module.scss
  3. +7
    -5
      src/pages/quiz/Options.tsx
  4. +0
    -1
      src/pages/quiz/Question.module.scss
  5. +0
    -2
      src/pages/quiz/Question.tsx

+ 1
- 1
src/mockData/QuizDetails.ts View File

@@ -46,7 +46,7 @@ const QUIZ_DETAILS: QuizDetails[] = [
options: [], options: [],
answer: ["single threaded"], answer: ["single threaded"],
result: false, result: false,
timeLimit: 40,
timeLimit: 60,
type: "textInput" type: "textInput"
}, },
{ {


+ 1
- 2
src/pages/quiz/Options.module.scss View File

@@ -63,11 +63,10 @@
.textInput { .textInput {
width: 95%; width: 95%;
margin: 0 auto; margin: 0 auto;
width: 30rem;
height: 4rem;
font-size: 1.4rem; font-size: 1.4rem;
border-radius: 2.5rem; border-radius: 2.5rem;
padding-left: 2rem; padding-left: 2rem;
padding-top: 2rem;
} }


ion-item { ion-item {


+ 7
- 5
src/pages/quiz/Options.tsx View File

@@ -19,7 +19,7 @@ const Options: React.FC<OwnProps> = (props) => {
const [selectedOptions, setSelectedOptions] = useState<string[]>([]); const [selectedOptions, setSelectedOptions] = useState<string[]>([]);
const [textInput, setTextInput] = useState<string>(""); const [textInput, setTextInput] = useState<string>("");
const [answers, setAnswers] = useState<number>(0); const [answers, setAnswers] = useState<number>(0);
const inputRef = useRef<HTMLInputElement>(null);
const inputRef = useRef<HTMLTextAreaElement>(null);


useEffect(() => { useEffect(() => {
setSelected(undefined); setSelected(undefined);
@@ -98,12 +98,14 @@ const Options: React.FC<OwnProps> = (props) => {
} }
{props.type === "textInput" && {props.type === "textInput" &&
<div className={styles.options}> <div className={styles.options}>
<input
type="text"
<textarea
className={styles.textInput} className={styles.textInput}
placeholder="enter your answer"
rows={20}
cols={35}
placeholder="enter your answer here"
ref={inputRef} ref={inputRef}
onChange={handleInput} />
onChange={handleInput}>
</textarea>
</div> </div>
} }
</IonList> </IonList>


+ 0
- 1
src/pages/quiz/Question.module.scss View File

@@ -1,5 +1,4 @@
section { section {

.questionHolder { .questionHolder {
display: flex; display: flex;
flex-direction: column; flex-direction: column;


+ 0
- 2
src/pages/quiz/Question.tsx View File

@@ -14,7 +14,6 @@ interface OwnProp {
const Question: React.FC<OwnProp> = (props) => { const Question: React.FC<OwnProp> = (props) => {


const [seconds, setSeconds] = useState<number>(props.timeLimit); const [seconds, setSeconds] = useState<number>(props.timeLimit);
const [duration, setDuration] = useState<number>(props.timeLimit);
const displaySeconds = seconds % 60; const displaySeconds = seconds % 60;
const percentage = Math.round(seconds / props.timeLimit * 100); const percentage = Math.round(seconds / props.timeLimit * 100);
const time = `${secondsToMinutes(seconds).toString().padStart(2, '0')}:${displaySeconds.toString().padStart(2, '0')}` const time = `${secondsToMinutes(seconds).toString().padStart(2, '0')}:${displaySeconds.toString().padStart(2, '0')}`
@@ -22,7 +21,6 @@ const Question: React.FC<OwnProp> = (props) => {


useEffect(() => { useEffect(() => {
setSeconds(props.timeLimit); setSeconds(props.timeLimit);
setDuration(props.timeLimit);
}, [props.questionNumber]); }, [props.questionNumber]);


useEffect(() => { useEffect(() => {


Loading…
Cancel
Save