🐛 répare les liens vers les pages règles

pull/294/head
Johan Girod 2018-07-31 14:52:49 +02:00 committed by Mael
parent 668ee10e25
commit bf5743742a
8 changed files with 29 additions and 11 deletions

View File

@ -15,7 +15,7 @@ type Props = Règle & {
}
const RuleLink = ({ lien, nom, colours: { colour }, match, style }: Props) => (
<Link
to={match.path + '/' + lien}
to={match.path + lien}
className="rule-link"
style={{ color: colour, ...style }}>
{capitalise0(nom)}

View File

@ -51,12 +51,15 @@ export default class RulePage extends Component {
}
renderRule(dottedName) {
return (
<div id="RulePage">
<div id="RulePage" className="ui__ container">
<div className="rule-page__header">
{!this.props.noUserInputSelector && (
<BackToSimulation colour={this.props.themeColours.colour} />
)}
<SearchButton className="rule-page__search" />
<SearchButton
className="rule-page__search"
rulePageBasePath="../règle"
/>
</div>
<Rule dottedName={dottedName} />
</div>

View File

@ -75,7 +75,9 @@ export default class SearchBar extends React.Component {
if (selectedOption != null) {
this.props.finally && this.props.finally()
return (
<Redirect to={'../règle/' + encodeRuleName(selectedOption.dottedName)} />
<Redirect
to={'../règle/' + encodeRuleName(selectedOption.dottedName)}
/>
)
}
return (
@ -102,7 +104,12 @@ export default class SearchBar extends React.Component {
<ul>
{rules.map(rule => (
<li key={rule.dottedName}>
<Link to={'../règle/' + encodeRuleName(rule.name)}>
<Link
to={
this.props.rulePagesBasePath +
'/' +
encodeRuleName(rule.name)
}>
{rule.title || capitalise0(rule.name)}
</Link>
</li>

View File

@ -42,6 +42,7 @@ export default class SearchButton extends Component {
showDefaultList={false}
finally={this.close}
rules={flatRules}
rulePagesBasePath={this.props.rulePagesBasePath}
/>
</Overlay>
) : (

View File

@ -157,7 +157,7 @@ let Header = ({
<span className="texts">
<span className="optionTitle">
<Link to={match.path + '/règle/' + encodeRuleName(target.dottedName)}>
<Link to={match.path + 'règle/' + encodeRuleName(target.dottedName)}>
{target.title || target.name}
</Link>
</span>

View File

@ -11,10 +11,13 @@ body {
font-family: 'Roboto', sans-serif;
}
h1,
h2 {
margin-top: 2.5rem;
margin-bottom: 1.5rem;
}
h1 {
font-size: 2.8rem;
margin-top: 1.5rem;
margin-bottom: 2rem;
}
h2 {
font-size: 2.1rem;

View File

@ -14,7 +14,11 @@ export default class RulesList extends Component {
return (
<div id="RulesList" className="ui__ container">
<h1>Explorez notre base de règles</h1>
<SearchBar showDefaultList={true} rules={flatRules} />
<SearchBar
showDefaultList={true}
rules={flatRules}
rulePagesBasePath="./règle"
/>
</div>
)
}

View File

@ -16,11 +16,11 @@ module.exports = {
history({
rewrites: [
{
from: /^\/infrance\/.*$/,
from: /^\/infrance\/.*$|^\/infrance$/,
to: '/infrance.html'
},
{
from: /^\/embauche\/.*$/,
from: /^\/embauche\/.*$|^\/embauche$/,
to: '/embauche.html'
}
]