Skip to content

Commit

Permalink
fixes for merge
Browse files Browse the repository at this point in the history
  • Loading branch information
angelinatarapko committed Aug 20, 2017
1 parent fc13792 commit b79a52f
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 81 deletions.
27 changes: 0 additions & 27 deletions app/__utils__/makeWithMockedProvider/index.js

This file was deleted.

6 changes: 0 additions & 6 deletions app/__utils__/themeSelector.js

This file was deleted.

18 changes: 9 additions & 9 deletions app/components/LinkList/index.js
Original file line number Diff line number Diff line change
@@ -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 }) =>
<nav>
<Link prefetch href="/" passHref>
<S.A active={pathname === '/'}>Main Page</S.A>
<A active={pathname === '/'}>Main Page</A>
</Link>
<Link prefetch route="create" passHref>
<S.A active={pathname === '/create_post'}>Create</S.A>
<A active={pathname === '/create_post'}>Create</A>
</Link>
{!authenticated &&
<Link prefetch route="signin" passHref>
<S.A active={pathname === '/sign_in'}>SignIn</S.A>
<A active={pathname === '/sign_in'}>SignIn</A>
</Link>}
{!authenticated &&
<Link prefetch route="signup" passHref>
<S.A active={pathname === '/sign_up'}>SignUp</S.A>
<A active={pathname === '/sign_up'}>SignUp</A>
</Link>}
{authenticated &&
<S.LogOutButton
<LogOutButton
role="link"
href="#"
onClick={() => logout()}
active={pathname === '/sign_up'}
>
LogOut
</S.LogOutButton>}
<S.A
</LogOutButton>}
<A
href="https://github.com/Sly777/ran"
rel="noopener noreferrer"
target="_blank"
>
RAN! @ Github
</S.A>
</A>
</nav>

LinkList.propTypes = {
Expand Down
8 changes: 4 additions & 4 deletions app/containers/CreatePost/feature.js
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down Expand Up @@ -37,10 +37,10 @@ export default class CreateForm extends React.Component {
};

render = () =>
<S.Form onSubmit={this.handleSubmit}>
<Form onSubmit={this.handleSubmit}>
<h1>Add new post</h1>
<input placeholder="title" name="title" />
<input placeholder="url" name="url" />
<S.SubmitButton type="submit">Submit</S.SubmitButton>
</S.Form>;
<SubmitButton type="submit">Submit</SubmitButton>
</Form>;
}
6 changes: 3 additions & 3 deletions app/containers/Header/feature.js
Original file line number Diff line number Diff line change
@@ -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 } }) =>
<S.Header>
<StyledHeader>
<LinkList
pathname={pathname}
authenticated={authenticated}
logout={logout}
/>
<Logo />
</S.Header>
</StyledHeader>

Header.defaultProps = {
authenticated: false
Expand Down
35 changes: 17 additions & 18 deletions app/containers/PostInfo/feature.js
Original file line number Diff line number Diff line change
@@ -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 (
<S.Section>
<h1>Loading...</h1>
</S.Section>
)
title = 'Loading...'
} else if (error) {
title = error.toString()
} else if (!Post) {
title = 'No such post'
}

if (!Post) {
if (title) {
return (
<S.Section>
<h1>No such post</h1>
</S.Section>
<Section>
<h1>
{title}
</h1>
</Section>
)
}

return (
<S.Section>
<Section>
<h1>
{Post.title}
</h1>
Expand All @@ -40,11 +39,11 @@ const PostInfo = ({ loading, Post, error }) => {
</span>
</div>
<p>
<S.A target="_blank" href={Post.url} rel="noopener noreferrer nofollow">
<A target="_blank" href={Post.url} rel="noopener noreferrer nofollow">
{Post.url}
</S.A>
</A>
</p>
</S.Section>
</Section>
)
}

Expand Down
36 changes: 22 additions & 14 deletions app/containers/PostList/feature.js
Original file line number Diff line number Diff line change
@@ -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 },
Expand All @@ -10,14 +18,14 @@ const PostList = ({
if (allPosts && allPosts.length) {
const areMorePosts = allPosts.length < _allPostsMeta.count
return (
<S.Main>
<S.ItemList>
<Main>
<ItemList>
{allPosts.map((post, index) =>
<S.Item key={post.id}>
<Item key={post.id}>
<div>
<S.Index>
<Index>
{index + 1}.{' '}
</S.Index>
</Index>
<Link
route="details"
params={{
Expand All @@ -26,24 +34,24 @@ const PostList = ({
}}
passHref
>
<S.Title>
<Title>
{post.title}
</S.Title>
</Title>
</Link>
<PostUpvoter id={post.id} votes={post.votes} />
</div>
</S.Item>
</Item>
)}
</S.ItemList>
</ItemList>
{areMorePosts
? <S.ShowMore onClick={() => loadMorePosts()}>
? <ShowMore onClick={() => loadMorePosts()}>
{loading ? 'Loading...' : 'Show More'}
</S.ShowMore>
</ShowMore>
: ''}
</S.Main>
</Main>
)
}
return <S.Loading>Loading</S.Loading>
return <Loading>Loading</Loading>
}

PostList.propTypes = {
Expand Down

0 comments on commit b79a52f

Please sign in to comment.