parent
de3b96cbb9
commit
d083715028
8 changed files with 97 additions and 105 deletions
After Width: | Height: | Size: 120 KiB |
After Width: | Height: | Size: 1.3 KiB |
@ -1,112 +1,103 @@ |
||||
import React from "react"; |
||||
|
||||
import "./BlogDesign2.scss"; |
||||
|
||||
import blogFeaturedImage2 from "../assets/blog-featured-image2.jpg"; |
||||
import blogAuthorImg from "../assets/blog-author.png"; |
||||
import whiteCommentIcon from "../assets/white-comment-icon.svg"; |
||||
import Button from "../../Button"; |
||||
import CommentIcon from "../../MiniComponents/CommentIcon"; |
||||
import NewTagDesign from "../../NewTagDesign"; |
||||
|
||||
const BlogDesign2 = ({ |
||||
blogTitle, |
||||
blogSubTitle, |
||||
featuredImage, |
||||
dateButton, |
||||
tagButton, |
||||
blogAuthor, |
||||
blogAuthorImg, |
||||
blogComments, |
||||
commentNumBgColor, |
||||
commentNumTextColor, |
||||
commentNumTopPosition, |
||||
commentNumRightPosition, |
||||
}) => { |
||||
return ( |
||||
<section className="w-4/12 mx-auto p-4 bg-white rounded-md shadow-md my-8"> |
||||
<div |
||||
className="parent relative flex flex-col justify-end p-3 cursor-pointer" |
||||
style={{ |
||||
backgroundImage: `url(${blogFeaturedImage2})`, |
||||
backgroundSize: "100% 100%", |
||||
backgroundRepeat: "no-repeat", |
||||
// minHeight: "300px",
|
||||
height: "calc(100vh/3)", |
||||
maxHeight: "300px", |
||||
}} |
||||
> |
||||
{dateButton && ( |
||||
<button className="bg-yellow-100 rounded p-1 text-sm absolute left-2 top-4"> |
||||
1400/09/19 |
||||
</button> |
||||
)} |
||||
{tagButton && ( |
||||
<button className="bg-yellow-100 rounded p-1 text-sm absolute left-2 top-4"> |
||||
تگ |
||||
</button> |
||||
<div |
||||
className="group min-w-[550px] relative flex flex-col justify-end p-4 cursor-pointer" |
||||
// style={{
|
||||
// backgroundImage: `url(${featuredImage})`,
|
||||
// backgroundSize: "100% 100%",
|
||||
// backgroundRepeat: "no-repeat",
|
||||
// // minHeight: "300px",
|
||||
// height: "calc(100vh/3)",
|
||||
// maxHeight: "300px",
|
||||
// }}
|
||||
> |
||||
{dateButton && ( |
||||
<Button |
||||
text={"1400/09/19"} |
||||
className={ |
||||
"w-fit bg-yellow-100 p-2 rounded text-xs font-sansbold absolute left-2 top-4" |
||||
} |
||||
/> |
||||
)} |
||||
{tagButton && ( |
||||
<NewTagDesign |
||||
title={"تگ"} |
||||
icon={false} |
||||
tagClassName={ |
||||
"w-fit bg-yellow-100 p-2 rounded text-xs font-sansbold absolute left-2 top-4" |
||||
} |
||||
/> |
||||
)} |
||||
<div className="z-10 transition-all duration-300 transfrom group-hover:-translate-y-1"> |
||||
{blogTitle && ( |
||||
<h2 className="text-base text-justify text-white font-sansbold leading-6"> |
||||
{blogTitle} |
||||
</h2> |
||||
)} |
||||
<div className="z-10 child-text"> |
||||
<h2 className="text-white text-base font-bold leading-6"> |
||||
آیا مواد غذایی پر فیبر مفید هستند؟ |
||||
{blogSubTitle && ( |
||||
<h2 className="text-white text-base mt-2 font-sansbold leading-6"> |
||||
شما چه فکری می کنید |
||||
</h2> |
||||
{blogSubTitle && ( |
||||
<h2 className="text-white text-base mt-2 font-bold leading-6"> |
||||
شما چه فکری می کنید |
||||
</h2> |
||||
)} |
||||
</div> |
||||
<div className="z-10 flex item-center justify-between w-full mt-4"> |
||||
{blogAuthor && ( |
||||
<div className="flex items-center transition duration-200 transform hover:-translate-y-1"> |
||||
<img src={blogAuthorImg} alt="" className="w-8 h-8" /> |
||||
<p className="text-sm text-white font-light mr-2"> |
||||
حامد دژبانی نسب |
||||
</p> |
||||
</div> |
||||
)} |
||||
{blogComments && ( |
||||
<div className="flex items-center"> |
||||
<p className="text-sm text-white font-light ml-2"> |
||||
زمان مطالعه 30 دقیقه |
||||
</p> |
||||
<div className="relative"> |
||||
<img src={whiteCommentIcon} alt="" className="w-7 h-7" /> |
||||
<span |
||||
className={`comment-num absolute ${commentNumBgColor} ${commentNumTextColor} ${commentNumTopPosition} ${commentNumRightPosition}`} |
||||
> |
||||
26 |
||||
</span> |
||||
</div> |
||||
</div> |
||||
)} |
||||
</div> |
||||
<div |
||||
style={{ |
||||
zIndex: 0, |
||||
background: |
||||
"linear-gradient(0deg, rgba(0,0,0,1) 0%, rgba(2,0,36,0) 100%)", |
||||
}} |
||||
className="absolute right-0 bottom-0 h-full w-full" |
||||
></div> |
||||
)} |
||||
</div> |
||||
</section> |
||||
<div className="w-full flex item-center justify-between mt-4 z-10"> |
||||
{blogAuthor && ( |
||||
<div className="flex items-center transition duration-200 transform hover:-translate-y-1"> |
||||
<img src={blogAuthorImg} alt="author" className="w-8" /> |
||||
<p className="mr-2 text-sm text-white">{blogAuthor}</p> |
||||
</div> |
||||
)} |
||||
{blogComments && ( |
||||
<div className="flex items-center"> |
||||
<p className="ml-2 text-sm text-white">{blogComments}</p> |
||||
<CommentIcon |
||||
commentClassName="w-7" |
||||
icon={"images/white-comment-icon.svg"} |
||||
commentNum={"26"} |
||||
className="w-5 h-5 bg-white text-[#818181] text-[10px] border-[#818181] font-sansbold absolute top-0 right-0 transform translate-x-1 -translate-y-2" |
||||
/> |
||||
</div> |
||||
)} |
||||
</div> |
||||
<div |
||||
style={{ |
||||
zIndex: 0, |
||||
background: |
||||
"linear-gradient(0deg, rgba(0,0,0,1) 0%, rgba(2,0,36,0) 100%)", |
||||
}} |
||||
className="absolute right-0 bottom-0 h-full w-full" |
||||
></div> |
||||
</div> |
||||
); |
||||
}; |
||||
|
||||
export default BlogDesign2; |
||||
|
||||
// background color i used in commnet number background color
|
||||
// bg-lightGrayBgColor
|
||||
// bg-white
|
||||
BlogDesign2.defaultProps = { |
||||
blogTitle: `آیا مواد غذای پر فیبر و مفید هستند؟`, |
||||
blogSubTitle: `شما چه فکری می کنید`, |
||||
|
||||
// text color i used for comment number text color:
|
||||
// text-grayTextColor
|
||||
// text-white
|
||||
featuredImage: "images/blog-featured-image2.jpg", |
||||
|
||||
blogAuthor: `حامد دژبانی نسب`, |
||||
blogAuthorImg: "images/blog-author.png", |
||||
|
||||
blogComments: `زمان مطالعه 30 دقیقه`, |
||||
|
||||
BlogDesign2.defaultProps = { |
||||
blogSubTitle: true, |
||||
dateButton: true, |
||||
tagButton: false, |
||||
blogAuthor: true, |
||||
blogComments: true, |
||||
|
||||
commentNumBgColor: "bg-white", |
||||
commentNumTextColor: "text-grayTextColor", |
||||
commentNumTopPosition: "-top-2", |
||||
commentNumRightPosition: "-right-2", |
||||
}; |
||||
|
Loading…
Reference in new issue