Complete project redo, got carried away, and forgot to commit during rewriting

This commit is contained in:
mrfry 2021-02-21 14:47:39 +01:00
parent 274cee57b9
commit 2ae8d7ffb2
29 changed files with 2007 additions and 875 deletions

View file

@ -3,28 +3,75 @@ import React, { PureComponent } from 'react'
import Question from './Question.js'
import styles from './Questions.module.css'
import commonStyles from '../commonStyles.module.css'
class Questions extends PureComponent {
render () {
const { subjs, onChange, deleteQuestion } = this.props
render() {
const { subjs, onChange } = this.props
return (
<div>
{subjs.map((subj, i) => {
{subjs.map((subj) => {
return (
<div key={i}>
<div className={styles.subjName}>
{subj.Name}
</div>
{ subj.Questions.map((question, i) => {
<div key={subj.Name}>
<div className={styles.subjName}>{subj.Name}</div>
{subj.Questions.map((qo, i) => {
const question = qo.q
const unsaved = qo.unsaved
return (
<Question
key={i}
question={question}
subjInd={subj.ind}
onChange={onChange}
deleteQuestion={deleteQuestion}
/>
<React.Fragment key={i}>
<hr />
<div className={`${unsaved ? styles.unsaved : ''}`}>
<Question
index={`${subj.Name}_${i}`}
question={question}
onChange={(newVal) => {
onChange({
index: i,
subjName: subj.Name,
type: 'edit',
newVal: newVal,
})
}}
/>
<div className={commonStyles.actions}>
<div
onClick={() => {
onChange({
index: i,
subjName: subj.Name,
type: 'reset',
})
}}
>
Visszaállítás
</div>
<div
onClick={() => {
onChange({
index: i,
subjName: subj.Name,
type: 'save',
})
}}
>
Mentés
</div>
<div
onClick={() => {
onChange({
index: i,
subjName: subj.Name,
type: 'delete',
})
}}
>
Törlés
</div>
</div>
</div>
</React.Fragment>
)
})}
</div>