Skip to content

Commit

Permalink
Post components upadted
Browse files Browse the repository at this point in the history
  • Loading branch information
Khumoyun Akhmedov committed Oct 26, 2020
1 parent 78079e9 commit a6a90f0
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 8 deletions.
5 changes: 4 additions & 1 deletion src/components/Loader.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import React from 'react'
import styled from '@emotion/styled'


/**
* Source:
* https://codepen.io/jenning/pen/MbmyBy
*/
const Dummy = styled.div`
*, *::before, *::after {
box-sizing: border-box;
Expand Down
30 changes: 25 additions & 5 deletions src/components/Post.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React, { useState } from 'react'
import { useRouter } from 'next/router'
import { Flex, Box, Heading } from '@chakra-ui/core'
import { Flex, Box, Heading, Avatar, Text } from '@chakra-ui/core'
import Downvote from '../icons/arrow-down.svg'
import Upvote from '../icons/arrow-up.svg'
import Dot from '../icons/dot.svg'
import styled from '@emotion/styled'
import PostFooter from './PostFooter'

Expand Down Expand Up @@ -46,12 +47,28 @@ const Rightbox = styled.div`
flex-direction: column;
`

const PostHeader = styled(FlexCore)`
height: 100%;
const PostHeader = styled.div`
display: flex;
align-items: center;
flex-direction: row;
height: 30px;
span.header-item {
margin-left: 4px;
&.community-link {
font-weight: bold;
font-size: 14px;
}
&.community-link:hover {
text-decoration: underline;
}
}
`
const PostContent = styled(FlexCore)`
height: 100%;
flex-direction: column;
margin: 10px 0;
`

export const Post = ({ data }: PostProps) => {
Expand Down Expand Up @@ -108,7 +125,10 @@ export const Post = ({ data }: PostProps) => {
borderBottomRightRadius={2}
>
<PostHeader className="post-header">

<span className="header-item avatar"><Avatar size="xs"></Avatar></span>
<span className="header-item community-link"><a href="">r/bbcnews</a></span>
<span className="header-item divider-dot"><Dot width={8} height={8} /></span>
<span className="header-item text"><Text fontSize={12} color="#ccc">Posted by u/zendesk 12 hours ago</Text></span>
</PostHeader>

<PostContent className="post-content" onClick={() => handlePostClick()}>
Expand Down
2 changes: 1 addition & 1 deletion src/components/PostFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const PostFooter = ({ data }: PostProps) => {
}

return (
<Flex direction="row" align="center" h="100%" mt={2}>
<Flex direction="row" align="center" mt={2}>
<PostButton onClick={(e) => command(e, 'give-award')}>
<GiveAward
style={{ fill: '#455A64' }}
Expand Down
4 changes: 4 additions & 0 deletions src/icons/dot.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/utils/cursorPagination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const cursorPagination = (): Resolver => {
})

return {
// __typename: 'PaginatedPosts', // very problematic
__typename: 'PaginatedPosts', // very problematic, comment this line and you can see the issue
hasMore,
posts: results
}
Expand Down

0 comments on commit a6a90f0

Please sign in to comment.