-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Khumoyun Akhmedov
committed
Oct 19, 2020
1 parent
d68d808
commit 8bb0ad9
Showing
32 changed files
with
624 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
import React, { useState } from 'react' | ||
import { Flex, Box, Heading } from '@chakra-ui/core' | ||
import Downvote from '../icons/arrow-down.svg' | ||
import Upvote from '../icons/arrow-up.svg' | ||
|
||
import GiveAward from '../icons/give-award.svg' | ||
import PostSave from '../icons/post-save.svg' | ||
import PostUnsave from '../icons/post-unsave.svg' | ||
import Share from '../icons/arrow-share.svg' | ||
import Comments from '../icons/comments.svg' | ||
|
||
import styled from '@emotion/styled' | ||
import { useRouter } from 'next/router' | ||
|
||
interface PostProps { | ||
data: PostData; | ||
} | ||
|
||
export interface PostData { | ||
id: string; | ||
title: string; | ||
textSnippet: string; | ||
points: number; | ||
} | ||
|
||
const FlexCore = styled.div` | ||
display: flex; | ||
flex-direction: row; | ||
` | ||
|
||
const PostFooter = styled(FlexCore)` | ||
height: 100%; | ||
align-items: center; | ||
` | ||
|
||
const PostButton = styled.div` | ||
display: inline-flex; | ||
padding: 2px 4px; | ||
flex-direction: row; | ||
font-size: 10px; | ||
border-radius: 3px; | ||
transition: background-color 0.2s ease-in; | ||
margin-left: 2px; | ||
span { | ||
display: inline-block; | ||
margin-left: 2px; | ||
} | ||
&:hover { | ||
background-color: #e1e2e4; | ||
} | ||
` | ||
|
||
export const PostFooter = ({ data }: PostProps) => { | ||
const [vote, setVote] = useState(data.points) | ||
const router = useRouter() | ||
|
||
const command = (e: React.SyntheticEvent, cmd: string) => { | ||
console.log('command', cmd) | ||
} | ||
|
||
return ( | ||
<PostFooter className="post-footer"> | ||
<PostButton> | ||
<GiveAward | ||
onClick={(e) => command(e, 'share')} | ||
style={{ fill: '#455A64' }} | ||
width={16} | ||
height={16} | ||
/> | ||
<span>123</span> | ||
<span>Comments</span> | ||
</PostButton> | ||
|
||
<PostButton> | ||
<Comments | ||
onClick={(e) => command(e, 'share')} | ||
style={{ fill: '#455A64' }} | ||
width={16} | ||
height={16} | ||
/> | ||
<span>Give Award</span> | ||
</PostButton> | ||
|
||
<PostButton> | ||
<Share | ||
onClick={(e) => command(e, 'share')} | ||
style={{ fill: '#455A64' }} | ||
width={16} | ||
height={16} | ||
/> | ||
<span>Share</span> | ||
</PostButton> | ||
|
||
<PostButton> | ||
<PostSave | ||
onClick={(e) => command(e, 'share')} | ||
style={{ fill: '#455A64' }} | ||
width={16} | ||
height={16} | ||
/> | ||
<span>Save</span> | ||
</PostButton> | ||
|
||
</PostFooter> | ||
) | ||
} |
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.