styles: BlogsList change flex -> grid

This commit is contained in:
unknown 2021-09-08 19:07:27 +07:00
parent 24a706e972
commit a58d30d528
7 changed files with 43 additions and 43 deletions

View File

@ -1,6 +1,7 @@
import { Layout } from 'src/components/common';
import { BlogsList, FeaturedCardBlog, BlogHeading, BlogBreadCrumb } from 'src/components/modules/blogs'; import { BlogsList, FeaturedCardBlog, BlogHeading, BlogBreadCrumb } from 'src/components/modules/blogs';
const BlogsPage = () => { export default function BlogsPage() {
return( return(
<> <>
<BlogBreadCrumb /> <BlogBreadCrumb />
@ -10,4 +11,4 @@ const BlogsPage = () => {
</> </>
) )
} }
export default BlogsPage BlogsPage.Layout = Layout

View File

@ -3,7 +3,6 @@
.cardBlogWarpper { .cardBlogWarpper {
@apply inline-flex flex-col justify-start; @apply inline-flex flex-col justify-start;
max-width: 39.2rem; max-width: 39.2rem;
min-height: 34.4rem;
.image { .image {
width: 100%; width: 100%;
max-height: 22rem; max-height: 22rem;

View File

@ -1,4 +1,4 @@
.breadCrumbWrapper{ .breadCrumbWrapper {
@apply py-12; @apply py-12;
padding-left: 3.2rem; padding-left: 3.2rem;
} }

View File

@ -1,6 +1,6 @@
@import "../../../../styles/utilities"; @import "../../../../styles/utilities";
.headingWrapper{ .headingWrapper {
@apply flex spacing-horizontal-left pb-16 justify-center; @apply flex spacing-horizontal-left pb-16 justify-center;
.heading{ .heading{
max-width: 121.6rem; max-width: 121.6rem;

View File

@ -1,17 +1,17 @@
@import "../../../../styles/utilities"; @import "../../../../styles/utilities";
.wrapper{ .wrapper {
@apply flex flex-col spacing-horizontal items-center; @apply flex flex-col spacing-horizontal items-center;
padding-bottom: 16.8rem; padding-bottom: 16.8rem;
.list{ .list {
@apply flex flex-wrap justify-between; @apply grid grid-cols-3;
max-width: 121.6rem; max-width: 121.6rem;
} }
.card{ .card {
padding-bottom: 4rem; @apply pr-8 pb-16;
} }
.pagination{ .pagination {
padding-top: 0.8rem;
@apply flex justify-center items-center ; @apply flex justify-center items-center ;
padding-top: 0.8rem;
} }
} }

View File

@ -1,7 +1,6 @@
import React, { useState } from 'react' import React, { useState } from 'react'
import CardBlog, { BlogCardProps } from 'src/components/common/CardBlog/CardBlog' import CardBlog, { BlogCardProps } from 'src/components/common/CardBlog/CardBlog'
import PaginationCommon from 'src/components/common/PaginationCommon/PaginationCommon' import PaginationCommon from 'src/components/common/PaginationCommon/PaginationCommon'
import { ROUTE } from 'src/utils/constanst.utils'
import s from "./BlogsList.module.scss" import s from "./BlogsList.module.scss"
import image15 from '../../../../../public/assets/images/image15.png' import image15 from '../../../../../public/assets/images/image15.png'
import image16 from '../../../../../public/assets/images/image16.png' import image16 from '../../../../../public/assets/images/image16.png'
@ -19,114 +18,115 @@ const BLOGSLIST_DATA = [
imageSrc: image15.src, imageSrc: image15.src,
title: "1", title: "1",
description: "The DEBM diet stands for "+"Delicious Happy Fun Diet"+". This diet was popularized by Robert...", description: "The DEBM diet stands for "+"Delicious Happy Fun Diet"+". This diet was popularized by Robert...",
link: `${ROUTE.BLOG_DETAIL}`, slug: "happy-diet"
}, },
{ {
imageSrc: image16.src, imageSrc: image16.src,
title: "2", title: "2",
description: "Aloe vera or aloe vera is a green plant, has thorns on the side of the skin with yellowish patches and...", description: "Aloe vera or aloe vera is a green plant, has thorns on the side of the skin with yellowish patches and...",
link: `${ROUTE.BLOG_DETAIL}`, slug: "happy-diet"
}, },
{ {
imageSrc: image17.src, imageSrc: image17.src,
title: "3", title: "3",
description: "Dragon fruit is a type of fruit that is a favorite for many people because of its delicious and fresh...", description: "Dragon fruit is a type of fruit that is a favorite for many people because of its delicious and fresh...",
link: `${ROUTE.BLOG_DETAIL}`, slug: "happy-diet"
}, },
{ {
imageSrc: image21.src, imageSrc: image21.src,
title: "4", title: "4",
description: "The DEBM diet stands for "+"Delicious Happy Fun Diet"+". This diet was popularized by Robert...", description: "The DEBM diet stands for "+"Delicious Happy Fun Diet"+". This diet was popularized by Robert...",
link: `${ROUTE.BLOG_DETAIL}`, slug: "happy-diet"
}, },
{ {
imageSrc: image22.src, imageSrc: image22.src,
title: "5", title: "5",
description: "Aloe vera or aloe vera is a green plant, has thorns on the side of the skin with yellowish patches and...", description: "Aloe vera or aloe vera is a green plant, has thorns on the side of the skin with yellowish patches and...",
link: `${ROUTE.BLOG_DETAIL}`, slug: "happy-diet"
}, },
{ {
imageSrc: image23.src, imageSrc: image23.src,
title: "6", title: "6",
description: "Dragon fruit is a type of fruit that is a favorite for many people because of its delicious and fresh...", description: "Dragon fruit is a type of fruit that is a favorite for many people because of its delicious and fresh...",
link: `${ROUTE.BLOG_DETAIL}`, slug: "happy-diet"
}, },
{ {
imageSrc: image15.src, imageSrc: image15.src,
title: "7", title: "7",
description: "The DEBM diet stands for "+"Delicious Happy Fun Diet"+". This diet was popularized by Robert...", description: "The DEBM diet stands for "+"Delicious Happy Fun Diet"+". This diet was popularized by Robert...",
link: `${ROUTE.BLOG_DETAIL}`, slug: "happy-diet"
}, },
{ {
imageSrc: image16.src, imageSrc: image16.src,
title: "8", title: "8",
description: "Aloe vera or aloe vera is a green plant, has thorns on the side of the skin with yellowish patches and...", description: "Aloe vera or aloe vera is a green plant, has thorns on the side of the skin with yellowish patches and...",
link: `${ROUTE.BLOG_DETAIL}`, slug: "happy-diet"
}, },
{ {
imageSrc: image17.src, imageSrc: image17.src,
title: "9", title: "9",
description: "Dragon fruit is a type of fruit that is a favorite for many people because of its delicious and fresh...", description: "Dragon fruit is a type of fruit that is a favorite for many people because of its delicious and fresh...",
link: `${ROUTE.BLOG_DETAIL}`, slug: "happy-diet"
}, },
{ {
imageSrc: image23.src, imageSrc: image23.src,
title: "10", title: "10",
description: "Dragon fruit is a type of fruit that is a favorite for many people because of its delicious and fresh...", description: "Dragon fruit is a type of fruit that is a favorite for many people because of its delicious and fresh...",
link: `${ROUTE.BLOG_DETAIL}`, slug: "happy-diet"
}, },
{ {
imageSrc: image21.src, imageSrc: image21.src,
title: "11", title: "11",
description: "The DEBM diet stands for "+"Delicious Happy Fun Diet"+". This diet was popularized by Robert...", description: "The DEBM diet stands for "+"Delicious Happy Fun Diet"+". This diet was popularized by Robert...",
link: `${ROUTE.BLOG_DETAIL}`, slug: "happy-diet"
}, },
{ {
imageSrc: image22.src, imageSrc: image22.src,
title: "12", title: "12",
description: "Aloe vera or aloe vera is a green plant, has thorns on the side of the skin with yellowish patches and...", description: "Aloe vera or aloe vera is a green plant, has thorns on the side of the skin with yellowish patches and...",
link: `${ROUTE.BLOG_DETAIL}`, slug: "happy-diet"
}, },
{ {
imageSrc: image15.src, imageSrc: image15.src,
title: "13", title: "13",
description: "The DEBM diet stands for "+"Delicious Happy Fun Diet"+". This diet was popularized by Robert...", description: "The DEBM diet stands for "+"Delicious Happy Fun Diet"+". This diet was popularized by Robert...",
link: `${ROUTE.BLOG_DETAIL}`, slug: "happy-diet"
}, },
{ {
imageSrc: image16.src, imageSrc: image16.src,
title: "14", title: "14",
description: "Aloe vera or aloe vera is a green plant, has thorns on the side of the skin with yellowish patches and...", description: "Aloe vera or aloe vera is a green plant, has thorns on the side of the skin with yellowish patches and...",
link: `${ROUTE.BLOG_DETAIL}`, slug: "happy-diet"
}, },
{ {
imageSrc: image17.src, imageSrc: image17.src,
title: "15", title: "15",
description: "Dragon fruit is a type of fruit that is a favorite for many people because of its delicious and fresh...", description: "Dragon fruit is a type of fruit that is a favorite for many people because of its delicious and fresh...",
link: `${ROUTE.BLOG_DETAIL}`, slug: "happy-diet"
}, },
{ {
imageSrc: image21.src, imageSrc: image21.src,
title: "16", title: "16",
description: "The DEBM diet stands for "+"Delicious Happy Fun Diet"+". This diet was popularized by Robert...", description: "The DEBM diet stands for "+"Delicious Happy Fun Diet"+". This diet was popularized by Robert...",
link: `${ROUTE.BLOG_DETAIL}`, slug: "happy-diet"
}, },
{ {
imageSrc: image23.src, imageSrc: image23.src,
title: "17", title: "17",
description: "Dragon fruit is a type of fruit that is a favorite for many people because of its delicious and fresh...", description: "Dragon fruit is a type of fruit that is a favorite for many people because of its delicious and fresh...",
link: `${ROUTE.BLOG_DETAIL}`, slug: "happy-diet"
}, },
{ {
imageSrc: image22.src, imageSrc: image22.src,
title: "18", title: "18",
description: "Aloe vera or aloe vera is a green plant, has thorns on the side of the skin with yellowish patches and...", description: "Aloe vera or aloe vera is a green plant, has thorns on the side of the skin with yellowish patches and...",
link: `${ROUTE.BLOG_DETAIL}`, slug: "happy-diet"
}, },
] ]
const BlogsList = ({ data = BLOGSLIST_DATA }:BlogsListProps) => { const BlogsList = ({ data = BLOGSLIST_DATA }:BlogsListProps) => {
const defaultBlogPageSize: number = 6;
const [currentPage, setCurrentPage] = useState(0) const [currentPage, setCurrentPage] = useState(0)
const onPageChange = (page:number) => { const onPageChange = (page:number) => {
setCurrentPage(page) setCurrentPage(page)
@ -136,7 +136,7 @@ const BlogsList = ({ data = BLOGSLIST_DATA }:BlogsListProps) => {
<div className={s.wrapper}> <div className={s.wrapper}>
<div className={s.list}> <div className={s.list}>
{ {
data.slice(currentPage*6,(currentPage+1)*6).map((product,index)=>{ data.slice(currentPage*defaultBlogPageSize,(currentPage+1)*defaultBlogPageSize).map((product,index)=>{
return( return(
<div className={s.card}> <div className={s.card}>
<CardBlog {...product} key={index}/> <CardBlog {...product} key={index}/>
@ -146,7 +146,7 @@ const BlogsList = ({ data = BLOGSLIST_DATA }:BlogsListProps) => {
} }
</div> </div>
<div className={s.pagination}> <div className={s.pagination}>
<PaginationCommon total={data.length} pageSize={6} onChange={onPageChange}/> <PaginationCommon total={data.length} pageSize={defaultBlogPageSize} onChange={onPageChange}/>
</div> </div>
</div> </div>
</section> </section>

View File

@ -1,37 +1,37 @@
@import "../../../../styles/utilities"; @import "../../../../styles/utilities";
.featuredCard{ .featuredCard {
@apply flex flex-row justify-center spacing-horizontal pb-16; @apply flex flex-row justify-center spacing-horizontal pb-16;
.featuredCardWrapper{ .featuredCardWrapper {
@apply flex flex-col; @apply flex flex-col;
@screen lg{ @screen lg {
@apply flex-row justify-between; @apply flex-row justify-between;
} }
max-width: 121.6rem; max-width: 121.6rem;
} }
} }
.left{ .left {
max-width: 59.8rem; max-width: 59.8rem;
img{ img {
border-radius: 2.4rem; border-radius: 2.4rem;
} }
} }
.right{ .right {
flex-shrink: 3; flex-shrink: 3;
max-width: 55.4rem; max-width: 55.4rem;
@screen lg{ @screen lg {
margin-left: 6.4rem; margin-left: 6.4rem;
} }
} }
.titleWrapper{ .titleWrapper {
@apply flex flex-col items-start font-heading; @apply flex flex-col items-start font-heading;
font-size: 3.2rem; font-size: 3.2rem;
line-height: 4rem; line-height: 4rem;
margin-bottom: 1.6rem; margin-bottom: 1.6rem;
.title{ .title {
margin-top: 0.4rem; margin-top: 0.4rem;
} }
} }
.content{ .content {
margin-top: 1.6rem margin-top: 1.6rem
} }