mirror of
https://github.com/vercel/commerce.git
synced 2025-07-22 20:26:49 +00:00
feat: HomeCategories
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
@import '../../../styles/utilities';
|
||||
|
||||
.headingCommon {
|
||||
@apply font-heading uppercase text-left spacing-horizontal-left;
|
||||
font-size: 3.2rem;
|
||||
line-height: 4rem;
|
||||
|
||||
&.highlight {
|
||||
color: var(--negative);
|
||||
}
|
||||
&.light {
|
||||
color: var(--disabled);
|
||||
}
|
||||
&.center {
|
||||
@apply text-center;
|
||||
}
|
||||
|
||||
@screen md {
|
||||
@apply spacing-horizontal;
|
||||
font-size: 4.8rem;
|
||||
line-height: 5.6rem;
|
||||
}
|
||||
}
|
23
src/components/common/HeadingCommon/HeadingCommon.tsx
Normal file
23
src/components/common/HeadingCommon/HeadingCommon.tsx
Normal file
@@ -0,0 +1,23 @@
|
||||
import React from 'react'
|
||||
import classNames from 'classnames'
|
||||
import s from './HeadingCommon.module.scss'
|
||||
|
||||
interface HeadingCommonProps {
|
||||
type?: 'highlight' | 'light' | 'default';
|
||||
align?: 'center' | 'left';
|
||||
children: string;
|
||||
}
|
||||
|
||||
const HeadingCommon = ({ type='default', align='left', children }: HeadingCommonProps) => {
|
||||
|
||||
return (
|
||||
<div className={classNames(s.headingCommon, {
|
||||
[s[type]]: type,
|
||||
[s[align]]: align
|
||||
})}
|
||||
>{children}</div>
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
export default HeadingCommon
|
@@ -0,0 +1,80 @@
|
||||
@import '../../../../../styles/_utilities';
|
||||
|
||||
.categoryItem{
|
||||
|
||||
@screen md{
|
||||
font-size:1.6rem;
|
||||
}
|
||||
.categoryItemImage{
|
||||
width: 10.6rem;
|
||||
margin: 0 auto;
|
||||
max-height: 14rem;
|
||||
object-fit: cover;
|
||||
cursor: pointer;
|
||||
@screen md{
|
||||
width: 100%;
|
||||
}
|
||||
img{
|
||||
width:100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
.categoryItemText{
|
||||
|
||||
font-size: 1.6rem;
|
||||
line-height: 2.4rem;
|
||||
text-align: center;
|
||||
color: #000000;
|
||||
font-feature-settings: 'salt' on;
|
||||
cursor: pointer;
|
||||
@screen md{
|
||||
font-family: var(--font-sans);
|
||||
font-size:2.4rem;
|
||||
line-height: 3.2rem;
|
||||
}
|
||||
}
|
||||
// @screen md {
|
||||
// width:33%;
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
// @import '../../../../styles/utilities';
|
||||
// .homeFeature {
|
||||
// @apply spacing-horizontal-left;
|
||||
// vertical-align: middle;
|
||||
// @screen md {
|
||||
// @apply spacing-horizontal grid grid-cols-3;
|
||||
|
||||
// }
|
||||
// }
|
||||
// .homeFeatureItem {
|
||||
// @apply inline-block;
|
||||
|
||||
// .itemImg {
|
||||
// @apply float-left clear-both;
|
||||
// width: 5.6rem;
|
||||
// height: 5.6rem;
|
||||
// @screen md {
|
||||
// @apply float-left clear-both;
|
||||
// width: 11.2rem;
|
||||
// height: 11.2rem;
|
||||
// vertical-align: middle;
|
||||
// }
|
||||
// }
|
||||
// .itemText {
|
||||
// @apply collection-subtitle;
|
||||
// width: 28rem;
|
||||
// height: 9.6rem;
|
||||
// margin-left: 2.4rem;
|
||||
// @screen md {
|
||||
// @apply collection-subtitle text-justify;
|
||||
// width: 28rem;
|
||||
// height: 9.6rem;
|
||||
// margin-left: 2.4rem;
|
||||
// color: red;
|
||||
// }
|
||||
// }
|
||||
// }
|
@@ -0,0 +1,29 @@
|
||||
import React from 'react';
|
||||
|
||||
import s from './CategoryItem.module.scss'
|
||||
import classNames from 'classnames';
|
||||
import Image from "next/image";
|
||||
import Link from 'next/link';
|
||||
|
||||
interface CategoryItem {
|
||||
image: string,
|
||||
name: string,
|
||||
link: string
|
||||
}
|
||||
|
||||
const CategoryItem = ({image,name,link}:CategoryItem) => {
|
||||
return (
|
||||
<div className={classNames(s.categoryItem)}>
|
||||
<div className={classNames(s.categoryItemImage)}>
|
||||
<Link href="#">
|
||||
<Image src={image} />
|
||||
</Link>
|
||||
</div>
|
||||
<Link href="#">
|
||||
<div className={classNames(s.categoryItemText)}>{name}</div>
|
||||
</Link>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default CategoryItem
|
@@ -0,0 +1,41 @@
|
||||
@import '../../../../styles/_utilities';
|
||||
.homeCategoriesWrapper{
|
||||
@apply flex flex-col items-center justify-center ;
|
||||
width: 100%;
|
||||
background-color:white;
|
||||
|
||||
@screen md{
|
||||
background-color:var(--background);
|
||||
height: 36.531rem;
|
||||
}
|
||||
|
||||
.homeCategoriesHeading{
|
||||
width: 100%;
|
||||
font-weight: bold;
|
||||
line-height: 0.64rem;
|
||||
@screen md{
|
||||
width:auto;
|
||||
}
|
||||
.headingCommon{
|
||||
font-size: 3.2rem;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.homeCategoryList {
|
||||
@apply spacing-horizontal flex justify-start items-center flex-wrap ;
|
||||
margin: 1rem 0;
|
||||
@screen md{
|
||||
@apply flex-nowrap ;
|
||||
}
|
||||
.homeCategoriesItem{
|
||||
width: calc(100% / 3);
|
||||
@screen md{
|
||||
margin-top:2rem;
|
||||
width:100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
import React from 'react';
|
||||
|
||||
import s from './HomeCategories.module.scss'
|
||||
import classNames from 'classnames';
|
||||
import CategoryItem from './CategoriesItem/CategoryItem';
|
||||
import HeadingCommon from "../../../common/HeadingCommon/HeadingCommon";
|
||||
|
||||
interface HomeCategories {
|
||||
categories: any[]
|
||||
}
|
||||
|
||||
const HomeCategories = ({categories}:HomeCategories) => {
|
||||
return (
|
||||
|
||||
<div className={classNames(s.homeCategoriesWrapper)}>
|
||||
<div className={classNames(s.homeCategoriesHeading)}>
|
||||
<HeadingCommon children="CATEGORIES"></HeadingCommon>
|
||||
</div>
|
||||
|
||||
<div className={classNames(s.homeCategoryList)}>
|
||||
{categories?.map((props,index)=>(
|
||||
<div key={index} className={classNames(s.homeCategoriesItem)}>
|
||||
<CategoryItem {...props}></CategoryItem>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
)
|
||||
}
|
||||
|
||||
export default HomeCategories
|
BIN
src/components/modules/home/HomeCategories/img/coffeebean.png
Normal file
BIN
src/components/modules/home/HomeCategories/img/coffeebean.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.4 KiB |
BIN
src/components/modules/home/HomeCategories/img/frozen.png
Normal file
BIN
src/components/modules/home/HomeCategories/img/frozen.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.7 KiB |
BIN
src/components/modules/home/HomeCategories/img/sauce.png
Normal file
BIN
src/components/modules/home/HomeCategories/img/sauce.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
BIN
src/components/modules/home/HomeCategories/img/seafood.png
Normal file
BIN
src/components/modules/home/HomeCategories/img/seafood.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.0 KiB |
BIN
src/components/modules/home/HomeCategories/img/veggle.png
Normal file
BIN
src/components/modules/home/HomeCategories/img/veggle.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.9 KiB |
@@ -1 +1,2 @@
|
||||
export { default as HomeBanner } from './HomeBanner/HomeBanner'
|
||||
export { default as HomeCategories } from './HomeCategories/HomeCategories'
|
Reference in New Issue
Block a user