Added svg resistor

This commit is contained in:
dbroqua 2018-08-18 21:31:06 +02:00
parent 50e1eaa1ee
commit 4fc4b14fe7
6 changed files with 1188 additions and 102 deletions

561
package-lock.json generated
View File

@ -4,6 +4,184 @@
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@svgr/cli": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@svgr/cli/-/cli-2.2.0.tgz",
"integrity": "sha512-vwqhkwNIZ1amBRx+jFhYMytlhjPBTpgu8IeyBzzbqpCxcsh2KMe8sNWv6w9NsMr3Jehm0z2xy0iTMdVLl/bVSg==",
"dev": true,
"requires": {
"@svgr/core": "^2.2.0",
"chalk": "^2.4.1",
"commander": "^2.17.1",
"glob": "^7.1.2",
"lodash": "^4.17.10",
"output-file-sync": "^2.0.1",
"recursive-readdir": "^2.2.2"
},
"dependencies": {
"chalk": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz",
"integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==",
"dev": true,
"requires": {
"ansi-styles": "^3.2.1",
"escape-string-regexp": "^1.0.5",
"supports-color": "^5.3.0"
}
},
"commander": {
"version": "2.17.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz",
"integrity": "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==",
"dev": true
},
"recursive-readdir": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/recursive-readdir/-/recursive-readdir-2.2.2.tgz",
"integrity": "sha512-nRCcW9Sj7NuZwa2XvH9co8NPeXUBhZP7CRKJtU+cS6PW9FpCIFoI5ib0NT1ZrbNuPoRy0ylyCaUL8Gih4LSyFg==",
"dev": true,
"requires": {
"minimatch": "3.0.4"
}
}
}
},
"@svgr/core": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@svgr/core/-/core-2.2.0.tgz",
"integrity": "sha512-c7Nq4oXlze6YiXBb8E9NLfuZbNzI4QPjFnf4sigqFQST5NaFaWWOaaOu7yCxkZWFC7u995y0rwt+v26ghco9pQ==",
"dev": true,
"requires": {
"cosmiconfig": "^5.0.6",
"h2x-core": "^1.0.0",
"h2x-plugin-jsx": "^1.0.0",
"lodash": "^4.17.10",
"prettier": "^1.14.2",
"svgo": "^1.0.5"
},
"dependencies": {
"coa": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/coa/-/coa-2.0.1.tgz",
"integrity": "sha512-5wfTTO8E2/ja4jFSxePXlG5nRu5bBtL/r1HCIpJW/lzT6yDtKl0u0Z4o/Vpz32IpKmBn7HerheEZQgA9N2DarQ==",
"dev": true,
"requires": {
"q": "^1.1.2"
}
},
"cosmiconfig": {
"version": "5.0.6",
"resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-5.0.6.tgz",
"integrity": "sha512-6DWfizHriCrFWURP1/qyhsiFvYdlJzbCzmtFWh744+KyWsJo5+kPzUZZaMRSSItoYc0pxFX7gEO7ZC1/gN/7AQ==",
"dev": true,
"requires": {
"is-directory": "^0.3.1",
"js-yaml": "^3.9.0",
"parse-json": "^4.0.0"
}
},
"css-select": {
"version": "1.3.0-rc0",
"resolved": "https://registry.npmjs.org/css-select/-/css-select-1.3.0-rc0.tgz",
"integrity": "sha1-b5MZaqrnN2ZuoQNqjLFKj8t6kjE=",
"dev": true,
"requires": {
"boolbase": "^1.0.0",
"css-what": "2.1",
"domutils": "1.5.1",
"nth-check": "^1.0.1"
}
},
"csso": {
"version": "3.5.1",
"resolved": "https://registry.npmjs.org/csso/-/csso-3.5.1.tgz",
"integrity": "sha512-vrqULLffYU1Q2tLdJvaCYbONStnfkfimRxXNaGjxMldI0C7JPBC4rB1RyjhfdZ4m1frm8pM9uRPKH3d2knZ8gg==",
"dev": true,
"requires": {
"css-tree": "1.0.0-alpha.29"
},
"dependencies": {
"css-tree": {
"version": "1.0.0-alpha.29",
"resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.0.0-alpha.29.tgz",
"integrity": "sha512-sRNb1XydwkW9IOci6iB2xmy8IGCj6r/fr+JWitvJ2JxQRPzN3T4AGGVWCMlVmVwM1gtgALJRmGIlWv5ppnGGkg==",
"dev": true,
"requires": {
"mdn-data": "~1.1.0",
"source-map": "^0.5.3"
}
}
}
},
"esprima": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
"dev": true
},
"js-yaml": {
"version": "3.12.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz",
"integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==",
"dev": true,
"requires": {
"argparse": "^1.0.7",
"esprima": "^4.0.0"
}
},
"parse-json": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz",
"integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=",
"dev": true,
"requires": {
"error-ex": "^1.3.1",
"json-parse-better-errors": "^1.0.1"
}
},
"source-map": {
"version": "0.5.7",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
"integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=",
"dev": true
},
"svgo": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/svgo/-/svgo-1.0.5.tgz",
"integrity": "sha512-nYrifviB77aNKDNKKyuay3M9aYiK6Hv5gJVDdjj2ZXTQmI8WZc8+UPLR5IpVlktJfSu3co/4XcWgrgI6seGBPg==",
"dev": true,
"requires": {
"coa": "~2.0.1",
"colors": "~1.1.2",
"css-select": "~1.3.0-rc0",
"css-select-base-adapter": "~0.1.0",
"css-tree": "1.0.0-alpha25",
"css-url-regex": "^1.1.0",
"csso": "^3.5.0",
"js-yaml": "~3.10.0",
"mkdirp": "~0.5.1",
"object.values": "^1.0.4",
"sax": "~1.2.4",
"stable": "~0.1.6",
"unquote": "~1.1.1",
"util.promisify": "~1.0.0"
},
"dependencies": {
"js-yaml": {
"version": "3.10.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.10.0.tgz",
"integrity": "sha512-O2v52ffjLa9VeM43J4XocZE//WT9N0IiwDa3KSHH7Tu8CtH+1qM8SIZvnsTh6v+4yFy5KUY3BHUVwjpfAWsjIA==",
"dev": true,
"requires": {
"argparse": "^1.0.7",
"esprima": "^4.0.0"
}
}
}
}
}
},
"abab": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/abab/-/abab-1.0.4.tgz",
@ -402,6 +580,12 @@
"resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz",
"integrity": "sha1-GdOGodntxufByF04iu28xW0zYC0="
},
"async-limiter": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz",
"integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==",
"dev": true
},
"asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
@ -1479,6 +1663,12 @@
"resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz",
"integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8="
},
"browser-process-hrtime": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-0.1.2.tgz",
"integrity": "sha1-Ql1opY00R/AqBKqJQYf86K+Le44=",
"dev": true
},
"browser-resolve": {
"version": "1.11.3",
"resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-1.11.3.tgz",
@ -2325,6 +2515,12 @@
"nth-check": "~1.0.1"
}
},
"css-select-base-adapter": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/css-select-base-adapter/-/css-select-base-adapter-0.1.0.tgz",
"integrity": "sha1-AQKz0UYw34bD65+p9UVicBBs+ZA=",
"dev": true
},
"css-selector-tokenizer": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/css-selector-tokenizer/-/css-selector-tokenizer-0.7.0.tgz",
@ -2347,6 +2543,30 @@
}
}
},
"css-tree": {
"version": "1.0.0-alpha25",
"resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.0.0-alpha25.tgz",
"integrity": "sha512-XC6xLW/JqIGirnZuUWHXCHRaAjje2b3OIB0Vj5RIJo6mIi/AdJo30quQl5LxUl0gkXDIrTrFGbMlcZjyFplz1A==",
"dev": true,
"requires": {
"mdn-data": "^1.0.0",
"source-map": "^0.5.3"
},
"dependencies": {
"source-map": {
"version": "0.5.7",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
"integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=",
"dev": true
}
}
},
"css-url-regex": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/css-url-regex/-/css-url-regex-1.1.0.tgz",
"integrity": "sha1-g4NCMMyfdMRX3lnuvRVD/uuDt+w=",
"dev": true
},
"css-what": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.0.tgz",
@ -2507,6 +2727,39 @@
"assert-plus": "^1.0.0"
}
},
"data-urls": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/data-urls/-/data-urls-1.0.0.tgz",
"integrity": "sha512-ai40PPQR0Fn1lD2PPie79CibnlMN2AYiDhwFX/rZHVsxbs5kNJSjegqXIprhouGXlRdEnfybva7kqRGnB6mypA==",
"dev": true,
"requires": {
"abab": "^1.0.4",
"whatwg-mimetype": "^2.0.0",
"whatwg-url": "^6.4.0"
},
"dependencies": {
"tr46": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz",
"integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=",
"dev": true,
"requires": {
"punycode": "^2.1.0"
}
},
"whatwg-url": {
"version": "6.5.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-6.5.0.tgz",
"integrity": "sha512-rhRZRqx/TLJQWUpQ6bmrt2UV4f0HCQ463yQuONJqC6fO2VoEb1pTYddbe59SkYq87aoM5A3bdhMZiUiVws+fzQ==",
"dev": true,
"requires": {
"lodash.sortby": "^4.7.0",
"tr46": "^1.0.1",
"webidl-conversions": "^4.0.2"
}
}
}
},
"date-now": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz",
@ -2770,6 +3023,15 @@
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.0.tgz",
"integrity": "sha1-sXrtguirWeUt2cGbF1bg/BhyBMI="
},
"domexception": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/domexception/-/domexception-1.0.1.tgz",
"integrity": "sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug==",
"dev": true,
"requires": {
"webidl-conversions": "^4.0.2"
}
},
"domhandler": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.1.0.tgz",
@ -4579,6 +4841,152 @@
"duplexer": "^0.1.1"
}
},
"h2x-core": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/h2x-core/-/h2x-core-1.0.0.tgz",
"integrity": "sha1-UTX9oahojryM4kUNifHcaDdRHns=",
"dev": true,
"requires": {
"h2x-generate": "^1.0.0",
"h2x-parse": "^1.0.0",
"h2x-traverse": "^1.0.0"
}
},
"h2x-generate": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/h2x-generate/-/h2x-generate-1.0.0.tgz",
"integrity": "sha1-cugCDs7ePlifesq4HoWoNGzFQSY=",
"dev": true,
"requires": {
"h2x-traverse": "^1.0.0"
}
},
"h2x-parse": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/h2x-parse/-/h2x-parse-1.0.0.tgz",
"integrity": "sha1-PTd2QtbV9eP6mUDjYg8Rui0HLpk=",
"dev": true,
"requires": {
"h2x-types": "^1.0.0",
"jsdom": "^11.10.0"
},
"dependencies": {
"abab": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/abab/-/abab-2.0.0.tgz",
"integrity": "sha512-sY5AXXVZv4Y1VACTtR11UJCPHHudgY5i26Qj5TypE6DKlIApbwb5uqhXcJ5UUGbvZNRh7EeIoW+LrJumBsKp7w==",
"dev": true
},
"acorn-globals": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.1.0.tgz",
"integrity": "sha512-KjZwU26uG3u6eZcfGbTULzFcsoz6pegNKtHPksZPOUsiKo5bUmiBPa38FuHZ/Eun+XYh/JCCkS9AS3Lu4McQOQ==",
"dev": true,
"requires": {
"acorn": "^5.0.0"
}
},
"cssstyle": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-1.0.0.tgz",
"integrity": "sha512-Bpuh47j2mRMY60X90mXaJAEtJwxvA2roZzbgwAXYhMbmwmakdRr4Cq9L5SkleKJNLOKqHIa2YWyOXDX3VgggSQ==",
"dev": true,
"requires": {
"cssom": "0.3.x"
}
},
"jsdom": {
"version": "11.12.0",
"resolved": "https://registry.npmjs.org/jsdom/-/jsdom-11.12.0.tgz",
"integrity": "sha512-y8Px43oyiBM13Zc1z780FrfNLJCXTL40EWlty/LXUtcjykRBNgLlCjWXpfSPBl2iv+N7koQN+dvqszHZgT/Fjw==",
"dev": true,
"requires": {
"abab": "^2.0.0",
"acorn": "^5.5.3",
"acorn-globals": "^4.1.0",
"array-equal": "^1.0.0",
"cssom": ">= 0.3.2 < 0.4.0",
"cssstyle": "^1.0.0",
"data-urls": "^1.0.0",
"domexception": "^1.0.1",
"escodegen": "^1.9.1",
"html-encoding-sniffer": "^1.0.2",
"left-pad": "^1.3.0",
"nwsapi": "^2.0.7",
"parse5": "4.0.0",
"pn": "^1.1.0",
"request": "^2.87.0",
"request-promise-native": "^1.0.5",
"sax": "^1.2.4",
"symbol-tree": "^3.2.2",
"tough-cookie": "^2.3.4",
"w3c-hr-time": "^1.0.1",
"webidl-conversions": "^4.0.2",
"whatwg-encoding": "^1.0.3",
"whatwg-mimetype": "^2.1.0",
"whatwg-url": "^6.4.1",
"ws": "^5.2.0",
"xml-name-validator": "^3.0.0"
}
},
"parse5": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/parse5/-/parse5-4.0.0.tgz",
"integrity": "sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA==",
"dev": true
},
"tr46": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz",
"integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=",
"dev": true,
"requires": {
"punycode": "^2.1.0"
}
},
"whatwg-url": {
"version": "6.5.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-6.5.0.tgz",
"integrity": "sha512-rhRZRqx/TLJQWUpQ6bmrt2UV4f0HCQ463yQuONJqC6fO2VoEb1pTYddbe59SkYq87aoM5A3bdhMZiUiVws+fzQ==",
"dev": true,
"requires": {
"lodash.sortby": "^4.7.0",
"tr46": "^1.0.1",
"webidl-conversions": "^4.0.2"
}
},
"xml-name-validator": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz",
"integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==",
"dev": true
}
}
},
"h2x-plugin-jsx": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/h2x-plugin-jsx/-/h2x-plugin-jsx-1.0.0.tgz",
"integrity": "sha1-kwfMWNdb0kH2wlrvFSUB/aK99D0=",
"dev": true,
"requires": {
"h2x-types": "^1.0.0"
}
},
"h2x-traverse": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/h2x-traverse/-/h2x-traverse-1.0.0.tgz",
"integrity": "sha1-b2UdQfFOO0Ni6iqQkhOkNRGYLeE=",
"dev": true,
"requires": {
"h2x-types": "^1.0.0"
}
},
"h2x-types": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/h2x-types/-/h2x-types-1.0.0.tgz",
"integrity": "sha1-SCKBb/3fUeSjg6oAWUdw6M4jDR8=",
"dev": true
},
"handle-thing": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-1.2.5.tgz",
@ -6308,6 +6716,12 @@
"resolved": "https://registry.npmjs.org/json-loader/-/json-loader-0.5.7.tgz",
"integrity": "sha512-QLPs8Dj7lnf3e3QYS1zkCo+4ZwqOiF9d/nZnYozTISxXWCfNs9yuky5rJw4/W34s7POaNlbZmQGaB5NiXCbP4w=="
},
"json-parse-better-errors": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
"integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==",
"dev": true
},
"json-schema": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz",
@ -6419,6 +6833,12 @@
"invert-kv": "^1.0.0"
}
},
"left-pad": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/left-pad/-/left-pad-1.3.0.tgz",
"integrity": "sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA==",
"dev": true
},
"leven": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz",
@ -6560,6 +6980,12 @@
"resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz",
"integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4="
},
"lodash.sortby": {
"version": "4.7.0",
"resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz",
"integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=",
"dev": true
},
"lodash.template": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.4.0.tgz",
@ -6698,6 +7124,12 @@
"inherits": "^2.0.1"
}
},
"mdn-data": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-1.1.4.tgz",
"integrity": "sha512-FSYbp3lyKjyj3E7fMl6rYvUdX0FBXaluGqlFoYESWQlyUTq8R+wp0rkFxoYFqZlHCvsUXGjyJmLQSnXToYhOSA==",
"dev": true
},
"media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
@ -7070,6 +7502,12 @@
"resolved": "https://registry.npmjs.org/nwmatcher/-/nwmatcher-1.4.4.tgz",
"integrity": "sha512-3iuY4N5dhgMpCUrOVnuAdGrgxVqV2cJpM+XNccjR2DKOB1RUP0aA+wGXEiNziG/UKboFyGBIoKOaNlJxx8bciQ=="
},
"nwsapi": {
"version": "2.0.8",
"resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.0.8.tgz",
"integrity": "sha512-7RZ+qbFGiVc6v14Y8DSZjPN1wZPOaMbiiP4tzf5eNuyOITAeOIA3cMhjuKUypVIqBgCSg1KaSyAv8Ocq/0ZJ1A==",
"dev": true
},
"oauth-sign": {
"version": "0.8.2",
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz",
@ -7150,6 +7588,16 @@
"has": "^1.0.1"
}
},
"object.getownpropertydescriptors": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz",
"integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=",
"dev": true,
"requires": {
"define-properties": "^1.1.2",
"es-abstract": "^1.5.1"
}
},
"object.omit": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz",
@ -7167,6 +7615,18 @@
"isobject": "^3.0.1"
}
},
"object.values": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/object.values/-/object.values-1.0.4.tgz",
"integrity": "sha1-5STaCbT2b/Bd9FdUbscqyZ8TBpo=",
"dev": true,
"requires": {
"define-properties": "^1.1.2",
"es-abstract": "^1.6.1",
"function-bind": "^1.1.0",
"has": "^1.0.1"
}
},
"obuf": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz",
@ -7269,6 +7729,17 @@
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
"integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ="
},
"output-file-sync": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/output-file-sync/-/output-file-sync-2.0.1.tgz",
"integrity": "sha512-mDho4qm7WgIXIGf4eYU1RHN2UU5tPfVYVSRwDJw0uTmj35DQUt/eNp19N7v6T3SrR0ESTEf2up2CGO73qI35zQ==",
"dev": true,
"requires": {
"graceful-fs": "^4.1.11",
"is-plain-obj": "^1.1.0",
"mkdirp": "^0.5.1"
}
},
"p-finally": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
@ -7483,6 +7954,12 @@
"resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz",
"integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow=="
},
"pn": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz",
"integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==",
"dev": true
},
"popper.js": {
"version": "1.14.3",
"resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.14.3.tgz",
@ -8669,6 +9146,12 @@
"resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz",
"integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks="
},
"prettier": {
"version": "1.14.2",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.14.2.tgz",
"integrity": "sha512-McHPg0n1pIke+A/4VcaS2en+pTNjy4xF+Uuq86u/5dyDO59/TtFZtQ708QIRkEZ3qwKz3GVkVa6mpxK/CpB8Rg==",
"dev": true
},
"pretty-bytes": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-4.0.2.tgz",
@ -8765,6 +9248,12 @@
"randombytes": "^2.0.1"
}
},
"punycode": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
"dev": true
},
"q": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz",
@ -9667,6 +10156,26 @@
}
}
},
"request-promise-core": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.1.tgz",
"integrity": "sha1-Pu4AssWqgyOc+wTFcA2jb4HNCLY=",
"dev": true,
"requires": {
"lodash": "^4.13.1"
}
},
"request-promise-native": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.5.tgz",
"integrity": "sha1-UoF3D2jgyXGeUWP9P6tIIhX0/aU=",
"dev": true,
"requires": {
"request-promise-core": "1.1.1",
"stealthy-require": "^1.1.0",
"tough-cookie": ">=2.3.3"
}
},
"require-directory": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
@ -10324,6 +10833,12 @@
"tweetnacl": "~0.14.0"
}
},
"stable": {
"version": "0.1.8",
"resolved": "https://registry.npmjs.org/stable/-/stable-0.1.8.tgz",
"integrity": "sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w==",
"dev": true
},
"static-extend": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz",
@ -10348,6 +10863,12 @@
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz",
"integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew=="
},
"stealthy-require": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz",
"integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=",
"dev": true
},
"stream-browserify": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.1.tgz",
@ -10864,6 +11385,12 @@
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
"integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
},
"unquote": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/unquote/-/unquote-1.1.1.tgz",
"integrity": "sha1-j97XMk7G6IoP+LkF58CYzcCG1UQ=",
"dev": true
},
"unset-value": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz",
@ -11015,6 +11542,16 @@
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
},
"util.promisify": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.0.tgz",
"integrity": "sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==",
"dev": true,
"requires": {
"define-properties": "^1.1.2",
"object.getownpropertydescriptors": "^2.0.3"
}
},
"utila": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/utila/-/utila-0.4.0.tgz",
@ -11072,6 +11609,15 @@
"indexof": "0.0.1"
}
},
"w3c-hr-time": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz",
"integrity": "sha1-gqwr/2PZUOqeMYmlimViX+3xkEU=",
"dev": true,
"requires": {
"browser-process-hrtime": "^0.1.2"
}
},
"walker": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/walker/-/walker-1.0.7.tgz",
@ -11548,6 +12094,12 @@
"resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz",
"integrity": "sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng=="
},
"whatwg-mimetype": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.1.0.tgz",
"integrity": "sha512-FKxhYLytBQiUKjkYteN71fAUA3g6KpNXoho1isLiLSB3N1G4F35Q5vUxWfKFhBwi5IWF27VE6WxhrnnC+m0Mew==",
"dev": true
},
"whatwg-url": {
"version": "4.8.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-4.8.0.tgz",
@ -11660,6 +12212,15 @@
"signal-exit": "^3.0.2"
}
},
"ws": {
"version": "5.2.2",
"resolved": "https://registry.npmjs.org/ws/-/ws-5.2.2.tgz",
"integrity": "sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA==",
"dev": true,
"requires": {
"async-limiter": "~1.0.0"
}
},
"xdg-basedir": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-3.0.0.tgz",

