diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000000..ca9883f9a7e --- /dev/null +++ b/.prettierignore @@ -0,0 +1,4 @@ +.cache/ +.vscode/ +node_modules/ +public/ \ No newline at end of file diff --git a/documents/implementation-guide.md b/documents/implementation-guide.md new file mode 100644 index 00000000000..d5e96816903 --- /dev/null +++ b/documents/implementation-guide.md @@ -0,0 +1,77 @@ +## Implementation guide + +### Styled Component + +to use styled component you can import it + +``` +import styled from 'styled-components' +``` + +to use it you can create a function using the imported `styled` + +``` +const _component_name_ = styled._any_html_tag` + _your_css_style_ (for e.g.) + color: var(--color-red); + margin: 1rem 0.4rem; + background-color: ${props => props.is_testing ? var(--color-white) : var(--color-black)} + + &:hover { + _your_css_style_ + } + &._any_class_name { + _your_css_style_ + } +` +``` + +Then in your react component + +``` +<_component_name_> + +/_component_name_> +``` + +you can extend style component like this + +``` +const _want_extend_ = styled(_component_name_)` + _your_css_style_ +` +``` + +*noted that we are using `rem` as value where `10px = 1rem` +*for further information you can take a look at [Styled Component](https://www.styled-components.com/) + +### Image Component + +#### (png|jpg|jpeg|gif) file type + +image will be located anywhere within `src/images` directory. +this project uses GatsbyImageSharpFluid lazy load image built in gatsby-iamge. for further information, can take a look at [Gatsby Image](https://www.gatsbyjs.org/packages/gatsby-image), the configuration is located at +`src/components/elements/image.js`. + +Usage example: + +``` +_image_alt_ +``` + +#### svg file type + +svg willl be located anywhere within `src/images/svg` directory. +SVG will be handled by `gatsby-plugin-react-svg` which overriding `svg-react-loader`, you can take a look at [Gatsby SVG](https://www.gatsbyjs.org/packages/gatsby-plugin-react-svg/) + +Usage example: + +``` +import Logo from '../images/logo.svg' + + +``` diff --git a/documents/style-guide.md b/documents/style-guide.md new file mode 100644 index 00000000000..94845735218 --- /dev/null +++ b/documents/style-guide.md @@ -0,0 +1,104 @@ +# Development Style Guide + +In this project, tey to keep relevant files in 5 major directories which are `common`, `components`, `images`, `pages`, `themes`. +We will describe them more in the enxt sections. + +## File Structure + +Below is a sample file structure of the project. + +``` +src + ├── common/ + │ ├── websocket/ + │ ├── storage.js + │ └── utility.js + ├── components/ + │ ├── containers/ + │ ├── elements/ + │ ├── form/ + │ ├── layout/ + ├── images/ + │ ├── common/ + │ ├── svg/ + ├── pages/ + │ ├── index.js + │ ├── 404.js + │ ├── ... + ├── themes/ + │ ├── global-style.js + │ ├── reset.js + │ ├── variables.js + +gatsby-browser.js +gatsby-config.js +gatsby-node.js +``` + +## common + +The `common` directory contains common javascript to be used for utilities or for websocket calls. + +## components + +All reusable components will be stored in this directory. +contains React components, of either stateless or stateful varieties. +The optimal structure for components is to place files relevant to a component inside +its own subdirectory, e.g.: + +``` +Components/ +├── containers/ +└── elements/ +└── form/ +└── layout/ +``` + +`containers` used to store specific function component for e.g. (Localization or SEO); `elements` used to store reusable piece of ui component such as card, image, header, wrapper, etc; `form` used to store form component such as button or input; and lastly `layout` used to store main wrapper for pages. + +## images + +This directory contains all image resources. all images are handled with `gatsby-image` for `lazy-loading` image purposes. you can take a look at [Gatsby Image](https://www.gatsbyjs.org/packages/gatsby-image/?=gatsby-image) page to understand more about its function and the usage. except for svg will be handled by `gatsby-plugin-react-svg` which overriding `svg-react-loader`, you can take a look at [Gatsby SVG](https://www.gatsbyjs.org/packages/gatsby-plugin-react-svg/) to see its usage. + +## pages + +This directories contains all pages, the name of the file here will be the redirection link to each of the page. + +### COMPONENTS + +This directory contains React components, of either stateless or stateful varieties +(e.g. `function` or `class` components). + +The optimal structure for components is to place files relevant to a component inside +its own subdirectory, e.g.: + +``` +Components/ +├── Elements/ +│ ├── full-screen-dialog.jsx +│ └── mobile-widget.jsx +└── Form/ + ├── ContractType/ + ├── Purchase/ + ├── TradeParams/ + ├── form-layout.jsx + ├── screen-large.jsx + └── screen-small.jsx +``` + +#### Do: + +- Keep all files immediately relevant to a component inside the given component directory. + +- make it dead simple to import the component from elsewhere. +- Feel free to create subdirectories for relevant utils or helpers + if it helps to keep things tidy +- Keep components small, focused and easy to test, breaking up complex components into smaller components +- Try to create new, reusable components instead of "sub-components" + (i.e. prefer not to create sub-directories that contain more components) +- **Be consistent** — however, you choose to lay things out + +#### Don't: + +- Mix concerns (files, modules) that should really belong to other components +- Forget to write tests... :wink: diff --git a/gatsby-browser.js b/gatsby-browser.js index 69da152191c..68b13493529 100644 --- a/gatsby-browser.js +++ b/gatsby-browser.js @@ -1,5 +1,6 @@ import { BinarySocketGeneral } from './src/common/websocket/socket_general' import { NetworkMonitorBase } from './src/common/websocket/network_base' +import 'typeface-ibm-plex-sans' export const onInitialClientRender = () => { NetworkMonitorBase.init(BinarySocketGeneral) diff --git a/gatsby-config.js b/gatsby-config.js index 5eb911c6217..e58a6f39357 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -7,6 +7,7 @@ module.exports = { }, plugins: [ `gatsby-plugin-react-helmet`, + `gatsby-plugin-styled-components`, { resolve: `gatsby-source-filesystem`, options: { @@ -25,7 +26,15 @@ module.exports = { background_color: `#663399`, theme_color: `#663399`, display: `minimal-ui`, - icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site. + icon: `src/images/common/logo.png`, // This path is relative to the root of the site. + }, + }, + { + resolve: 'gatsby-plugin-react-svg', + options: { + rule: { + include: /svg/, // See below to configure properly + }, }, }, // this (optional) plugin enables Progressive Web App + Offline functionality diff --git a/package-lock.json b/package-lock.json index 165d20f32f5..34de4058cd0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -874,6 +874,27 @@ "to-fast-properties": "^2.0.0" } }, + "@emotion/is-prop-valid": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-0.8.1.tgz", + "integrity": "sha512-Wtaek/KGUP+HusWIa8DqtOR6U/Tl+QIdVkfJQHV3IT6ZImnJwklP5UVVPKZvkfljeFk3Q45CAPJ5N10gJ5XoLA==", + "dev": true, + "requires": { + "@emotion/memoize": "0.7.1" + } + }, + "@emotion/memoize": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.7.1.tgz", + "integrity": "sha512-Qv4LTqO11jepd5Qmlp3M1YEjBumoTHcHFdgPTQ+sFlIL5myi/7xu/POwP7IRu6odBdmLXdtIs1D6TuW6kbwbbg==", + "dev": true + }, + "@emotion/unitless": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.7.3.tgz", + "integrity": "sha512-4zAPlpDEh2VwXswwr/t8xGNDGg8RQiPxtxZ3qQEXyQsBV39ptTdESCjuBvGze1nLMVrxmTIKmnO/nAV8Tqjjzg==", + "dev": true + }, "@gatsbyjs/relay-compiler": { "version": "2.0.0-printer-fix.2", "resolved": "https://registry.npmjs.org/@gatsbyjs/relay-compiler/-/relay-compiler-2.0.0-printer-fix.2.tgz", @@ -1745,11 +1766,29 @@ "resolved": "https://registry.npmjs.org/babel-plugin-remove-graphql-queries/-/babel-plugin-remove-graphql-queries-2.6.3.tgz", "integrity": "sha512-vZEuO4kpPJsPex63BIMn5bBZGIDO42FQtzSD9UsDHjoWHfCB9/EQDnimtggI3Eyv4L3hwxsGNvVbS4IfFDJrlQ==" }, + "babel-plugin-styled-components": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/babel-plugin-styled-components/-/babel-plugin-styled-components-1.10.1.tgz", + "integrity": "sha512-F6R2TnPGNN6iuXCs0xQ+EsrunwNoWI55J5I8Pkd/+fzzbv1I4gFgTaZepMOVpLobYWU2XaLIm+73L0zD3CnOdQ==", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.0.0", + "@babel/helper-module-imports": "^7.0.0", + "babel-plugin-syntax-jsx": "^6.18.0", + "lodash": "^4.17.11" + } + }, "babel-plugin-syntax-dynamic-import": { "version": "6.18.0", "resolved": "https://registry.npmjs.org/babel-plugin-syntax-dynamic-import/-/babel-plugin-syntax-dynamic-import-6.18.0.tgz", "integrity": "sha1-jWomIpyDdFqZgqRBBRVyyqF5sdo=" }, + "babel-plugin-syntax-jsx": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz", + "integrity": "sha1-CvMqmm4Tyno/1QaeYtew9Y0NiUY=", + "dev": true + }, "babel-plugin-syntax-object-rest-spread": { "version": "6.13.0", "resolved": "https://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz", @@ -2675,6 +2714,12 @@ } } }, + "camelize": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/camelize/-/camelize-1.0.0.tgz", + "integrity": "sha1-FkpUg+Yw+kMh5a8HAg5TGDGyYJs=", + "dev": true + }, "caniuse-api": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/caniuse-api/-/caniuse-api-3.0.0.tgz", @@ -3450,6 +3495,32 @@ "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-1.0.0.tgz", "integrity": "sha1-ojD2T1aDEOFJgAmUB5DsmVRbyn4=" }, + "css": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/css/-/css-2.2.4.tgz", + "integrity": "sha512-oUnjmWpy0niI3x/mPL8dVEI1l7MnG3+HHyRPHf+YFSbK+svOhXpmSOcDURUh2aOCgl2grzrOPt1nHLuCVFULLw==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "source-map": "^0.6.1", + "source-map-resolve": "^0.5.2", + "urix": "^0.1.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "css-color-keywords": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/css-color-keywords/-/css-color-keywords-1.0.0.tgz", + "integrity": "sha1-/qJhbcZ2spYmhrOvjb2+GAskTgU=", + "dev": true + }, "css-color-names": { "version": "0.0.4", "resolved": "https://registry.npmjs.org/css-color-names/-/css-color-names-0.0.4.tgz", @@ -3556,6 +3627,17 @@ } } }, + "css-to-react-native": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/css-to-react-native/-/css-to-react-native-2.3.1.tgz", + "integrity": "sha512-yO+oEx1Lf+hDKasqQRVrAvzMCz825Huh1VMlEEDlRWyAhFb/FWb6I0KpEF1PkyKQ7NEdcx9d5M2ZEWgJAsgPvQ==", + "dev": true, + "requires": { + "camelize": "^1.0.0", + "css-color-keywords": "^1.0.0", + "postcss-value-parser": "^3.3.0" + } + }, "css-tree": { "version": "1.0.0-alpha.28", "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.0.0-alpha.28.tgz", @@ -4345,8 +4427,7 @@ "email-addresses": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/email-addresses/-/email-addresses-3.0.3.tgz", - "integrity": "sha512-kUlSC06PVvvjlMRpNIl3kR1NRXLEe86VQ7N0bQeaCZb2g+InShCeHQp/JvyYNTugMnRN2NvJhHlc3q12MWbbpg==", - "dev": true + "integrity": "sha512-kUlSC06PVvvjlMRpNIl3kR1NRXLEe86VQ7N0bQeaCZb2g+InShCeHQp/JvyYNTugMnRN2NvJhHlc3q12MWbbpg==" }, "emoji-regex": { "version": "7.0.3", @@ -5349,7 +5430,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/filenamify-url/-/filenamify-url-1.0.0.tgz", "integrity": "sha1-syvYExnvWGO3MHi+1Q9GpPeXX1A=", - "dev": true, "requires": { "filenamify": "^1.0.0", "humanize-url": "^1.0.0" @@ -5358,14 +5438,12 @@ "filename-reserved-regex": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-1.0.0.tgz", - "integrity": "sha1-5hz4BfDeHJhFZ9A4bcXfUO5a9+Q=", - "dev": true + "integrity": "sha1-5hz4BfDeHJhFZ9A4bcXfUO5a9+Q=" }, "filenamify": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/filenamify/-/filenamify-1.2.1.tgz", "integrity": "sha1-qfL/0RxQO+0wABUCknI3jx8TZaU=", - "dev": true, "requires": { "filename-reserved-regex": "^1.0.0", "strip-outer": "^1.0.0", @@ -6599,6 +6677,15 @@ "@babel/runtime": "^7.0.0" } }, + "gatsby-plugin-react-svg": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/gatsby-plugin-react-svg/-/gatsby-plugin-react-svg-2.1.1.tgz", + "integrity": "sha512-aWG283AvueCS0U4yZ+QujQnz4GDNoIBYMQ8MpQEvB+k6o+5DPZ473Cz+rlEejoevVxVeCVwuuu4K9phGIGk+7Q==", + "dev": true, + "requires": { + "svg-react-loader": "^0.4.4" + } + }, "gatsby-plugin-sharp": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/gatsby-plugin-sharp/-/gatsby-plugin-sharp-2.1.5.tgz", @@ -6647,6 +6734,15 @@ } } }, + "gatsby-plugin-styled-components": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/gatsby-plugin-styled-components/-/gatsby-plugin-styled-components-3.1.0.tgz", + "integrity": "sha512-VMaq82vU7WsfXj5kOxGJP7w9MOUUxT3mcs4NYZqHGvFU+2+oeO70SJ1WoeB5TSIFEKlNhGUiKTdL6NcMh54/nA==", + "dev": true, + "requires": { + "@babel/runtime": "^7.0.0" + } + }, "gatsby-react-router-scroll": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/gatsby-react-router-scroll/-/gatsby-react-router-scroll-2.0.7.tgz", @@ -6893,7 +6989,6 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/gh-pages/-/gh-pages-2.0.1.tgz", "integrity": "sha512-uFlk3bukljeiWKQ2XvPfjcSi/ou7IfoDf2p+Fj672saLAr8bnOdFVqI/JSgrSgInKpCg5BksxEwGUl++dbg8Dg==", - "dev": true, "requires": { "async": "^2.6.1", "commander": "^2.18.0", @@ -6909,7 +7004,6 @@ "version": "2.6.2", "resolved": "https://registry.npmjs.org/async/-/async-2.6.2.tgz", "integrity": "sha512-H1qVYh1MYhEEFLsP97cVKqCGo7KfCyTt6uEWqsTBr9SO84oK9Uwbyd/yCW+6rKJLHksBNUVWZDAjfS+Ccx0Bbg==", - "dev": true, "requires": { "lodash": "^4.17.11" } @@ -6918,7 +7012,6 @@ "version": "7.0.1", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", - "dev": true, "requires": { "graceful-fs": "^4.1.2", "jsonfile": "^4.0.0", @@ -7458,7 +7551,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/humanize-url/-/humanize-url-1.0.1.tgz", "integrity": "sha1-9KuZ4NKIF0yk4eUEB8VfuuRk7/8=", - "dev": true, "requires": { "normalize-url": "^1.0.0", "strip-url-auth": "^1.0.0" @@ -7468,7 +7560,6 @@ "version": "1.9.1", "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-1.9.1.tgz", "integrity": "sha1-LMDWazHqIwNkWENuNiDYWVTGbDw=", - "dev": true, "requires": { "object-assign": "^4.0.1", "prepend-http": "^1.0.0", @@ -7480,7 +7571,6 @@ "version": "4.3.4", "resolved": "https://registry.npmjs.org/query-string/-/query-string-4.3.4.tgz", "integrity": "sha1-u7aTucqRXCMlFbIosaArYJBD2+s=", - "dev": true, "requires": { "object-assign": "^4.1.0", "strict-uri-encode": "^1.0.0" @@ -7490,7 +7580,6 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz", "integrity": "sha1-RBttTTRnmPG05J6JIK37oOVD+a0=", - "dev": true, "requires": { "is-plain-obj": "^1.0.0" } @@ -8369,6 +8458,12 @@ "is-invalid-path": "^0.1.0" } }, + "is-what": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/is-what/-/is-what-3.2.3.tgz", + "integrity": "sha512-c4syLgFnjXTH5qd82Fp/qtUIeM0wA69xbI0KH1QpurMIvDaZFrS8UtAa4U52Dc2qSznaMxHit0gErMp6A/Qk1w==", + "dev": true + }, "is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", @@ -9079,6 +9174,12 @@ "mimic-fn": "^1.0.0" } }, + "memoize-one": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-5.0.4.tgz", + "integrity": "sha512-P0z5IeAH6qHHGkJIXWw0xC2HNEgkx/9uWWBQw64FJj3/ol14VYdfVGWWr0fXfjhhv3TKVIqUq65os6O4GUNksA==", + "dev": true + }, "memory-fs": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz", @@ -9173,6 +9274,15 @@ } } }, + "merge-anything": { + "version": "2.2.5", + "resolved": "https://registry.npmjs.org/merge-anything/-/merge-anything-2.2.5.tgz", + "integrity": "sha512-WgZGR7EQ1D8pyh57uKBbkPhUCJZLGdMzbDaxL4MDTJSGsvtpGdm8myr6DDtgJwT46xiFBlHqxbveDRpFBWlKWQ==", + "dev": true, + "requires": { + "is-what": "^3.2.3" + } + }, "merge-descriptors": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", @@ -11272,6 +11382,12 @@ "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.1.1.tgz", "integrity": "sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA==" }, + "ramda": { + "version": "0.21.0", + "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.21.0.tgz", + "integrity": "sha1-oAGr7bP/YQd9T/HVd9RN536NCjU=", + "dev": true + }, "randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -11984,6 +12100,12 @@ "aproba": "^1.1.1" } }, + "rx": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/rx/-/rx-4.1.0.tgz", + "integrity": "sha1-pfE/957zt0D+MKqAP7CfmIBdR4I=", + "dev": true + }, "rx-lite": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-4.0.8.tgz", @@ -13158,8 +13280,7 @@ "strip-url-auth": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/strip-url-auth/-/strip-url-auth-1.0.1.tgz", - "integrity": "sha1-IrD6OkE4WzO+PzMVUbu4N/oM164=", - "dev": true + "integrity": "sha1-IrD6OkE4WzO+PzMVUbu4N/oM164=" }, "style-loader": { "version": "0.21.0", @@ -13170,6 +13291,27 @@ "schema-utils": "^0.4.5" } }, + "styled-components": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/styled-components/-/styled-components-4.3.2.tgz", + "integrity": "sha512-NppHzIFavZ3TsIU3R1omtddJ0Bv1+j50AKh3ZWyXHuFvJq1I8qkQ5mZ7uQgD89Y8zJNx2qRo6RqAH1BmoVafHw==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.0.0", + "@babel/traverse": "^7.0.0", + "@emotion/is-prop-valid": "^0.8.1", + "@emotion/unitless": "^0.7.0", + "babel-plugin-styled-components": ">= 1", + "css-to-react-native": "^2.2.2", + "memoize-one": "^5.0.0", + "merge-anything": "^2.2.4", + "prop-types": "^15.5.4", + "react-is": "^16.6.0", + "stylis": "^3.5.0", + "stylis-rule-sheet": "^0.0.10", + "supports-color": "^5.5.0" + } + }, "stylehacks": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-4.0.3.tgz", @@ -13202,6 +13344,18 @@ } } }, + "stylis": { + "version": "3.5.4", + "resolved": "https://registry.npmjs.org/stylis/-/stylis-3.5.4.tgz", + "integrity": "sha512-8/3pSmthWM7lsPBKv7NXkzn2Uc9W7NotcwGNpJaa3k7WMM1XDCA4MgT5k/8BIexd5ydZdboXtU90XH9Ec4Bv/Q==", + "dev": true + }, + "stylis-rule-sheet": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/stylis-rule-sheet/-/stylis-rule-sheet-0.0.10.tgz", + "integrity": "sha512-nTbZoaqoBnmK+ptANthb10ZRZOGC+EmTLLUxeYIuHNkEKcmKgXX1XWKkUBT2Ac4es3NybooPe0SmvKdhKJZAuw==", + "dev": true + }, "supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -13210,6 +13364,64 @@ "has-flag": "^3.0.0" } }, + "svg-react-loader": { + "version": "0.4.6", + "resolved": "https://registry.npmjs.org/svg-react-loader/-/svg-react-loader-0.4.6.tgz", + "integrity": "sha512-HVEypjWQsQuJdBIPzXGxpmQsQts7QwfQuYgK1rah6BVCMoLNSCh/ESKVNd7/tHq8DkWYHHTyaUMDA1FjqZYrgA==", + "dev": true, + "requires": { + "css": "2.2.4", + "loader-utils": "1.1.0", + "ramda": "0.21.0", + "rx": "4.1.0", + "traverse": "0.6.6", + "xml2js": "0.4.17" + }, + "dependencies": { + "big.js": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/big.js/-/big.js-3.2.0.tgz", + "integrity": "sha512-+hN/Zh2D08Mx65pZ/4g5bsmNiZUuChDiQfTUQ7qJr4/kuopCr88xZsAXv6mBoZEsUI4OuGHlX59qE94K2mMW8Q==", + "dev": true + }, + "json5": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", + "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", + "dev": true + }, + "loader-utils": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.1.0.tgz", + "integrity": "sha1-yYrvSIvM7aL/teLeZG1qdUQp9c0=", + "dev": true, + "requires": { + "big.js": "^3.1.3", + "emojis-list": "^2.0.0", + "json5": "^0.5.0" + } + }, + "xml2js": { + "version": "0.4.17", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.17.tgz", + "integrity": "sha1-F76T6q4/O3eTWceVtBlwWogX6Gg=", + "dev": true, + "requires": { + "sax": ">=0.6.0", + "xmlbuilder": "^4.1.0" + } + }, + "xmlbuilder": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-4.2.1.tgz", + "integrity": "sha1-qlijBBoGb5DqoWwvU4n/GfP0YaU=", + "dev": true, + "requires": { + "lodash": "^4.0.0" + } + } + } + }, "svgo": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/svgo/-/svgo-1.2.2.tgz", @@ -13576,6 +13788,12 @@ } } }, + "traverse": { + "version": "0.6.6", + "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.6.6.tgz", + "integrity": "sha1-y99WD9e5r2MlAv7UD5GMFX6pcTc=", + "dev": true + }, "trim-newlines": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", @@ -13662,6 +13880,11 @@ "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" }, + "typeface-ibm-plex-sans": { + "version": "0.0.61", + "resolved": "https://registry.npmjs.org/typeface-ibm-plex-sans/-/typeface-ibm-plex-sans-0.0.61.tgz", + "integrity": "sha512-lR/PiUiki2n3+oSsrMditaAHpiUUtNEb8GTd1vebKcQ6XJdpgtwE7iYSNTgmSXYYPp71e8zVVJfg+M9rlaltfg==" + }, "ua-parser-js": { "version": "0.7.20", "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.20.tgz", diff --git a/package.json b/package.json index 505dfed35fb..e22dd4e361a 100644 --- a/package.json +++ b/package.json @@ -13,14 +13,19 @@ "gatsby-plugin-sharp": "^2.1.5", "gatsby-source-filesystem": "^2.0.39", "gatsby-transformer-sharp": "^2.1.21", + "gh-pages": "^2.0.1", "prop-types": "^15.7.2", "react": "^16.8.6", "react-dom": "^16.8.6", - "react-helmet": "^5.2.1" + "react-helmet": "^5.2.1", + "typeface-ibm-plex-sans": "0.0.61" }, "devDependencies": { - "gh-pages": "^2.0.1", - "prettier": "^1.18.2" + "babel-plugin-styled-components": "^1.10.1", + "gatsby-plugin-react-svg": "^2.1.1", + "gatsby-plugin-styled-components": "^3.1.0", + "prettier": "^1.18.2", + "styled-components": "^4.3.2" }, "keywords": [ "deriv", @@ -30,7 +35,7 @@ "scripts": { "build": "gatsby build", "develop": "gatsby develop", - "format": "prettier --write 'src/**/*.{js,jsx}'", + "format": "prettier --write '**/*.{js,jsx}' '*.js'", "start": "npm run develop", "serve": "gatsby serve", "test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\"", diff --git a/src/components/containers/image-wrapper.js b/src/components/containers/image-wrapper.js new file mode 100644 index 00000000000..cc3af365a12 --- /dev/null +++ b/src/components/containers/image-wrapper.js @@ -0,0 +1,7 @@ +import styled from 'styled-components' + +const ImageWrapper = styled.div` + max-width: ${props => props.width}; +` + +export default ImageWrapper diff --git a/src/components/elements/image.js b/src/components/elements/image.js index b48e7c04c92..80624de51ad 100644 --- a/src/components/elements/image.js +++ b/src/components/elements/image.js @@ -1,6 +1,7 @@ import React from 'react' import { StaticQuery, graphql } from 'gatsby' import Img from 'gatsby-image' +import ImageWrapper from '../containers/image-wrapper' /* * This component is built using `gatsby-image` to automatically serve optimized @@ -13,24 +14,37 @@ import Img from 'gatsby-image' * - `StaticQuery`: https://gatsby.dev/staticquery */ -const Image = () => ( +const Image = ({ img_name, alt, width }) => ( ( - - )} + render={data => { + const image = data.allImageSharp.edges.find( + edge => edge.node.fluid.originalName === img_name, + ) + if (!image) return null + + return ( + + {alt} + + ) + }} /> ) export default Image diff --git a/src/components/form/button.js b/src/components/form/button.js index 7776137451e..06bcec658b7 100644 --- a/src/components/form/button.js +++ b/src/components/form/button.js @@ -1,4 +1,6 @@ -import React from 'react' +import { styled } from 'styled-components' -const Button = ({ text }) => +const Button = styled.Button` + width: 2rem; +` export default Button diff --git a/src/components/layout/header.js b/src/components/layout/header.js index 2d3d0de3093..32eead070ba 100644 --- a/src/components/layout/header.js +++ b/src/components/layout/header.js @@ -1,83 +1,95 @@ import { Link } from 'gatsby' -import PropTypes from 'prop-types' import React from 'react' +import styled from 'styled-components' import Localize from '../containers/localize' +import LogoHeader from '../../images/svg/logo-header.svg' -const Header = ({ siteTitle }) => ( -
- -
-) +const StyledHeader = styled.header` + background-color: var(--color-black); + border-bottom: 1px solid rgba(0, 0, 0, 0.0975); +` + +const Wrapper = styled.div` + width: 80%; + margin: 0 auto; + display: flex; + align-items: center; + padding: 2rem 1rem; +` + +const NavLeft = styled.div` + width: 25%; + text-align: left; +` + +const NavCenter = styled.div` + width: 50%; + text-align: center; +` + +const NavRight = styled.div` + width: 25%; + text-align: right; +` -Header.propTypes = { - siteTitle: PropTypes.string, -} +const StyledLink = styled(props => )` + color: var(--color-white); + text-decoration: none; + padding: 1rem; + border-bottom: 1px solid transparent; + transition: border-bottom 0.25s; + margin: 0 0.3rem; -Header.defaultProps = { - siteTitle: ``, -} + &:hover { + border-bottom: 1px solid var(--color-red); + } + &.active { + border-bottom: 1px solid var(--color-red); + } +` + +const NavButton = styled.button` + border-radius: 6px; + border: 2px solid var(--color-red); + color: var(--color-red); + background-color: transparent; + padding: 0.6rem 1.2rem; + font-size: 100%; + + &:hover { + background-color: var(--color-red); + color: var(--color-white); + transition: background-color 0.2s, color 0.2s; + cursor: pointer; + } +` + +const Header = () => ( + + + + + + + + + + + + + + + + + + + + + + + + + +) export default Header diff --git a/src/components/layout/layout.css b/src/components/layout/layout.css deleted file mode 100644 index b6f63320fb8..00000000000 --- a/src/components/layout/layout.css +++ /dev/null @@ -1,622 +0,0 @@ -html { - font-family: sans-serif; - -ms-text-size-adjust: 100%; - -webkit-text-size-adjust: 100%; -} -body { - margin: 0; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} -article, -aside, -details, -figcaption, -figure, -footer, -header, -main, -menu, -nav, -section, -summary { - display: block; -} -audio, -canvas, -progress, -video { - display: inline-block; -} -audio:not([controls]) { - display: none; - height: 0; -} -progress { - vertical-align: baseline; -} -[hidden], -template { - display: none; -} -a { - background-color: transparent; - -webkit-text-decoration-skip: objects; -} -a:active, -a:hover { - outline-width: 0; -} -abbr[title] { - border-bottom: none; - text-decoration: underline; - text-decoration: underline dotted; -} -b, -strong { - font-weight: inherit; - font-weight: bolder; -} -dfn { - font-style: italic; -} -h1 { - font-size: 2em; - margin: 0.67em 0; -} -mark { - background-color: #ff0; - color: #000; -} -small { - font-size: 80%; -} -sub, -sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; -} -sub { - bottom: -0.25em; -} -sup { - top: -0.5em; -} -img { - border-style: none; -} -svg:not(:root) { - overflow: hidden; -} -code, -kbd, -pre, -samp { - font-family: monospace, monospace; - font-size: 1em; -} -figure { - margin: 1em 40px; -} -hr { - box-sizing: content-box; - height: 0; - overflow: visible; -} -button, -input, -optgroup, -select, -textarea { - font: inherit; - margin: 0; -} -optgroup { - font-weight: 700; -} -button, -input { - overflow: visible; -} -button, -select { - text-transform: none; -} -[type="reset"], -[type="submit"], -button, -html [type="button"] { - -webkit-appearance: button; -} -[type="button"]::-moz-focus-inner, -[type="reset"]::-moz-focus-inner, -[type="submit"]::-moz-focus-inner, -button::-moz-focus-inner { - border-style: none; - padding: 0; -} -[type="button"]:-moz-focusring, -[type="reset"]:-moz-focusring, -[type="submit"]:-moz-focusring, -button:-moz-focusring { - outline: 1px dotted ButtonText; -} -fieldset { - border: 1px solid silver; - margin: 0 2px; - padding: 0.35em 0.625em 0.75em; -} -legend { - box-sizing: border-box; - color: inherit; - display: table; - max-width: 100%; - padding: 0; - white-space: normal; -} -textarea { - overflow: auto; -} -[type="checkbox"], -[type="radio"] { - box-sizing: border-box; - padding: 0; -} -[type="number"]::-webkit-inner-spin-button, -[type="number"]::-webkit-outer-spin-button { - height: auto; -} -[type="search"] { - -webkit-appearance: textfield; - outline-offset: -2px; -} -[type="search"]::-webkit-search-cancel-button, -[type="search"]::-webkit-search-decoration { - -webkit-appearance: none; -} -::-webkit-input-placeholder { - color: inherit; - opacity: 0.54; -} -::-webkit-file-upload-button { - -webkit-appearance: button; - font: inherit; -} -html { - font: 112.5%/1.45em georgia, serif; - box-sizing: border-box; - overflow-y: scroll; -} -* { - box-sizing: inherit; -} -*:before { - box-sizing: inherit; -} -*:after { - box-sizing: inherit; -} -body { - color: hsla(0, 0%, 0%, 0.8); - font-family: georgia, serif; - font-weight: normal; - word-wrap: break-word; - font-kerning: normal; - -moz-font-feature-settings: "kern", "liga", "clig", "calt"; - -ms-font-feature-settings: "kern", "liga", "clig", "calt"; - -webkit-font-feature-settings: "kern", "liga", "clig", "calt"; - font-feature-settings: "kern", "liga", "clig", "calt"; -} -img { - max-width: 100%; - margin-left: 0; - margin-right: 0; - margin-top: 0; - padding-bottom: 0; - padding-left: 0; - padding-right: 0; - padding-top: 0; - margin-bottom: 1.45rem; -} -h1 { - margin-left: 0; - margin-right: 0; - margin-top: 0; - padding-bottom: 0; - padding-left: 0; - padding-right: 0; - padding-top: 0; - margin-bottom: 1.45rem; - color: inherit; - font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, - Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; - font-weight: bold; - text-rendering: optimizeLegibility; - font-size: 2.25rem; - line-height: 1.1; -} -h2 { - margin-left: 0; - margin-right: 0; - margin-top: 0; - padding-bottom: 0; - padding-left: 0; - padding-right: 0; - padding-top: 0; - margin-bottom: 1.45rem; - color: inherit; - font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, - Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; - font-weight: bold; - text-rendering: optimizeLegibility; - font-size: 1.62671rem; - line-height: 1.1; -} -h3 { - margin-left: 0; - margin-right: 0; - margin-top: 0; - padding-bottom: 0; - padding-left: 0; - padding-right: 0; - padding-top: 0; - margin-bottom: 1.45rem; - color: inherit; - font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, - Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; - font-weight: bold; - text-rendering: optimizeLegibility; - font-size: 1.38316rem; - line-height: 1.1; -} -h4 { - margin-left: 0; - margin-right: 0; - margin-top: 0; - padding-bottom: 0; - padding-left: 0; - padding-right: 0; - padding-top: 0; - margin-bottom: 1.45rem; - color: inherit; - font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, - Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; - font-weight: bold; - text-rendering: optimizeLegibility; - font-size: 1rem; - line-height: 1.1; -} -h5 { - margin-left: 0; - margin-right: 0; - margin-top: 0; - padding-bottom: 0; - padding-left: 0; - padding-right: 0; - padding-top: 0; - margin-bottom: 1.45rem; - color: inherit; - font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, - Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; - font-weight: bold; - text-rendering: optimizeLegibility; - font-size: 0.85028rem; - line-height: 1.1; -} -h6 { - margin-left: 0; - margin-right: 0; - margin-top: 0; - padding-bottom: 0; - padding-left: 0; - padding-right: 0; - padding-top: 0; - margin-bottom: 1.45rem; - color: inherit; - font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, - Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; - font-weight: bold; - text-rendering: optimizeLegibility; - font-size: 0.78405rem; - line-height: 1.1; -} -hgroup { - margin-left: 0; - margin-right: 0; - margin-top: 0; - padding-bottom: 0; - padding-left: 0; - padding-right: 0; - padding-top: 0; - margin-bottom: 1.45rem; -} -ul { - margin-left: 1.45rem; - margin-right: 0; - margin-top: 0; - padding-bottom: 0; - padding-left: 0; - padding-right: 0; - padding-top: 0; - margin-bottom: 1.45rem; - list-style-position: outside; - list-style-image: none; -} -ol { - margin-left: 1.45rem; - margin-right: 0; - margin-top: 0; - padding-bottom: 0; - padding-left: 0; - padding-right: 0; - padding-top: 0; - margin-bottom: 1.45rem; - list-style-position: outside; - list-style-image: none; -} -dl { - margin-left: 0; - margin-right: 0; - margin-top: 0; - padding-bottom: 0; - padding-left: 0; - padding-right: 0; - padding-top: 0; - margin-bottom: 1.45rem; -} -dd { - margin-left: 0; - margin-right: 0; - margin-top: 0; - padding-bottom: 0; - padding-left: 0; - padding-right: 0; - padding-top: 0; - margin-bottom: 1.45rem; -} -p { - margin-left: 0; - margin-right: 0; - margin-top: 0; - padding-bottom: 0; - padding-left: 0; - padding-right: 0; - padding-top: 0; - margin-bottom: 1.45rem; -} -figure { - margin-left: 0; - margin-right: 0; - margin-top: 0; - padding-bottom: 0; - padding-left: 0; - padding-right: 0; - padding-top: 0; - margin-bottom: 1.45rem; -} -pre { - margin-left: 0; - margin-right: 0; - margin-top: 0; - margin-bottom: 1.45rem; - font-size: 0.85rem; - line-height: 1.42; - background: hsla(0, 0%, 0%, 0.04); - border-radius: 3px; - overflow: auto; - word-wrap: normal; - padding: 1.45rem; -} -table { - margin-left: 0; - margin-right: 0; - margin-top: 0; - padding-bottom: 0; - padding-left: 0; - padding-right: 0; - padding-top: 0; - margin-bottom: 1.45rem; - font-size: 1rem; - line-height: 1.45rem; - border-collapse: collapse; - width: 100%; -} -fieldset { - margin-left: 0; - margin-right: 0; - margin-top: 0; - padding-bottom: 0; - padding-left: 0; - padding-right: 0; - padding-top: 0; - margin-bottom: 1.45rem; -} -blockquote { - margin-left: 1.45rem; - margin-right: 1.45rem; - margin-top: 0; - padding-bottom: 0; - padding-left: 0; - padding-right: 0; - padding-top: 0; - margin-bottom: 1.45rem; -} -form { - margin-left: 0; - margin-right: 0; - margin-top: 0; - padding-bottom: 0; - padding-left: 0; - padding-right: 0; - padding-top: 0; - margin-bottom: 1.45rem; -} -noscript { - margin-left: 0; - margin-right: 0; - margin-top: 0; - padding-bottom: 0; - padding-left: 0; - padding-right: 0; - padding-top: 0; - margin-bottom: 1.45rem; -} -iframe { - margin-left: 0; - margin-right: 0; - margin-top: 0; - padding-bottom: 0; - padding-left: 0; - padding-right: 0; - padding-top: 0; - margin-bottom: 1.45rem; -} -hr { - margin-left: 0; - margin-right: 0; - margin-top: 0; - padding-bottom: 0; - padding-left: 0; - padding-right: 0; - padding-top: 0; - margin-bottom: calc(1.45rem - 1px); - background: hsla(0, 0%, 0%, 0.2); - border: none; - height: 1px; -} -address { - margin-left: 0; - margin-right: 0; - margin-top: 0; - padding-bottom: 0; - padding-left: 0; - padding-right: 0; - padding-top: 0; - margin-bottom: 1.45rem; -} -b { - font-weight: bold; -} -strong { - font-weight: bold; -} -dt { - font-weight: bold; -} -th { - font-weight: bold; -} -li { - margin-bottom: calc(1.45rem / 2); -} -ol li { - padding-left: 0; -} -ul li { - padding-left: 0; -} -li > ol { - margin-left: 1.45rem; - margin-bottom: calc(1.45rem / 2); - margin-top: calc(1.45rem / 2); -} -li > ul { - margin-left: 1.45rem; - margin-bottom: calc(1.45rem / 2); - margin-top: calc(1.45rem / 2); -} -blockquote *:last-child { - margin-bottom: 0; -} -li *:last-child { - margin-bottom: 0; -} -p *:last-child { - margin-bottom: 0; -} -li > p { - margin-bottom: calc(1.45rem / 2); -} -code { - font-size: 0.85rem; - line-height: 1.45rem; -} -kbd { - font-size: 0.85rem; - line-height: 1.45rem; -} -samp { - font-size: 0.85rem; - line-height: 1.45rem; -} -abbr { - border-bottom: 1px dotted hsla(0, 0%, 0%, 0.5); - cursor: help; -} -acronym { - border-bottom: 1px dotted hsla(0, 0%, 0%, 0.5); - cursor: help; -} -abbr[title] { - border-bottom: 1px dotted hsla(0, 0%, 0%, 0.5); - cursor: help; - text-decoration: none; -} -thead { - text-align: left; -} -td, -th { - text-align: left; - border-bottom: 1px solid hsla(0, 0%, 0%, 0.12); - font-feature-settings: "tnum"; - -moz-font-feature-settings: "tnum"; - -ms-font-feature-settings: "tnum"; - -webkit-font-feature-settings: "tnum"; - padding-left: 0.96667rem; - padding-right: 0.96667rem; - padding-top: 0.725rem; - padding-bottom: calc(0.725rem - 1px); -} -th:first-child, -td:first-child { - padding-left: 0; -} -th:last-child, -td:last-child { - padding-right: 0; -} -tt, -code { - background-color: hsla(0, 0%, 0%, 0.04); - border-radius: 3px; - font-family: "SFMono-Regular", Consolas, "Roboto Mono", "Droid Sans Mono", - "Liberation Mono", Menlo, Courier, monospace; - padding: 0; - padding-top: 0.2em; - padding-bottom: 0.2em; -} -pre code { - background: none; - line-height: 1.42; -} -code:before, -code:after, -tt:before, -tt:after { - letter-spacing: -0.2em; - content: " "; -} -pre code:before, -pre code:after, -pre tt:before, -pre tt:after { - content: ""; -} -@media only screen and (max-width: 480px) { - html { - font-size: 100%; - } -} diff --git a/src/components/layout/layout.js b/src/components/layout/layout.js index 1eb05e382c3..8915df60b1a 100644 --- a/src/components/layout/layout.js +++ b/src/components/layout/layout.js @@ -1,39 +1,17 @@ import React from 'react' import PropTypes from 'prop-types' -import { StaticQuery, graphql } from 'gatsby' import Header from './header' import Footer from './footer' -import './layout.css' +import GlobalStyle from '../../themes/global-style' const Layout = ({ children }) => ( - ( - <> -
-
-
{children}
-
-