Skip to content

Commit

Permalink
fix: remove warning in development (#389)
Browse files Browse the repository at this point in the history
fixes #375
  • Loading branch information
lionelB authored Dec 18, 2018
1 parent 1e40dac commit f259f8c
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 21 deletions.
8 changes: 3 additions & 5 deletions packages/code-du-travail-frontend/pages/code-du-travail.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,9 @@ class Fiche extends React.Component {
<Answer
title={data._source.title}
intro={
<React.Fragment>
<div style={{ marginBottom: 20, fontSize: "0.8em" }}>
<BreadCrumbs entries={getFakeBreadCrumb(data._source.path)} />
</div>
</React.Fragment>
<div style={{ marginBottom: 20, fontSize: "0.8em" }}>
<BreadCrumbs entries={getFakeBreadCrumb(data._source.path)} />
</div>
}
date={format(new Date(data._source.date_debut), "D MMMM YYYY", {
locale: frLocale
Expand Down
8 changes: 4 additions & 4 deletions packages/code-du-travail-frontend/src/common/Answer.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ class Answer extends React.Component {
const {
router,
title,
intro,
html,
children,
intro = null,
html = null,
children = null,
footer,
date,
icon,
Expand Down Expand Up @@ -78,7 +78,7 @@ class Answer extends React.Component {
>
<Disclaimer />
{intro}
<Html>{html}</Html>
{html && <Html>{html}</Html>}
{children}
<div
style={{
Expand Down
3 changes: 2 additions & 1 deletion packages/code-du-travail-frontend/src/piwik.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ if (typeof window !== "undefined" && PIWIK_URL && PIWIK_SITE_ID) {
siteId: PIWIK_SITE_ID,
trackErrors: true
});

Router.events.on("routeChangeComplete", onRouteChangeComplete);
} else if (typeof window !== "undefined") {
window._paq = [];
}
1 change: 1 addition & 0 deletions packages/code-du-travail-ui/doc/BreadCrumbs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { BreadCrumbs } from "../src";
## \<BreadCrumbs/\>

<Playground>
<BreadCrumbs />
<BreadCrumbs
entries={[
<a href="/">Accueil</a>,
Expand Down
7 changes: 2 additions & 5 deletions packages/code-du-travail-ui/src/Article.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const Article = ({
/>
</div>
</div>
<div className="article__content">{children}</div>
{children && <div className="article__content">{children}</div>}
</Section>
);
};
Expand All @@ -94,10 +94,7 @@ Article.propTypes = {
/** article title */
title: PropTypes.string.isRequired,
/** article content */
children: PropTypes.oneOfType([
PropTypes.element,
PropTypes.arrayOf(PropTypes.element)
]).isRequired,
children: PropTypes.node,
date: PropTypes.string,
sourceType: PropTypes.string,
icon: PropTypes.func,
Expand Down
5 changes: 3 additions & 2 deletions packages/code-du-travail-ui/src/BreadCrumbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ const BreadCrumbs = ({ entries }) => (
);

BreadCrumbs.propTypes = {
entries: PropTypes.arrayOf(PropTypes.element)
entries: PropTypes.node
};

BreadCrumbs.defaultProps = {
entries: [
<a key="accueil" href="/">
Accueil
</a>
</a>,
"end"
]
};

Expand Down
5 changes: 1 addition & 4 deletions packages/code-du-travail-ui/src/Section.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ const Section = ({ light, dark, style, children }) => {
};

Section.propTypes = {
children: PropTypes.oneOfType([
PropTypes.element,
PropTypes.arrayOf(PropTypes.element)
]).isRequired,
children: PropTypes.node.isRequired,
style: PropTypes.object,
light: PropTypes.bool,
dark: PropTypes.bool
Expand Down

0 comments on commit f259f8c

Please sign in to comment.