View File

@ -19,6 +19,7 @@
"eject": "react-scripts eject"
},
"devDependencies": {
"@svgr/cli": "^2.2.0",
"eslint": "^4.19.1",
"eslint-config-airbnb": "^17.1.0",
"eslint-plugin-import": "^2.14.0",

186
public/resistor.svg Normal file
View File

@ -0,0 +1,186 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="157.39568mm"
height="32.996395mm"
viewBox="0 0 157.39568 32.996395"
version="1.1"
id="svg96"
inkscape:version="0.92.1 r15371"
sodipodi:docname="resistor.svg">
<defs
id="defs90" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.4"
inkscape:cx="253.98368"
inkscape:cy="39.858799"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
showguides="true"
inkscape:guide-bbox="true"
inkscape:window-width="1920"
inkscape:window-height="1007"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0">
<sodipodi:guide
position="-19.122808,16.498189"
orientation="0,1"
id="guide179"
inkscape:locked="false" />
<sodipodi:guide
position="78.697842,9.1482785"
orientation="1,0"
id="guide181"
inkscape:locked="false" />
<sodipodi:guide
position="25.110298,7.5446585"
orientation="0,1"
id="guide187"
inkscape:locked="false" />
<sodipodi:guide
position="54.145086,25.063019"
orientation="1,0"
id="guide266"
inkscape:locked="false" />
<sodipodi:guide
position="59.342262,19.393379"
orientation="1,0"
id="guide268"
inkscape:locked="false" />
<sodipodi:guide
position="67.004792,17.901349"
orientation="1,0"
id="guide272"
inkscape:locked="false" />
<sodipodi:guide
position="80.268042,16.498199"
orientation="1,0"
id="guide274"
inkscape:locked="false" />
<sodipodi:guide
position="102.76227,16.498199"
orientation="1,0"
id="guide276"
inkscape:locked="false" />
</sodipodi:namedview>
<metadata
id="metadata93">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-43.845239,-23.254863)">
<g
id="g264">
<g
id="g230">
<path
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 64.144686,39.753061 c 0,0 -0.133636,7.684008 2.873147,11.559418 3.006783,3.875407 5.746295,5.746292 10.623963,4.343127 4.87767,-1.403165 6.548104,-6.949014 12.828939,-6.949014 6.280832,0 32.072345,0 32.072345,0"
id="path189"
inkscape:connector-curvature="0" />
<g
id="g207">
<path
inkscape:connector-curvature="0"
id="path189-3"
d="m 64.144686,39.753061 c 0,0 -0.133636,-7.684008 2.873147,-11.559418 3.006783,-3.875406 5.746295,-5.746292 10.623963,-4.343127 4.87767,1.403166 6.548104,6.949014 12.828938,6.949014 6.280833,0 32.072346,0 32.072346,0"
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
</g>
<g
id="g230-5"
transform="matrix(-1,0,0,1,245.08616,0)">
<path
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 64.144686,39.753061 c 0,0 -0.133636,7.684008 2.873147,11.559418 3.006783,3.875407 5.746295,5.746292 10.623963,4.343127 4.87767,-1.403165 6.548104,-6.949014 12.828939,-6.949014 6.280832,0 32.072345,0 32.072345,0"
id="path189-35"
inkscape:connector-curvature="0" />
<g
id="g207-6">
<path
inkscape:connector-curvature="0"
id="path189-3-2"
d="m 64.144686,39.753061 c 0,0 -0.133636,-7.684008 2.873147,-11.559418 3.006783,-3.875406 5.746295,-5.746292 10.623963,-4.343127 4.87767,1.403166 6.548104,6.949014 12.828938,6.949014 6.280833,0 32.072346,0 32.072346,0"
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
</g>
</g>
<rect
id="rect270"
width="5.197175"
height="17.919262"
x="97.990326"
y="30.787331"
style="fill:#ff0000;fill-opacity:1;stroke:#000000;stroke-width:0.26759365;stroke-opacity:1"
inkscape:label="color-one"
label="color-one" />
<rect
id="rect270-9"
width="5.197175"
height="17.919262"
x="110.85003"
y="30.787329"
style="fill:#00ff00;fill-opacity:1;stroke:#000000;stroke-width:0.26759365;stroke-opacity:1"
inkscape:label="color-two"
label="color-two" />
<rect
id="rect270-9-2"
width="5.197175"
height="17.919262"
x="146.60751"
y="30.787329"
style="fill:#c0c0c0;fill-opacity:1;stroke:#000000;stroke-width:0.26759365;stroke-opacity:1"
inkscape:label="precision"
label="precision" />
<path
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 64.144686,39.753061 H 43.845239"
id="path4790"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 201.24092,39.753061 H 180.94147"
id="path4790-7"
inkscape:connector-curvature="0" />
<rect
id="rect270-9-3"
width="5.197175"
height="17.919262"
x="124.11328"
y="30.787336"
style="fill:#0000ff;fill-opacity:1;stroke:#000000;stroke-width:0.26759365;stroke-opacity:1"
inkscape:label="factor"
label="color-two" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.5 KiB

View File

@ -6,7 +6,8 @@ import {
FormGroup,
Label,
Input,
Button
Button,
FormFeedback
} from 'reactstrap';
import Result from './result'
@ -19,7 +20,11 @@ class Resistor extends Component {
this.state = {
powerSource: 12,
powerLed: 3.3,
ledConsumption: 200,
ledConsumption: 20,
powerSourceError: false,
powerLedError: false,
ledConsumptionError: false,
showResult: false,
@ -52,24 +57,136 @@ class Resistor extends Component {
9.10
]
},
factors: [ //À factoriser via un for 0 -> 12
1,
10,
100,
1000,
10000,
100000,
1000000,
10000000,
100000000,
1000000000,
10000000000,
100000000000,
1000000000000
factors: [
{
factor: 0.01,
colorLabel: 'Argent',
color: '#ccc',
factorLabel: 'x0.01'
},
{
factor: 0.1,
colorLabel: 'or',
color: '#cd9932',
factorLabel: 'x0.1'
},
{
factor: 1,
colorLabel: 'noir',
color: '#000',
factorLabel: 'x1'
},
{
factor: 10,
colorLabel: 'marron',
color: '#663331',
factorLabel: 'x10'
},
{
factor: 100,
colorLabel: 'rouge',
color: '#fd0000',
factorLabel: 'x100'
},
{
factor: 1000,
colorLabel: 'orange',
color: '#ff6600',
factorLabel: 'x1 k'
},
{
factor: 10000,
colorLabel: 'jaune',
color: '#ffff00',
factorLabel: 'x10 k'
},
{
factor: 100000,
colorLabel: 'vert',
color: '#33cb33',
factorLabel: 'x100 k'
},
{
factor: 1000000,
colorLabel: 'bleu',
color: '#6666ff',
factorLabel: 'x1 M'
},
{
factor: 10000000,
colorLabel: 'violet',
color: '#cd66ff',
factorLabel: 'x10 M'
},
{
factor: 100000000,
colorLabel: 'gris',
color: '#939393',
factorLabel: 'x100 M'
},
{
factor: 1000000000,
colorLabel: 'blanc',
color: '#fff',
factorLabel: 'x1 G'
},
],
byColor: [
{
colorLabel: 'black',
color: '#000',
value: 0
},
{
colorLabel: 'brown',
color: '#663331',
value: 1
},
{
colorLabel: 'red',
color: '#fd0000',
value: 2
},
{
colorLabel: 'orange',
color: '#ff6600',
value: 3
},
{
colorLabel: 'yellow',
color: '#ffff00',
value: 4
},
{
colorLabel: 'green',
color: '#33cb33',
value: 5
},
{
colorLabel: 'blue',
color: '#6666ff',
value: 6
},
{
colorLabel: 'violet',
color: '#cd66ff',
value: 7
},
{
colorLabel: 'grey',
color: '#939393',
value: 8
},
{
colorLabel: 'white',
color: '#fff',
value: 9
},
]
}
this.handleChange = this.handleChange.bind(this);
this.checkForm = this.checkForm.bind(this);
this.submit = this.submit.bind(this);
}
@ -84,9 +201,50 @@ class Resistor extends Component {
});
}
submit() {
checkForm() {
let isOk = true;
let powerSourceError = false;
let powerLedError = false;
let ledConsumptionError = false;
if ( this.state.powerSource <= 0 )
{
powerSourceError = true;
}
if ( this.state.powerLed <= 0 || this.state.powerLed > this.state.powerSource )
{
powerLedError = true;
}
if ( this.state.ledConsumption <= 0 )
{
ledConsumptionError = true;
}
if ( powerSourceError === true
|| powerLedError === true
|| ledConsumptionError === true
){
isOk = false;
}
this.setState({
showResult: true
powerSourceError,
powerLedError,
ledConsumptionError
})
return isOk;
}
submit() {
let showResult = this.checkForm();
console.log(showResult);
this.setState({
showResult
})
}
@ -95,70 +253,92 @@ class Resistor extends Component {
<Container>
<h1>Calcul de la valeur d&#39;une résistance</h1>
<Row>
<Col xs="12" md="4">
<FormGroup>
<Label for="powerSource">Alimentation</Label>
<Input
type="number"
id="powerSource"
name="powerSource"
placeholder="Alimentation (ex: 12V)"
step="0.5"
value={this.state.powerSource}
onChange={this.handleChange}
/>
</FormGroup>
<Col xs="12" md="6">
<Row>
<Col xs="12">
<FormGroup>
<Label for="powerSource">Alimentation</Label>
<Input
type="number"
id="powerSource"
name="powerSource"
placeholder="Alimentation (ex: 12V)"
step="0.1"
value={this.state.powerSource}
onChange={this.handleChange}
invalid={this.state.powerSourceError}
/>
{this.state.powerSourceError ?
(<FormFeedback>Vous devez saisir un nombre positif</FormFeedback>)
: (null)
}
</FormGroup>
</Col>
</Row>
<Row>
<Col xs="12">
<FormGroup>
<Label for="powerLed">Tension max admissible par la led</Label>
<Input
type="number"
id="powerLed"
name="powerLed"
placeholder="ex: 3.3V"
step="0.1"
value={this.state.powerLed}
onChange={this.handleChange}
invalid={this.state.powerLedError}
/>
{this.state.powerLedError ?
(<FormFeedback>Vous devez saisir un nombre positif et inférieur à votre alimentation</FormFeedback>)
: (null)
}
</FormGroup>
</Col>
</Row>
<Row>
<Col xs="12">
<FormGroup>
<Label for="ledConsumption">Consommation de la led (en mA)</Label>
<Input
type="number"
id="ledConsumption"
name="ledConsumption"
placeholder="20mA"
step="1"
value={this.state.ledConsumption}
onChange={this.handleChange}
invalid={this.state.ledConsumptionError}
/>
{this.state.ledConsumptionError ?
(<FormFeedback>Vous devez saisir un nombre positif</FormFeedback>)
: (null)
}
</FormGroup>
</Col>
</Row>
<Row>
<Col xs="12">
<Button onClick={this.submit}>Calculer</Button>
</Col>
</Row>
</Col>
<Col xs="12" md="6">
{
this.state.showResult ?
<Result
powerSource={this.state.powerSource}
powerLed={this.state.powerLed}
ledConsumption={this.state.ledConsumption}
series={this.state.series}
factors={this.state.factors}
colors={this.state.byColor}
/>
:
(null)
}
</Col>
</Row>
<Row>
<Col xs="12" md="4">
<FormGroup>
<Label for="powerLed">Tension max admissible par la led</Label>
<Input
type="number"
id="powerLed"
name="powerLed"
placeholder="ex: 3.3V"
step="0.1"
value={this.state.powerLed}
onChange={this.handleChange}
/>
</FormGroup>
</Col>
</Row>
<Row>
<Col xs="12" md="4">
<FormGroup>
<Label for="ledConsumption">Consommation de la led (en mA)</Label>
<Input
type="number"
id="ledConsumption"
name="ledConsumption"
placeholder="20mA"
step="1"
value={this.state.ledConsumption}
onChange={this.handleChange}
/>
</FormGroup>
</Col>
</Row>
<Row>
<Col xs="12" md="4">
<Button onClick={this.submit}>Calculer</Button>
</Col>
</Row>
{
this.state.showResult ?
<Result
powerSource={this.state.powerSource}
powerLed={this.state.powerLed}
ledConsumption={this.state.ledConsumption}
series={this.state.series}
factors={this.state.factors}
/>
:
(null)
}
</Container>
);
}

