diff --git a/app/__utils__/makeWithMockedProvider/index.js b/app/__utils__/makeWithMockedProvider/index.js deleted file mode 100644 index cddde146..00000000 --- a/app/__utils__/makeWithMockedProvider/index.js +++ /dev/null @@ -1,27 +0,0 @@ -import { buildClientSchema, addMockFunctionsToSchema } from 'graphql-tools' -import { mockNetworkInterfaceWithSchema } from 'apollo-test-utils' -import ApolloClient from 'apollo-client' -import { ApolloProvider } from 'react-apollo' - -import * as introspectionResult from '~/schema.json' -console.log(introspectionResult) - -export default function makeWithMockedProvider(mocks) { - const schema = buildClientSchema(introspectionResult) - - addMockFunctionsToSchema({ - schema, - mocks - }) - - const mockNetworkInterface = mockNetworkInterfaceWithSchema({ schema }) - - const client = new ApolloClient({ - networkInterface: mockNetworkInterface - }) - - return children => - - {children} - -} diff --git a/app/__utils__/themeSelector.js b/app/__utils__/themeSelector.js deleted file mode 100644 index 04e97529..00000000 --- a/app/__utils__/themeSelector.js +++ /dev/null @@ -1,6 +0,0 @@ -import { select } from '@storybook/addon-knobs' - -const themes = ['main', 'eightbit', 'inverted'] -const defaultTheme = themes[0] - -export default select('Theme', themes, defaultTheme) diff --git a/app/components/LinkList/index.js b/app/components/LinkList/index.js index 30cbb31a..43144634 100644 --- a/app/components/LinkList/index.js +++ b/app/components/LinkList/index.js @@ -1,39 +1,39 @@ import PropTypes from 'prop-types' import { Link } from '~/routes' -import * as S from './styles' +import { A, LogOutButton } from './styles' const LinkList = ({ pathname, authenticated, logout }) => LinkList.propTypes = { diff --git a/app/containers/CreatePost/feature.js b/app/containers/CreatePost/feature.js index 034a7ac8..dc9b8640 100644 --- a/app/containers/CreatePost/feature.js +++ b/app/containers/CreatePost/feature.js @@ -1,7 +1,7 @@ import React from 'react' import PropTypes from 'prop-types' import { Router } from '~/routes' -import * as S from './styles' +import { Form, SubmitButton } from './styles' export default class CreateForm extends React.Component { static propTypes = { @@ -37,10 +37,10 @@ export default class CreateForm extends React.Component { }; render = () => - +

Add new post

- Submit - ; + Submit +
; } diff --git a/app/containers/Header/feature.js b/app/containers/Header/feature.js index 4aea2512..05ea1ea3 100644 --- a/app/containers/Header/feature.js +++ b/app/containers/Header/feature.js @@ -1,17 +1,17 @@ import PropTypes from 'prop-types' import LinkList from '~/components/LinkList' import Logo from '~/components/Logo' -import * as S from './styles' +import { Header as StyledHeader } from './styles' const Header = ({ pathname, authenticated, actions: { logout } }) => - + - + Header.defaultProps = { authenticated: false diff --git a/app/containers/PostInfo/feature.js b/app/containers/PostInfo/feature.js index c569a693..fdb2e765 100644 --- a/app/containers/PostInfo/feature.js +++ b/app/containers/PostInfo/feature.js @@ -1,31 +1,30 @@ import moment from 'moment' import PropTypes from 'prop-types' -import * as S from './styles' +import { Section, A } from './styles' const PostInfo = ({ loading, Post, error }) => { - if (error) { - console.log(error) // eslint-disable-line no-console - return - } + let title if (loading) { - return ( - -

Loading...

-
- ) + title = 'Loading...' + } else if (error) { + title = error.toString() + } else if (!Post) { + title = 'No such post' } - if (!Post) { + if (title) { return ( - -

No such post

-
+
+

+ {title} +

+
) } return ( - +

{Post.title}

@@ -40,11 +39,11 @@ const PostInfo = ({ loading, Post, error }) => {

- + {Post.url} - +

- +
) } diff --git a/app/containers/PostList/feature.js b/app/containers/PostList/feature.js index fbca8231..dc51d9c8 100644 --- a/app/containers/PostList/feature.js +++ b/app/containers/PostList/feature.js @@ -1,7 +1,15 @@ import PropTypes from 'prop-types' import { Link } from '~/routes' import PostUpvoter from '~/containers/PostUpvoter' -import * as S from './styles' +import { + Main, + ItemList, + Index, + Title, + ShowMore, + Item, + Loading +} from './styles' const PostList = ({ data: { allPosts, loading, _allPostsMeta }, @@ -10,14 +18,14 @@ const PostList = ({ if (allPosts && allPosts.length) { const areMorePosts = allPosts.length < _allPostsMeta.count return ( - - +
+ {allPosts.map((post, index) => - +
- + {index + 1}.{' '} - + - + {post.title} - </S.Title> +
-
+ )} - +
{areMorePosts - ? loadMorePosts()}> + ? loadMorePosts()}> {loading ? 'Loading...' : 'Show More'} - + : ''} - +
) } - return Loading + return Loading } PostList.propTypes = {