Skip to content

Commit

Permalink
create feed button
Browse files Browse the repository at this point in the history
  • Loading branch information
william-herring committed Apr 29, 2022
1 parent de70d73 commit 0ab2461
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions components/Post.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import React from "react"

interface PostProps {
title: string
Expand All @@ -14,4 +14,4 @@ const Post: React.FC<PostProps> = (props) => {
)
}

export default Post
export default Post
12 changes: 12 additions & 0 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Head from 'next/head'
import Header from '../components/Header'
import { Feed } from '@prisma/client'
import FeedCard from '../components/FeedCard'
import { useSession } from 'next-auth/react'

interface HomeFeedProps extends Feed {
author: {
Expand Down Expand Up @@ -41,6 +42,8 @@ export const getStaticProps: GetStaticProps = async () => {
}

const Home: NextPage<{ feeds: HomeFeedProps[] }> = (props) => {
const { data: session } = useSession()

return (
<div>
<Head>
Expand All @@ -59,6 +62,15 @@ const Home: NextPage<{ feeds: HomeFeedProps[] }> = (props) => {
author={obj.author.username} live={obj.live} />
})}
</div>

{session? <div className='flex justify-end fixed bottom-0 w-screen p-6'>
<button className='bg-red-500 p-3 rounded-full hover:bg-opacity-90' onClick={() => console.log('Create feed')}>
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M19 10H17V7H14V5H17V2H19V5H22V7H19V10Z" fill="#ffff"></path>
<path d="M21 12H19V15H8.334C7.90107 14.9988 7.47964 15.1393 7.134 15.4L5 17V5H12V3H5C3.89543 3 3 3.89543 3 5V21L7.8 17.4C8.14582 17.1396 8.56713 16.9992 9 17H19C20.1046 17 21 16.1046 21 15V12Z" fill="#ffff"></path>
</svg>
</button>
</div> : null}
</div>
)
}
Expand Down

0 comments on commit 0ab2461

Please sign in to comment.