diff --git a/components/SelectedVariable.css b/components/SelectedVariable.css new file mode 100644 index 000000000..71bbaa475 --- /dev/null +++ b/components/SelectedVariable.css @@ -0,0 +1,50 @@ +#calculable-items>li { + margin-top: 4em; + padding-bottom: 2em; + border-bottom: 1px solid #eee; +} + +.item .left { + display: inline-block; + width: 30%; +} +.item .right { + display: inline-block; + width: 40%; +} +/* Display formulas */ + +.calc { + text-align: center; +} +.calc h3 { + font-weight: 300; + font-size: 100%; + color: #666; + text-transform: uppercase; +} +.linear { + font-size: 130%; +} +.linear .label { + font-size: 70%; + color: #333; + color: #2980b9; +} + +.linear .operator { + margin: 0 1em; + color: #2980b9; + font-size: 150%; +} + +.linear .limit { + margin-top: 1em; +} +.linear .limit .label { + margin-right: 1em; +} + +.linear .base, .calc .rate { + display: inline-block; +} diff --git a/components/SelectedVariable.js b/components/SelectedVariable.js index 4836036ee..9dcf75ba5 100644 --- a/components/SelectedVariable.js +++ b/components/SelectedVariable.js @@ -1,4 +1,7 @@ import React, { Component } from 'react' +import './SelectedVariable.css' +import TagMap from './TagMap' +import R from 'ramda' export default class SelectedVariable extends Component { render() { @@ -8,14 +11,26 @@ export default class SelectedVariable extends Component { first: { description }, - tags + tags, + calculable }, selectedTags - } = this.props + } = this.props, + + tagsList = R.pluck('tags', calculable), + commonTags = R.tail(tagsList).reduce( + (result, next) => R.intersection(result, R.toPairs(next)), + R.toPairs(R.head(tagsList)) + ), + itemsWithUniqueTags = R.map(item => [item, R.fromPairs(R.difference(R.toPairs(item.tags), commonTags))], calculable) + + return (

{name}

{description}

+ + {/* + */} +
) } } + +class Items extends Component { + render() { + let {itemsWithUniqueTags} = this.props + + return ( + + ) + } +} + +let Item = ({item: {linear, marginalRateTaxScale}, tags}) => +
  • +
    + +
    +
    + { linear && + || marginalRateTaxScale && + } +
    +
  • + + +let Linear = ({data: { + base, + limit, + historique +}}) =>
    +

    Calcul linéaire

    +
    +
    +
    base
    +
    {base}
    +
    + + ✕ + +
    +
    Taux
    +
    { + historique[(Object.keys(historique).sort()[0])] + }
    +
    + { limit != null &&
    + dans la limite de : + {limit} +
    } +
    +
    + +let TaxScale = ({data}) =>
    +

    Règle de calcul: barème

    + {JSON.stringify(data)} +
    diff --git a/components/TagMap.js b/components/TagMap.js new file mode 100644 index 000000000..b84639aa0 --- /dev/null +++ b/components/TagMap.js @@ -0,0 +1,13 @@ +import React from 'react' +import R from 'ramda' + +let TagMap = ({data}) => + + +export default TagMap diff --git a/components/TagNavigation.js b/components/TagNavigation.js index 600eb9671..538713311 100644 --- a/components/TagNavigation.js +++ b/components/TagNavigation.js @@ -1,5 +1,5 @@ import React from 'react' - +import TagMap from './TagMap' export default class TagNavigation extends React.Component { render(){ @@ -10,13 +10,7 @@ export default class TagNavigation extends React.Component {
    {selectedTags.length > 0 &&
    - +
    } @@ -38,7 +32,7 @@ class Tag extends React.Component { {name} - ({number} variables) + ({number} variable{number > 1 ? 's' : ''})