mirror of
https://github.com/vercel/commerce.git
synced 2025-07-22 20:26:49 +00:00
Adding ticker and hero
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
.root {
|
||||
@apply relative w-full p-6 box-border overflow-hidden;
|
||||
@apply relative w-full p-6 box-border overflow-hidden bg-no-repeat bg-center bg-cover transition ease-linear;
|
||||
}
|
||||
|
||||
.productTitle {
|
||||
@@ -7,7 +7,7 @@
|
||||
max-width: calc(100% - 50px);
|
||||
|
||||
@screen lg {
|
||||
@apply text-xl;
|
||||
@apply text-2xl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,5 +16,5 @@
|
||||
}
|
||||
|
||||
.wishlistButton {
|
||||
@apply w-14 h-14 flex items-center justify-center bg-white text-black font-semibold inline-block text-sm leading-6;
|
||||
@apply w-14 h-14 flex items-center justify-center bg-white text-black font-semibold inline-block text-sm leading-6 cursor-pointer;
|
||||
}
|
||||
|
@@ -2,10 +2,11 @@ import cn from 'classnames'
|
||||
import s from './ProductCard.module.css'
|
||||
import { FC } from 'react'
|
||||
import { Heart } from '@components/icon'
|
||||
import { url } from 'inspector'
|
||||
interface Props {
|
||||
className?: string
|
||||
children?: any
|
||||
productData: ProductData
|
||||
node: ProductData
|
||||
}
|
||||
|
||||
interface ProductData {
|
||||
@@ -14,12 +15,18 @@ interface ProductData {
|
||||
prices: any
|
||||
}
|
||||
|
||||
const ProductCard: FC<Props> = ({ className, productData }) => {
|
||||
const ProductCard: FC<Props> = ({ className, node: productData }) => {
|
||||
const rootClassName = cn(s.root, className)
|
||||
|
||||
return (
|
||||
<div className={rootClassName}>
|
||||
{/* Overlay */}
|
||||
<div
|
||||
className={rootClassName}
|
||||
style={
|
||||
{
|
||||
// backgroundImage: `url('${productData.images.edges[0].node.urlSmall}')`,
|
||||
}
|
||||
}
|
||||
>
|
||||
<div className="flex flex-row justify-between box-border w-full z-10 relative">
|
||||
<div className="flex flex-col flex-1 overflow-hidden">
|
||||
<div className="flex-1">
|
||||
@@ -35,13 +42,6 @@ const ProductCard: FC<Props> = ({ className, productData }) => {
|
||||
<Heart />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* <div className="absolute box-border top-0 left-0 w-full z-0 m-12"> */}
|
||||
{/* <img
|
||||
className="object-cover object-center w-full"
|
||||
src={productData.images.edges[0].node.urlSmall}
|
||||
/> */}
|
||||
{/* </div> */}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
.root {
|
||||
@apply mx-auto px-2;
|
||||
@apply mx-auto max-w-screen-xl mx-auto px-6 sm:px-4 lg:px-10;
|
||||
display: inherit;
|
||||
max-width: 1440px;
|
||||
}
|
||||
|
3
components/ui/Hero/Hero.module.css
Normal file
3
components/ui/Hero/Hero.module.css
Normal file
@@ -0,0 +1,3 @@
|
||||
.root {
|
||||
@apply bg-black py-12;
|
||||
}
|
27
components/ui/Hero/Hero.tsx
Normal file
27
components/ui/Hero/Hero.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
import cn from 'classnames'
|
||||
import React, { FC } from 'react'
|
||||
import s from './Hero.module.css'
|
||||
import { Container } from '@components/ui'
|
||||
interface Props {
|
||||
className?: string
|
||||
headline: string
|
||||
description: string
|
||||
}
|
||||
|
||||
const Hero: FC<Props> = ({ headline, description, className }) => {
|
||||
const rootClassName = cn(s.root, className)
|
||||
return (
|
||||
<div className={rootClassName}>
|
||||
<Container>
|
||||
<div className="max-w-xl">
|
||||
<h2 className="text-4xl leading-10 font-extrabold text-white sm:text-5xl sm:leading-none sm:tracking-tight lg:text-6xl">
|
||||
{headline}
|
||||
</h2>
|
||||
<p className="mt-5 text-xl leading-7 text-gray-400">{description}</p>
|
||||
</div>
|
||||
</Container>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default Hero
|
1
components/ui/Hero/index.ts
Normal file
1
components/ui/Hero/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from './Hero'
|
@@ -1,5 +1,5 @@
|
||||
.root {
|
||||
@apply bg-white py-10 flex flex-row w-full;
|
||||
@apply bg-white py-10 w-full relative flex flex-row;
|
||||
}
|
||||
|
||||
.primary {
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import cn from 'classnames'
|
||||
import s from './Marquee.module.css'
|
||||
import { FC } from 'react'
|
||||
import Ticker from 'react-ticker'
|
||||
|
||||
interface Props {
|
||||
className?: string
|
||||
@@ -12,7 +13,7 @@ interface Props {
|
||||
|
||||
const DefaultWrapper: FC<Props> = ({ children }) => <div>{children}</div> // DEFAULT PRODUCT WRAPPER
|
||||
|
||||
const Marquee: FC<Props> = ({
|
||||
const M: FC<Props> = ({
|
||||
className = '',
|
||||
items,
|
||||
wrapper: Component = DefaultWrapper,
|
||||
@@ -26,13 +27,22 @@ const Marquee: FC<Props> = ({
|
||||
},
|
||||
className
|
||||
)
|
||||
|
||||
const flickityOptions = {
|
||||
initialIndex: 2,
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={rootClassName}>
|
||||
{items.map((p: any) => (
|
||||
<Component {...p} />
|
||||
))}
|
||||
</div>
|
||||
<Ticker>
|
||||
{({ index }) => (
|
||||
<div className={rootClassName}>
|
||||
{items.map((p: any) => (
|
||||
<Component {...p} key={index} />
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</Ticker>
|
||||
)
|
||||
}
|
||||
|
||||
export default Marquee
|
||||
export default M
|
||||
|
@@ -4,3 +4,4 @@ export { default as Sidebar } from './Sidebar'
|
||||
export { default as Logo } from './Logo'
|
||||
export { default as Grid } from './Grid'
|
||||
export { default as Marquee } from './Marquee'
|
||||
export { default as Hero } from './Hero'
|
||||
|
Reference in New Issue
Block a user