✨ Formattage
parent
2fa6a8d59c
commit
3b4cc7b84d
|
@ -1,24 +1,23 @@
|
|||
import React, { Component } from "react"
|
||||
import {makeJsx} from '../evaluation'
|
||||
import {path} from 'ramda'
|
||||
import {Node, NodeValue} from './common'
|
||||
import { makeJsx } from "../evaluation"
|
||||
import { path } from "ramda"
|
||||
import { Node, NodeValue } from "./common"
|
||||
|
||||
export default ({ explanation, nodeValue }) => (
|
||||
<Node
|
||||
classes="mecanism somme"
|
||||
name="somme"
|
||||
value={nodeValue}
|
||||
child={<Table explanation={explanation} />}
|
||||
/>
|
||||
)
|
||||
|
||||
export default ({explanation, nodeValue}) =>
|
||||
<Node
|
||||
classes="mecanism somme"
|
||||
name="somme"
|
||||
value={nodeValue}
|
||||
child={<Table explanation={explanation}/>}
|
||||
/>
|
||||
|
||||
let Table = ({explanation}) => <table>
|
||||
<caption />
|
||||
<tbody>
|
||||
{explanation.map((v, i) => <Row {...{v, i}}/>)}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
let Table = ({ explanation }) => (
|
||||
<table>
|
||||
<caption />
|
||||
<tbody>{explanation.map((v, i) => <Row {...{ v, i }} />)}</tbody>
|
||||
</table>
|
||||
)
|
||||
|
||||
/* La colonne peut au clic afficher une nouvelle colonne qui sera une autre somme imbriquée */
|
||||
class Row extends Component {
|
||||
|
@ -26,12 +25,16 @@ class Row extends Component {
|
|||
folded: true
|
||||
}
|
||||
render() {
|
||||
let {v, i} = this.props,
|
||||
let { v, i } = this.props,
|
||||
rowFormula = path(["explanation", "formule", "explanation"], v),
|
||||
isSomme = rowFormula && rowFormula.name == "somme"
|
||||
|
||||
return [
|
||||
<tr key={v.name} className={isSomme ? "" : "noNest"} onClick={() => this.setState({folded: false})}>
|
||||
<tr
|
||||
key={v.name}
|
||||
className={isSomme ? "" : "noNest"}
|
||||
onClick={() => this.setState({ folded: false })}
|
||||
>
|
||||
<td className="operator blank">{i != 0 && "+"}</td>
|
||||
<td className="element">{makeJsx(v)}</td>
|
||||
<td className="situationValue value">
|
||||
|
@ -43,7 +46,7 @@ class Row extends Component {
|
|||
<tr className="nested">
|
||||
<td className="blank" />
|
||||
<td className="nested">
|
||||
<Table explanation={rowFormula.explanation}/>
|
||||
<Table explanation={rowFormula.explanation} />
|
||||
</td>
|
||||
</tr>
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue