diff --git a/spikes/graphs-fe/plotly/.babelrc b/spikes/graphs-fe/plotly/.babelrc new file mode 100644 index 00000000..82cc857a --- /dev/null +++ b/spikes/graphs-fe/plotly/.babelrc @@ -0,0 +1,15 @@ +{ + "presets": [ + "react", + "es2015" + ], + "plugins": [ + ["transform-object-rest-spread", { + "useBuiltIns": true + }], + "add-module-exports", + "transform-es2015-modules-commonjs", + "react-hot-loader/babel" + ], + "sourceMaps": "both" +} diff --git a/spikes/graphs-fe/plotly/.eslintignore b/spikes/graphs-fe/plotly/.eslintignore new file mode 100644 index 00000000..683e721c --- /dev/null +++ b/spikes/graphs-fe/plotly/.eslintignore @@ -0,0 +1,3 @@ +/node_modules +coverage +.nyc_output diff --git a/spikes/graphs-fe/plotly/.eslintrc b/spikes/graphs-fe/plotly/.eslintrc new file mode 100644 index 00000000..19bd88dc --- /dev/null +++ b/spikes/graphs-fe/plotly/.eslintrc @@ -0,0 +1,29 @@ +{ + "extends": "semistandard", + "parser": "babel-eslint", + "parserOptions": { + "ecmaVersion": 7, + "ecmaFeatures": { + "jsx": true + }, + "sourceType": "module" + }, + "plugins": [ + "babel", + "react" + ], + "rules": { + "generator-star-spacing": 0, + "babel/generator-star-spacing": 1, + "space-before-function-paren": [2, "never"], + "react/jsx-uses-react": 2, + "react/jsx-uses-vars": 2, + "react/react-in-jsx-scope": 2, + "object-curly-newline": ["error", { + "minProperties": 1 + }], + "sort-vars": ["error", { + "ignoreCase": true + }] + } +} \ No newline at end of file diff --git a/spikes/graphs-fe/plotly/.gitignore b/spikes/graphs-fe/plotly/.gitignore new file mode 100644 index 00000000..c21b0ba0 --- /dev/null +++ b/spikes/graphs-fe/plotly/.gitignore @@ -0,0 +1,4 @@ +/node_modules +coverage +.nyc_output +npm-debug.log diff --git a/spikes/graphs-fe/plotly/.storybook/config.js b/spikes/graphs-fe/plotly/.storybook/config.js new file mode 100644 index 00000000..d17d412a --- /dev/null +++ b/spikes/graphs-fe/plotly/.storybook/config.js @@ -0,0 +1,5 @@ +const Storybook = require('@kadira/storybook'); + +Storybook.configure(() => { + require('../stories'); +}, module); diff --git a/spikes/graphs-fe/plotly/lib/data.js b/spikes/graphs-fe/plotly/lib/data.js new file mode 100644 index 00000000..fc36391b --- /dev/null +++ b/spikes/graphs-fe/plotly/lib/data.js @@ -0,0 +1,18 @@ +const data = [ + { + type: 'scatter', // all "scatter" attributes: https://plot.ly/javascript/reference/#scatter + x: [1, 2, 3], // more about "x": #scatter-x + y: [6, 2, 3], // #scatter-y + marker: { // marker is an object, valid marker keys: #scatter-marker + color: 'rgb(16, 32, 77)' // more about "marker.color": #scatter-marker-color + } + }, + { + type: 'bar', // all "bar" chart attributes: #bar + x: [1, 2, 3], // more about "x": #bar-x + y: [6, 2, 3], // #bar-y + name: 'bar chart example' // #bar-name + } +]; + +module.exports = data; diff --git a/spikes/graphs-fe/plotly/package.json b/spikes/graphs-fe/plotly/package.json new file mode 100644 index 00000000..bf193104 --- /dev/null +++ b/spikes/graphs-fe/plotly/package.json @@ -0,0 +1,59 @@ +{ + "name": "redux-thunks-spike", + "private": true, + "license": "private", + "main": "src/index.js", + "scripts": { + "start": "webpack-dev-server --open --config webpack.config.js", + "lint": "eslint .", + "test": "NODE_ENV=test nyc ava test/*.js --fail-fast --verbose --tap", + "open": "nyc report --reporter=html & open coverage/index.html", + "coverage": "nyc check-coverage --statements 100 --functions 100 --lines 100 --branches 100", + "storybook": "start-storybook -p 6006", + "build-storybook": "build-storybook" + }, + "dependencies": { + "autoprefixer": "^6.5.1", + "babel-eslint": "^7.0.0", + "babel-loader": "^6.2.5", + "babel-plugin-add-module-exports": "^0.2.1", + "babel-plugin-transform-es2015-modules-commonjs": "^6.16.0", + "babel-plugin-transform-object-rest-spread": "^6.16.0", + "babel-plugin-transform-runtime": "^6.15.0", + "babel-preset-es2015": "^6.16.0", + "babel-preset-react": "^6.16.0", + "babel-preset-react-hmre": "^1.1.1", + "babel-runtime": "^6.11.6", + "css-loader": "^0.25.0", + "postcss-loader": "^1.0.0", + "postcss-modules-values": "^1.2.2", + "postcss-nested": "^1.0.0", + "react": "^15.3.2", + "react-dom": "^15.3.2", + "react-hot-loader": "^3.0.0-beta.6", + "style-loader": "^0.13.1", + "webpack": "^1.13.2", + "webpack-dev-server": "^1.16.2" + }, + "devDependencies": { + "@kadira/storybook": "^2.24.1", + "ava": "^0.16.0", + "babel-register": "^6.16.3", + "enzyme": "^2.5.1", + "eslint": "^3.8.1", + "eslint-config-semistandard": "^7.0.0", + "eslint-config-standard": "^6.2.0", + "eslint-plugin-babel": "^3.3.0", + "eslint-plugin-promise": "^3.3.0", + "eslint-plugin-react": "^6.4.1", + "eslint-plugin-standard": "^2.0.1", + "nyc": "^8.3.1", + "react-addons-test-utils": "^15.3.2" + }, + "ava": { + "require": [ + "babel-register" + ], + "babel": "inherit" + } +} diff --git a/spikes/graphs-fe/plotly/readme.md b/spikes/graphs-fe/plotly/readme.md new file mode 100644 index 00000000..1c57af1b --- /dev/null +++ b/spikes/graphs-fe/plotly/readme.md @@ -0,0 +1,15 @@ +# postcss + css-modules + +#### src/showcase + +contains all the files to showcase the components + +#### src/components + +contains all the css files and react components + +## usage + +## todo + + - [ ] mixins (https://github.com/postcss/postcss-mixins) \ No newline at end of file diff --git a/spikes/graphs-fe/plotly/src/components/base/index.css b/spikes/graphs-fe/plotly/src/components/base/index.css new file mode 100644 index 00000000..1eda3b18 --- /dev/null +++ b/spikes/graphs-fe/plotly/src/components/base/index.css @@ -0,0 +1,103 @@ +@value color_primary_dark, font_primary, font_secondary, font_tertiary from "./variables.css"; + +.base { + :global { + h1, + h2, + h3, + h4, + h5, + p, + li { + color: color_primary_dark; + } + + h1, + h2, + h3 { + font-family: font_primary; + } + + h4, + p, + li { + font-family: font_secondary; + } + + a { + font-family: inherit; + text-decoration: none; + + &:hover { + text-decoration: none; + } + } + + h5, + p, + li { + & > a:hover { + text-decoration: underline; + } + } + + h1 { + font-size: 14px; + line-height: 35px; + } + + h2 { + font-size: 10px; + line-height: 25px; + } + + h3 { + font-size: 6px; + line-height: 20px; + } + + h4 { + font-size: 15px; + line-height: 20px; + letter-spacing: -0.025em; + } + + h5 { + font-family: font_tertiary; + font-style: italic; + font-size: 15px; + line-height: 20px; + } + + p { + font-size: 14px; + line-height: 18px; + letter-spacing: -0.025em; + + a { + text-decoration: underline; + } + + &.small { + font-size: 12px; + line-height: 16px; + } + } + + span { + font-family: inherit; + } + + button, + select, + a { + outline: none; + } + + /* Removes the grey background when you tap on a link in IOS */ + button, + a { + -webkit-tap-highlight-color: rgba(0,0,0,0); + } + } +} diff --git a/spikes/graphs-fe/plotly/src/components/base/index.js b/spikes/graphs-fe/plotly/src/components/base/index.js new file mode 100644 index 00000000..a08c8138 --- /dev/null +++ b/spikes/graphs-fe/plotly/src/components/base/index.js @@ -0,0 +1,12 @@ +const React = require('react'); +const styles = require('./index.css'); + +module.exports = ({ + children +}) => { + return ( +
Hello
+ +