-
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.
done with full blog and publish page
- Loading branch information
1 parent
43e31c8
commit 39f2d0f
Showing
16 changed files
with
331 additions
and
30 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,28 @@ | ||
import { Avatar } from "./blogCard"; | ||
import { Link } from "react-router-dom"; | ||
import Logo from "../assets/logo.png"; | ||
|
||
export const Appbar = () => { | ||
return ( | ||
<div className="border-b flex justify-between px-10 py-4"> | ||
<Link | ||
to={"/blogs"} | ||
className="flex flex-col justify-center cursor-pointer" | ||
> | ||
<img className="w-20" src={Logo} alt="" /> | ||
</Link> | ||
<div> | ||
<Link to={`/publish`}> | ||
<button | ||
type="button" | ||
className="mr-4 text-white bg-red-500 hover:bg-green-500 focus:outline-none focus:ring-4 focus:ring-red-300 font-medium rounded-full text-sm px-5 py-2.5 text-center me-2 mb-2 " | ||
> | ||
New | ||
</button> | ||
</Link> | ||
|
||
<Avatar size={"big"} name="User" /> | ||
</div> | ||
</div> | ||
); | ||
}; |
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 |
---|---|---|
@@ -1,39 +1,72 @@ | ||
import { Link } from "react-router-dom"; | ||
|
||
interface blogCardProps { | ||
authorName: String; | ||
title: String; | ||
content: String; | ||
date: String; | ||
id: String; | ||
} | ||
|
||
export const BlogCard = ({ | ||
id, | ||
authorName, | ||
title, | ||
content, | ||
date, | ||
}: blogCardProps) => { | ||
return ( | ||
<div className="flex justify-center p-2"> | ||
<div className="w-1/2 border-black border-2"> | ||
<div className="flex p-2"> | ||
<div className="flex justify-centre flex-col px-2"> | ||
<Avatar name={authorName} /> | ||
<Link to={`/blog/${id}`}> | ||
<div className="flex justify-center p-2"> | ||
<div className="w-1/2 border border-2 max-h-60 overflow-hidden rounded-lg min-h-52"> | ||
<div className="flex p-2"> | ||
<div className="flex justify-centre flex-col pl-2"> | ||
<Avatar name={authorName} /> | ||
</div> | ||
<div className="px-2 capitalize">{authorName} </div> | ||
{date} | ||
</div> | ||
<div className="text-2xl font-serif font-medium px-4 capitalize "> | ||
{title} | ||
</div> | ||
<div className="px-4 border-b-2 border-black">{`Reading time : ${Math.ceil( | ||
content.length / 200 | ||
)} minutes`}</div> | ||
<div className="px-2"> | ||
{content.length > 100 ? ( | ||
<div | ||
dangerouslySetInnerHTML={{ __html: content.slice(0, 200) }} | ||
/> | ||
) : ( | ||
<div dangerouslySetInnerHTML={{ __html: content }} /> | ||
)} | ||
</div> | ||
<div className="px-2">{authorName} </div> | ||
{date} | ||
</div> | ||
<div className="text-3xl font-serif font-semibold ">{title}</div> | ||
<div>{content.length > 100 ? content.slice(0, 200) : content}...</div> | ||
<div>{`Reading time : ${Math.ceil(content.length / 200)} minutes`}</div> | ||
<div className="bg-slate-400 h-1 w-full"></div> | ||
</div> | ||
</div> | ||
</Link> | ||
); | ||
}; | ||
|
||
const Avatar = ({ name }: { name: String }) => { | ||
export function Avatar({ | ||
name, | ||
size = "small", | ||
}: { | ||
name: String; | ||
size?: "small" | "big"; | ||
}) { | ||
return ( | ||
<div className="relative inline-flex items-center justify-center w-5 h-5 overflow-hidden bg-gray-300 rounded-full"> | ||
<span className="font-extralight text-gray-600">{name[0]}</span> | ||
<div | ||
className={`relative inline-flex items-center justify-center overflow-hidden bg-red-500 rounded-full ${ | ||
size === "small" ? "w-6 h-6" : "w-10 h-10" | ||
}`} | ||
> | ||
<span | ||
className={`${ | ||
size === "small" ? "text-xs" : "text-md" | ||
} font-extralight text-white uppercase`} | ||
> | ||
{name[0]} | ||
</span> | ||
</div> | ||
); | ||
}; | ||
} |
Empty file.
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,42 @@ | ||
import { Blogs } from "../hooks/hooks"; | ||
import { Avatar } from "./blogCard"; | ||
|
||
export const FullBlog = ({ blog }: { blog: Blogs }) => { | ||
return ( | ||
<div> | ||
<div className="flex justify-center"> | ||
<div className="grid grid-cols-12 px-10 w-full pt-200 max-w-screen-xl pt-12"> | ||
<div className="col-span-8"> | ||
<div className="text-5xl font-extrabold capitalize underline font-serif"> | ||
{blog.title} | ||
</div> | ||
<div className="text-slate-500 pt-2"> | ||
Published on 2nd December 2023 | ||
</div> | ||
<div | ||
className="pt-4" | ||
dangerouslySetInnerHTML={{ __html: blog.content }} | ||
/> | ||
</div> | ||
<div className="col-span-4"> | ||
<div className="text-slate-600 text-xl underline py-2">Author</div> | ||
<div className="flex w-full"> | ||
<div className="pr-4 flex flex-col justify-center"> | ||
<Avatar size="big" name={blog.author.name} /> | ||
</div> | ||
<div> | ||
<div className="text-xl font-bold capitalize"> | ||
{blog.author.name || "Anonymous"} | ||
</div> | ||
<div className=" pt-1 text-slate-500"> | ||
Your first blog posts won’t be perfect, but you just have to | ||
do it. You have to start somewhere — Shane Barker | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; |
Empty file.
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
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
Empty file.
Oops, something went wrong.