Merge pull request #98 from sgmap/liste-des-regles

Liste des regles
pull/102/head
Mael 2017-10-13 18:38:07 +02:00 committed by GitHub
commit 3009acf7f5
4 changed files with 61 additions and 29 deletions

View File

@ -1,5 +1,6 @@
import React, { Component } from 'react'
import './HomeEmbauche.css'
import {Link} from 'react-router-dom'
export default class HomeEmbauche extends Component {
render() {
@ -9,7 +10,7 @@ export default class HomeEmbauche extends Component {
<div id="project">
<img src={require('../images/homeEmbauche/logo-SGMAP-fond-blanc.svg')} alt="Secrétariat général pour la modernisation de l'action publique" />
</div>
<ul>
<ul>
<li><a href="#about">À propos</a></li>
<li><a id="integrate" href="#integration">
<strong>
@ -17,8 +18,11 @@ export default class HomeEmbauche extends Component {
<span className="narrow-screen">Intégration</span>
</strong>
</a></li>
<li><a href="/contact">Contact</a></li>
</ul>
<li><Link to="/regles">
Base de règles
</Link></li>
<li><a href="/contact">Contact</a></li>
</ul>
</nav>
<div id="splash">
<div id="showcase">

View File

@ -0,0 +1,4 @@
#RulesList ul {
margin: 0 auto;
max-width: 860px;
}

View File

@ -0,0 +1,22 @@
import React, { Component } from "react"
import { rules, encodeRuleName, nameLeaf } from "Engine/rules.js"
import { Link } from "react-router-dom"
import './RulesList.css'
import {capitalise0} from '../utils'
export default class RulesList extends Component {
render() {
return (
<div id="RulesList">
<h1>Notre base de règles</h1>
<ul>
{rules.map(rule => (
<li key={rule.name}>
<Link to={"/regle/" + encodeRuleName(rule.name)}>{capitalise0(rule.name)}</Link>
</li>
))}
</ul>
</div>
)
}
}

View File

@ -1,44 +1,45 @@
import React, { Component } from 'react'
import './Layout.css'
import './reset.css'
import {Link, Route, Router, Switch} from 'react-router-dom'
import HomeEmbauche from 'Components/HomeEmbauche'
import HomeSyso from 'Components/HomeSyso'
import Rule from 'Components/rule/Rule'
import Route404 from 'Components/Route404'
import Contact from 'Components/Contact'
import Simulateur from 'Components/Simulateur'
import Results from 'Components/Results'
import ReactPiwik from 'react-piwik';
import createHistory from 'history/createBrowserHistory'
import React, { Component } from "react"
import "./Layout.css"
import "./reset.css"
import { Link, Route, Router, Switch } from "react-router-dom"
import HomeEmbauche from "Components/HomeEmbauche"
import HomeSyso from "Components/HomeSyso"
import Rule from "Components/rule/Rule"
import Route404 from "Components/Route404"
import Contact from "Components/Contact"
import Simulateur from "Components/Simulateur"
import Results from "Components/Results"
import RulesList from "Components/RulesList"
import ReactPiwik from "react-piwik"
import createHistory from "history/createBrowserHistory"
const piwik = new ReactPiwik({
url: 'stats.data.gouv.fr',
siteId: 39,
trackErrors: true,
});
url: "stats.data.gouv.fr",
siteId: 39,
trackErrors: true
})
export default class Layout extends Component {
history = createHistory();
history = createHistory()
render() {
let displayWarning = ['/simu/', '/regle/'].find(t => window.location.href.toString().indexOf(t) > -1)
let displayWarning = ["/simu/", "/regle/", "/regles"].find(
t => window.location.href.toString().indexOf(t) > -1
)
// track the initial pageview
ReactPiwik.push(['trackPageView'])
ReactPiwik.push(["trackPageView"])
return (
<Router history={piwik.connectToHistory(this.history)}>
<div id="main">
<div id="ninetyPercent">
<div id="header">
{ displayWarning &&
{displayWarning && (
<div id="warning">
<Link to="/contact">version BETA</Link>
</div>
}
)}
{
// this.props.location.pathname != '/' &&
// <Link to="/">
@ -47,10 +48,11 @@ export default class Layout extends Component {
}
</div>
<Switch>
<Route exact path="/" component={HomeEmbauche}/>
<Route exact path="/syso" component={HomeSyso}/>
<Route exact path="/" component={HomeEmbauche} />
<Route exact path="/syso" component={HomeSyso} />
<Route path="/contact" component={Contact} />
<Route path="/regle/:name" component={Rule} />
<Route path="/regles" component={RulesList} />
<Route path="/simu/:name/:intro?" component={Simulateur} />
<Route component={Route404} />
</Switch>