Skip to content

Commit

Permalink
fix: lint + deps (#150)
Browse files Browse the repository at this point in the history
* chore: lint + deps

* fix
  • Loading branch information
Julien Bouquillon committed Sep 22, 2021
1 parent 0864e25 commit 40e0db2
Show file tree
Hide file tree
Showing 4 changed files with 1,012 additions and 970 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@
"@babel/core": "^7.15.5",
"@babel/preset-env": "^7.15.6",
"@babel/preset-react": "^7.14.5",
"@socialgouv/eslint-config-react": "^0.35.0",
"babel-jest": "^26.6.3",
"@socialgouv/eslint-config-react": "^1.90.4",
"babel-jest": "^27.2.1",
"eslint": "^7.32.0",
"gh-pages": "^3.2.3",
"jest": "^26.6.3",
"jest": "^27.2.1",
"parcel-bundler": "1.12.3",
"prettier": "^1.19.1",
"prettier": "^2.4.1",
"prop-types": "^15.7.2",
"react": "^16.14.0",
"react-dom": "^16.14.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-test-renderer": "^16.14.0"
},
"peerDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions src/departements.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const normalizeDpt = dpt => {
export const normalizeDpt = (dpt) => {
const dtpNumber = Number(dpt);
if (isNaN(dtpNumber)) {
return dpt.toUpperCase(); // 2A, 2B
Expand All @@ -9,7 +9,7 @@ export const normalizeDpt = dpt => {
return dtpNumber;
};

export const hasPetiteCouronne = departements =>
["75", "92", "93", "94"].filter(dpt =>
export const hasPetiteCouronne = (departements) =>
["75", "92", "93", "94"].filter((dpt) =>
departements.map(normalizeDpt).includes(normalizeDpt(dpt))
).length === 4;
10 changes: 5 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import PropTypes from "prop-types";
import React from "react";
import { SvgLoader, SvgProxy } from "react-svgmt";

import Carte from "./Carte";
Expand All @@ -8,13 +8,13 @@ import { hasPetiteCouronne, normalizeDpt } from "./departements";
const France = ({ color, highlightColor, departements }) => {
const dpts = [
...departements,
...(hasPetiteCouronne(departements) ? ["75-92-93-94"] : [])
...(hasPetiteCouronne(departements) ? ["75-92-93-94"] : []),
];

return (
<SvgLoader svgXML={Carte}>
<SvgProxy selector="#carte" fill={color} />
{dpts.map(dpt => (
{dpts.map((dpt) => (
<SvgProxy
key={dpt}
selector={`#dpt-${normalizeDpt(dpt)}`}
Expand All @@ -28,13 +28,13 @@ const France = ({ color, highlightColor, departements }) => {
France.propTypes = {
color: PropTypes.string,
departements: PropTypes.array,
highlightColor: PropTypes.string
highlightColor: PropTypes.string,
};

France.defaultProps = {
color: "#74B4FF",
departements: [],
highlightColor: "#b3ff75",
departements: []
};

export default France;

0 comments on commit 40e0db2

Please sign in to comment.