View File

@ -0,0 +1,50 @@
import React from 'react';
const Resistor = props => (
<svg viewBox="0 0 157.396 32.996" width="100%" height="100%" {...props}>
<path
d="M20.3 16.498s-.134 7.684 2.873 11.56c3.006 3.875 5.746 5.746 10.624 4.343 4.877-1.403 6.548-6.95 12.828-6.95h32.073M20.3 16.498s-.134-7.684 2.873-11.56C26.179 1.064 28.919-.807 33.797.597c4.877 1.403 6.548 6.949 12.828 6.949h32.073"
fill="none"
stroke="#000"
strokeWidth={0.265}
/>
<path
d="M137.096 16.498s.134 7.684-2.873 11.56c-3.007 3.875-5.746 5.746-10.624 4.343-4.878-1.403-6.548-6.95-12.829-6.95H78.698M137.096 16.498s.134-7.684-2.873-11.56C131.216 1.064 128.477-.807 123.6.597c-4.878 1.403-6.548 6.949-12.829 6.949H78.698"
fill="none"
stroke="#000"
strokeWidth={0.265}
/>
<path
fill={props.ringone}
stroke="#000"
strokeWidth={0.268}
d="M54.145 7.532h5.197v17.92h-5.197z"
/>
<path
fill={props.ringtwo}
stroke="#000"
strokeWidth={0.268}
d="M67.005 7.532h5.197v17.92h-5.197z"
/>
<path
fill={props.precision}
stroke="#000"
strokeWidth={0.268}
d="M102.763 7.532h5.197v17.92h-5.197z"
/>
<path
d="M20.3 16.498H0M157.396 16.498h-20.3"
fill="none"
stroke="#000"
strokeWidth={0.265}
/>
<path
fill={props.factor}
stroke="#000"
strokeWidth={0.268}
d="M80.268 7.532h5.197v17.92h-5.197z"
/>
</svg>
);
export default Resistor;

