From 07fd09f4d9cdb7c7c0166a73f2be567f61289411 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Fri, 9 Nov 2018 17:17:14 +0100 Subject: [PATCH] rename and refactor --- data/{components.yml => repositories.yml} | 0 src/components/Components.jsx | 100 ------------------ src/components/Components.module.scss | 72 ------------- src/components/Repositories/Repository.jsx | 26 +++++ .../Repositories/Repository.module.scss | 31 ++++++ .../Repositories/RepositoryList.jsx | 31 ++++++ .../Repositories/RepositoryList.module.scss | 28 +++++ src/components/Repositories/index.jsx | 54 ++++++++++ src/components/Repositories/index.module.scss | 11 ++ src/pages/index.js | 4 +- 10 files changed, 183 insertions(+), 174 deletions(-) rename data/{components.yml => repositories.yml} (100%) delete mode 100644 src/components/Components.jsx delete mode 100644 src/components/Components.module.scss create mode 100644 src/components/Repositories/Repository.jsx create mode 100644 src/components/Repositories/Repository.module.scss create mode 100644 src/components/Repositories/RepositoryList.jsx create mode 100644 src/components/Repositories/RepositoryList.module.scss create mode 100644 src/components/Repositories/index.jsx create mode 100644 src/components/Repositories/index.module.scss diff --git a/data/components.yml b/data/repositories.yml similarity index 100% rename from data/components.yml rename to data/repositories.yml diff --git a/src/components/Components.jsx b/src/components/Components.jsx deleted file mode 100644 index 850272be..00000000 --- a/src/components/Components.jsx +++ /dev/null @@ -1,100 +0,0 @@ -import React from 'react' -import PropTypes from 'prop-types' -import { StaticQuery, graphql } from 'gatsby' -import styles from './Components.module.scss' - -const Component = ({ name, description, links }) => ( -
-

{name}

-

{description}

- - -
-) - -Component.propTypes = { - name: PropTypes.string.isRequired, - description: PropTypes.string.isRequired, - links: PropTypes.array.isRequired -} - -const ComponentsList = ({ components }) => ( -
- {components.map(({ node }) => ( -
-

{node.group}

- -
- {node.items.map(item => ( - - ))} -
-
- ))} -
-) - -ComponentsList.propTypes = { - components: PropTypes.array.isRequired -} - -const QuickRun = () => ( -
- - Wanna quickly get an Ocean network running on your machine? Check - out{' '} - - 🐳 docker-images - - . - -
-) - -const Components = () => ( - { - const components = data.allComponentsYaml.edges - - return ( -
- - -
- ) - }} - /> -) - -export default Components diff --git a/src/components/Components.module.scss b/src/components/Components.module.scss deleted file mode 100644 index 08042fa0..00000000 --- a/src/components/Components.module.scss +++ /dev/null @@ -1,72 +0,0 @@ -@import 'variables'; - -.components { - margin-top: $spacer * 2; -} - -.quickrun { - padding-top: $spacer * 2; - padding-bottom: $spacer * 2; - text-align: center; -} - -.componentsLists { - @media (min-width: $break-point--medium) { - display: flex; - flex-wrap: wrap; - justify-content: space-between; - } -} - -.componentsList { - @media (min-width: $break-point--medium) { - flex: 0 0 45%; - } -} - -.componentsWrapper { - @media (min-width: $break-point--small) { - display: flex; - flex-wrap: wrap; - justify-content: space-between; - } -} - -.componentsTitle { - font-size: $font-size-h4; - color: $brand-grey-light; -} - -.component { - padding: $spacer / $line-height; - border: 1px solid $brand-grey-lighter; - border-radius: $border-radius; - margin-bottom: 5%; - - @media (min-width: $break-point--small) { - flex: 0 0 100%; - } -} - -.componentName { - font-size: $font-size-large; - margin-top: 0; -} - -.componentLinks { - margin: 0; - padding: 0; - margin-left: -($spacer / 2); - - li { - display: inline-block; - padding: 0; - margin-left: $spacer / 2; - - &:before { display: none; } - } - - a { - - } -} diff --git a/src/components/Repositories/Repository.jsx b/src/components/Repositories/Repository.jsx new file mode 100644 index 00000000..d383d351 --- /dev/null +++ b/src/components/Repositories/Repository.jsx @@ -0,0 +1,26 @@ +import React from 'react' +import PropTypes from 'prop-types' +import styles from './Repository.module.scss' + +const Repository = ({ name, description, links }) => ( +
+

{name}

+

{description}

+ + +
+) + +Repository.propTypes = { + name: PropTypes.string.isRequired, + description: PropTypes.string.isRequired, + links: PropTypes.array.isRequired +} + +export default Repository diff --git a/src/components/Repositories/Repository.module.scss b/src/components/Repositories/Repository.module.scss new file mode 100644 index 00000000..22d68929 --- /dev/null +++ b/src/components/Repositories/Repository.module.scss @@ -0,0 +1,31 @@ +@import 'variables'; + +.repository { + padding: $spacer / $line-height; + border: 1px solid $brand-grey-lighter; + border-radius: $border-radius; + margin-bottom: 5%; + + @media (min-width: $break-point--small) { + flex: 0 0 100%; + } +} + +.repositoryName { + font-size: $font-size-large; + margin-top: 0; +} + +.repositoryLinks { + margin: 0; + padding: 0; + margin-left: -($spacer / 2); + + li { + display: inline-block; + padding: 0; + margin-left: $spacer / 2; + + &:before { display: none; } + } +} diff --git a/src/components/Repositories/RepositoryList.jsx b/src/components/Repositories/RepositoryList.jsx new file mode 100644 index 00000000..f4579c5d --- /dev/null +++ b/src/components/Repositories/RepositoryList.jsx @@ -0,0 +1,31 @@ +import React from 'react' +import PropTypes from 'prop-types' +import Repository from './Repository' +import styles from './RepositoryList.module.scss' + +const RepositoryList = ({ repositories }) => ( +
+ {repositories.map(({ node }) => ( +
+

{node.group}

+ +
+ {node.items.map(item => ( + + ))} +
+
+ ))} +
+) + +RepositoryList.propTypes = { + repositories: PropTypes.array.isRequired +} + +export default RepositoryList diff --git a/src/components/Repositories/RepositoryList.module.scss b/src/components/Repositories/RepositoryList.module.scss new file mode 100644 index 00000000..9c8dc97b --- /dev/null +++ b/src/components/Repositories/RepositoryList.module.scss @@ -0,0 +1,28 @@ +@import 'variables'; + +.repositoryLists { + @media (min-width: $break-point--medium) { + display: flex; + flex-wrap: wrap; + justify-content: space-between; + } +} + +.repositoryList { + @media (min-width: $break-point--medium) { + flex: 0 0 45%; + } +} + +.repositoryWrapper { + @media (min-width: $break-point--small) { + display: flex; + flex-wrap: wrap; + justify-content: space-between; + } +} + +.repositoryListTitle { + font-size: $font-size-h4; + color: $brand-grey-light; +} diff --git a/src/components/Repositories/index.jsx b/src/components/Repositories/index.jsx new file mode 100644 index 00000000..e6d5a8a5 --- /dev/null +++ b/src/components/Repositories/index.jsx @@ -0,0 +1,54 @@ +import React from 'react' +import { StaticQuery, graphql } from 'gatsby' +import RepositoryList from './RepositoryList' +import styles from './index.module.scss' + +const QuickRun = () => ( +
+ + Wanna quickly get an Ocean network running on your machine? Check + out{' '} + + 🐳 docker-images + + . + +
+) + +const Repositories = () => ( + { + const repositories = data.allRepositoriesYaml.edges + + return ( +
+ + +
+ ) + }} + /> +) + +export default Repositories diff --git a/src/components/Repositories/index.module.scss b/src/components/Repositories/index.module.scss new file mode 100644 index 00000000..abed0762 --- /dev/null +++ b/src/components/Repositories/index.module.scss @@ -0,0 +1,11 @@ +@import 'variables'; + +.repositories { + margin-top: $spacer * 2; +} + +.quickrun { + padding-top: $spacer * 2; + padding-bottom: $spacer * 2; + text-align: center; +} diff --git a/src/pages/index.js b/src/pages/index.js index c72b303a..3e6c87ae 100755 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -4,7 +4,7 @@ import { Link, graphql } from 'gatsby' import Layout from '../components/Layout' import Content from '../components/Content' import HeaderHome from '../components/HeaderHome' -import Components from '../components/Components' +import Repositories from '../components/Repositories' import { ReactComponent as Arrow } from '../images/arrow.svg' import styles from './index.module.scss' @@ -37,7 +37,7 @@ const IndexPage = ({ data, location }) => ( ))} - + )