Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove warning in development #389

Merged
merged 1 commit into from
Dec 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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