View File

@ -2,7 +2,10 @@ import React, { Component } from 'react';
import {
Row,
Col,
ListGroup,
ListGroupItem
} from 'reactstrap';
import Resistor from './resistor';
class Result extends Component {
state = {};
@ -11,45 +14,110 @@ class Result extends Component {
super(props);
this.state = {
series: this.props.series,
factors: this.props.factors,
powerSource: this.props.powerSource,
powerLed: this.props.powerLed,
ledConsumption: this.props.ledConsumption,
colors: this.props.colors,
perfectMatch: null,
overR: null,
underR: null,
series: this.props.series,
factors: this.props.factors
};
// First resistor before the perfect value
underR: null,
underRColors: [
'red',
'red'
],
underRRingTwo: {
color: 'red'
},
underRFactor: null,
// First resistor after the perfect value
overR: null,
overRRingOne: {
color: 'red'
},
overRRingTwo: {
color: 'red'
},
overRFactor: null,
};
}
componentDidMount = () => {
const perfectMatch = Math.round( 1000 * ((this.state.powerSource - this.state.powerLed ) / ( this.props.ledConsumption/1000))) / 1000;
let overR = null;
let beforeR = null;
let underR = null;
let underRFactor = null;
let overRFactor = null;
let underRColors = [];
let overRColors = [];
for( let iFactor = 0 ; iFactor < this.state.factors.length ; iFactor += 1 ) {
const factor = this.state.factors[iFactor];
for( let iSerie = 0 ; iSerie < this.state.series.e24.length ; iSerie += 1 ) {
const currentR = this.state.series.e24[iSerie] * factor;
if ( perfectMatch > 0 )
{
for( let iFactor = 0 ; iFactor < this.state.factors.length ; iFactor += 1 ) {
const factorDetails = this.state.factors[iFactor];
const factor = factorDetails.factor;
for( let iSerie = 0 ; iSerie < this.state.series.e24.length ; iSerie += 1 ) {
const currentR = this.state.series.e24[iSerie] * factor;
if ( currentR > perfectMatch ) {
overR = currentR;
console.log( overR);
if ( currentR >= perfectMatch ) {
overR = currentR;
overRFactor = factorDetails;
break;
}
underR = currentR;
}
underRFactor = factorDetails;
if ( overR)
{
break;
}
beforeR = currentR;
}
if ( overR)
{
break;
if ( overR === perfectMatch ){
underR = null;
overR = null;
underRFactor = null;
overRFactor = null;
}
}
this.setState({perfectMatch, overR, underR: beforeR});
// Extract colors from resistors
if ( underR ) {
for ( let i = 0 ; i < 2 ; i += 1) {
for ( let j = 0 ; j < this.state.colors.length ; j += 1) {
if ( this.state.colors[j].value === Number(underR.toString()[i]) ) {
underRColors[i] = this.state.colors[j].color;
break;
}
}
}
}
if ( overR ) {
for ( let i = 0 ; i < 2 ; i += 1) {
for ( let j = 0 ; j < this.state.colors.length ; j += 1) {
if ( this.state.colors[j].value === Number(overR.toString()[i]) ) {
overRColors[i] = this.state.colors[j].color;
break;
}
}
}
}
this.setState({
perfectMatch,
overR,
overRFactor,
underR,
underRFactor,
underRColors,
overRColors
});
}
render() {
@ -58,9 +126,49 @@ class Result extends Component {
<Col xs="12" md="12">
Vous devez mettre une résistance de <strong>{this.state.perfectMatch}&#8486;</strong>.
</Col>
<Col xs="12" md="12">
Les 2 résistances standard les plus proches sont <strong>{this.state.underR}&#8486;</strong> et <strong>{this.state.overR}&#8486;</strong>.
</Col>
{ this.state.overR ?
(
<Col xs="12">
Cette résistance n&#39;existant pas dans la série e24 vous pouvez opter pour l&#39;une des résistances suivante :
<ListGroup>
{this.state.underR ?
(
<ListGroupItem>
<Row>
<Col xs="12">
<strong>{this.state.underR}&#8486;</strong>
{' '}
({this.state.underR / this.state.underRFactor.factor} {this.state.underRFactor.factorLabel}&#8486;)
</Col>
<Col xs="12">
<Resistor ringone={this.state.underRColors[0]} ringtwo={this.state.underRColors[1]} factor={this.state.underRFactor.color} precision='#cd9932' />
</Col>
</Row>
</ListGroupItem>
)
: (null)
}
{this.state.overR ?
(
<ListGroupItem>
<Row>
<Col xs="12">
<strong>{this.state.overR}&#8486;</strong>
{' '}
({this.state.overR / this.state.overRFactor.factor} {this.state.overRFactor.factorLabel}&#8486;)
</Col>
<Col xs="12">
<Resistor ringone={this.state.overRColors[0]} ringtwo={this.state.overRColors[1]} factor={this.state.overRFactor.color} precision='#cd9932' />
</Col>
</Row>
</ListGroupItem>
)
: (null)
}
</ListGroup>
</Col>
) : (null)
}
</Row>
)
}