mirror of
https://github.com/vercel/commerce.git
synced 2025-07-22 20:26:49 +00:00
feat: BlogsList
This commit is contained in:
@@ -17,9 +17,9 @@ const Layout: FC<Props> = ({ children }) => {
|
||||
return (
|
||||
<CommerceProvider locale={locale}>
|
||||
<div className={s.mainLayout}>
|
||||
{/* <Header /> */}
|
||||
<Header />
|
||||
<main >{children}</main>
|
||||
{/* <Footer /> */}
|
||||
<Footer />
|
||||
</div>
|
||||
</CommerceProvider>
|
||||
|
||||
|
15
src/components/modules/blogs/BlogsList/BlogsList.module.scss
Normal file
15
src/components/modules/blogs/BlogsList/BlogsList.module.scss
Normal file
@@ -0,0 +1,15 @@
|
||||
@import "../../../../styles/utilities";
|
||||
|
||||
.wrapper{
|
||||
@apply flex flex-col spacing-horizontal;
|
||||
.list{
|
||||
@apply flex flex-wrap flex justify-around;
|
||||
}
|
||||
.card{
|
||||
padding-bottom: 4rem;
|
||||
}
|
||||
.pagination{
|
||||
padding-top: 0.8rem;
|
||||
@apply flex justify-center items-center ;
|
||||
}
|
||||
}
|
37
src/components/modules/blogs/BlogsList/BlogsList.tsx
Normal file
37
src/components/modules/blogs/BlogsList/BlogsList.tsx
Normal file
@@ -0,0 +1,37 @@
|
||||
import React, { useState } from 'react'
|
||||
import CardBlog, { BlogCardProps } from 'src/components/common/CardBlog/CardBlog'
|
||||
import PaginationCommon from 'src/components/common/PaginationCommon/PaginationCommon'
|
||||
import s from "./BlogsList.module.scss"
|
||||
|
||||
interface BlogsListProps {
|
||||
data: BlogCardProps[],
|
||||
}
|
||||
|
||||
const BlogsList = ({ data }:BlogsListProps) => {
|
||||
const [currentPage, setCurrentPage] = useState(0)
|
||||
const onPageChange = (page:number) => {
|
||||
setCurrentPage(page)
|
||||
}
|
||||
return (
|
||||
<section>
|
||||
<div className={s.wrapper}>
|
||||
<div className={s.list}>
|
||||
{
|
||||
data.slice(currentPage*6,(currentPage+1)*6).map((product,index)=>{
|
||||
return(
|
||||
<div className={s.card}>
|
||||
<CardBlog {...product} key={index}/>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
}
|
||||
</div>
|
||||
<div className={s.pagination}>
|
||||
<PaginationCommon total={data.length} pageSize={6} onChange={onPageChange}/>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
export default BlogsList
|
@@ -1 +1,2 @@
|
||||
export { default as FeaturedCardBlog } from './FeaturedCardBlog/FeaturedCardBlog'
|
||||
export { default as FeaturedCardBlog } from './FeaturedCardBlog/FeaturedCardBlog'
|
||||
export { default as BlogsList } from './BlogsList/BlogsList'
|
Reference in New Issue
Block a user