diff --git a/assets/base.css b/assets/base.css index eb303268d..2f8ae3738 100644 --- a/assets/base.css +++ b/assets/base.css @@ -18,7 +18,7 @@ --accent-0: #fff; --accent-1: #fafafa; - --accent-2: #eaeaea; + --accent-2: #e2e2e2; --accent-3: #b4afaf; --accent-4: #888888; --accent-5: #666666; @@ -27,8 +27,6 @@ --accent-8: #111111; --accent-9: #000; - --font-sans: 'Inter', sans-serif; - --cyan: #22b8cf; --green: #37b679; --purple: #f81ce5; @@ -39,46 +37,53 @@ --violet-dark: #4c2889; } -*, -*:before, -*:after { - box-sizing: inherit; -} +@layer base { + *, + *:before, + *:after { + box-sizing: inherit; + letter-spacing: -0.025em; + } -html { - height: 100%; - box-sizing: border-box; - touch-action: manipulation; - text-rendering: optimizeLegibility; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - @apply text-html; -} -@screen lg { html { - @apply text-html-lg; + height: 100%; + box-sizing: border-box; + touch-action: manipulation; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + @apply text-html; + } + @screen lg { + html { + @apply text-html-lg; + } + } + + html, + body { + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + background-color: var(--primary); + color: var(--text-primary); + overscroll-behavior-x: none; + } + + body { + position: relative; + min-height: 100%; + margin: 0; + } + + a { + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } } -html, -body { - font-family: var(--font-sans); - text-rendering: optimizeLegibility; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - background-color: var(--primary); - color: var(--text-primary); - overscroll-behavior-x: none; -} -body { - position: relative; - min-height: 100%; - margin: 0; -} - -a { - -webkit-tap-highlight-color: rgba(0, 0, 0, 0); +.tag { + @apply inline-block py-2 px-5 text-4xl border border-black rounded-full; } .animated { diff --git a/components/common/HomeAllProductsGrid/HomeAllProductsGrid.tsx b/components/common/HomeAllProductsGrid/HomeAllProductsGrid.tsx index 0a40bff2e..4e0cabe60 100644 --- a/components/common/HomeAllProductsGrid/HomeAllProductsGrid.tsx +++ b/components/common/HomeAllProductsGrid/HomeAllProductsGrid.tsx @@ -57,11 +57,6 @@ const HomeAllProductsGrid: FC = ({ ))} diff --git a/components/product/ProductCard/ProductCard.module.css b/components/product/ProductCard/ProductCard.module.css index d5d441fea..4573efe15 100644 --- a/components/product/ProductCard/ProductCard.module.css +++ b/components/product/ProductCard/ProductCard.module.css @@ -1,114 +1,19 @@ .root { @apply relative max-h-full w-full box-border overflow-hidden - bg-no-repeat bg-center bg-cover transition-transform - ease-linear cursor-pointer inline-block bg-accent-1; + transition-transform ease-linear cursor-pointer inline-block; height: 100% !important; } -.root:hover { - & .productImage { - transform: scale(1.2625); - } - - & .header .name span, - & .header .price, - & .wishlistButton { - @apply bg-secondary text-secondary; - } - - &:nth-child(6n + 1) .header .name span, - &:nth-child(6n + 1) .header .price, - &:nth-child(6n + 1) .wishlistButton { - @apply bg-violet text-white; - } - - &:nth-child(6n + 5) .header .name span, - &:nth-child(6n + 5) .header .price, - &:nth-child(6n + 5) .wishlistButton { - @apply bg-blue text-white; - } - - &:nth-child(6n + 3) .header .name span, - &:nth-child(6n + 3) .header .price, - &:nth-child(6n + 3) .wishlistButton { - @apply bg-pink text-white; - } - - &:nth-child(6n + 6) .header .name span, - &:nth-child(6n + 6) .header .price, - &:nth-child(6n + 6) .wishlistButton { - @apply bg-cyan text-white; - } -} - -.header { - @apply transition-colors ease-in-out duration-500 - absolute top-0 left-0 z-20 pr-16; -} - -.header .name { - @apply pt-0 max-w-full w-full leading-extra-loose - transition-colors ease-in-out duration-500; - font-size: 2rem; - letter-spacing: 0.4px; -} - -.header .name span { - @apply py-4 px-6 bg-primary text-primary font-bold - transition-colors ease-in-out duration-500; - font-size: inherit; - letter-spacing: inherit; - box-decoration-break: clone; - -webkit-box-decoration-break: clone; -} - -.header .price { - @apply pt-2 px-6 pb-4 text-sm bg-primary text-accent-9 - font-semibold inline-block tracking-wide - transition-colors ease-in-out duration-500; -} - .imageContainer { - @apply flex items-center justify-center overflow-hidden; + @apply relative flex items-center justify-center bg-primary-2 mb-4; + padding: 12% 15%; +} +.imageContainerInner { + @apply relative w-full; + padding-bottom: 100%; } -.imageContainer > div { - min-width: 100%; -} - -.imageContainer .productImage { - @apply transform transition-transform duration-500 - object-cover scale-120; -} - -.root .wishlistButton { - @apply top-0 right-0 z-30 absolute; -} - -/* Variant Simple */ -.simple .header .name { - @apply pt-2 text-lg leading-10 -mt-1; -} - -.simple .header .price { - @apply text-sm; -} - -/* Variant Slim */ -.slim { - @apply bg-transparent relative overflow-hidden - box-border; -} - -.slim .header { - @apply absolute inset-0 flex items-center justify-end mr-8 z-20; -} - -.slim span { - @apply bg-accent-9 text-accent-0 inline-block p-3 - font-bold text-xl break-words; -} - -.root:global(.secondary) .header span { - @apply bg-accent-0 text-accent-9; +.typeIcon { + @apply absolute bg-accent-2 rounded-full p-1.5 -bottom-2 right-2.5; + font-size: 0; } diff --git a/components/product/ProductCard/ProductCard.tsx b/components/product/ProductCard/ProductCard.tsx index 3e5c58887..ff760bfe5 100644 --- a/components/product/ProductCard/ProductCard.tsx +++ b/components/product/ProductCard/ProductCard.tsx @@ -3,27 +3,20 @@ import cn from 'classnames' import Link from 'next/link' import type { Product } from '@commerce/types/product' import s from './ProductCard.module.css' -import Image, { ImageProps } from 'next/image' -import WishlistButton from '@components/wishlist/WishlistButton' +import Image from 'next/image' import usePrice from '@framework/product/use-price' -import ProductTag from '../ProductTag' interface Props { className?: string product: Product noNameTag?: boolean - imgProps?: Omit - variant?: 'default' | 'slim' | 'simple' } const placeholderImg = '/product-img-placeholder.svg' const ProductCard: FC = ({ product, - imgProps, className, - noNameTag = false, - variant = 'default', }) => { const { price } = usePrice({ amount: product.price.value, @@ -33,97 +26,40 @@ const ProductCard: FC = ({ const rootClassName = cn( s.root, - { [s.slim]: variant === 'slim', [s.simple]: variant === 'simple' }, className ) return ( - {variant === 'slim' && ( - <> -
- {product.name} -
+
+
{product?.images && ( {product.name )} - - )} - - {variant === 'simple' && ( - <> - {process.env.COMMERCE_WISHLIST_ENABLED && ( - - )} - {!noNameTag && ( -
-

- {product.name} -

-
- {`${price} ${product.price?.currencyCode}`} -
-
- )} -
- {product?.images && ( - {product.name - )} -
- - )} - - {variant === 'default' && ( - <> - {process.env.COMMERCE_WISHLIST_ENABLED && ( - - )} - +
+ -
- {product?.images && ( - {product.name - )} -
- - )} +
+
+
+ {product.name} +
+
+ Author (missing data) +
+
{price}
) diff --git a/components/product/ProductView/ProductView.module.css b/components/product/ProductView/ProductView.module.css index 0b3ebf564..36c721cbe 100644 --- a/components/product/ProductView/ProductView.module.css +++ b/components/product/ProductView/ProductView.module.css @@ -38,7 +38,7 @@ } .relatedProductsGrid { - @apply grid grid-cols-2 py-2 gap-2 md:grid-cols-4 md:gap-7; + @apply grid grid-cols-2 py-2 gap-2 md:grid-cols-6 md:gap-7; } @screen lg { diff --git a/components/product/ProductView/ProductView.tsx b/components/product/ProductView/ProductView.tsx index f689030d6..c88f26300 100644 --- a/components/product/ProductView/ProductView.tsx +++ b/components/product/ProductView/ProductView.tsx @@ -67,18 +67,13 @@ const ProductView: FC = ({ product, relatedProducts }) => { {relatedProducts.map((p) => (
))} diff --git a/components/search.tsx b/components/search.tsx index 0a653c6cd..c4f200779 100644 --- a/components/search.tsx +++ b/components/search.tsx @@ -313,17 +313,12 @@ export default function Search({ categories, brands }: SearchPropsType) {
)} {data ? ( -
+
{data.products.map((product: Product) => ( ))}
diff --git a/components/ui/Grid/Grid.module.css b/components/ui/Grid/Grid.module.css index 27e4c5b19..74a7dd5cf 100644 --- a/components/ui/Grid/Grid.module.css +++ b/components/ui/Grid/Grid.module.css @@ -1,8 +1,8 @@ .root { - @apply grid grid-cols-1 gap-0; + @apply grid grid-cols-2 gap-0; @screen lg { - @apply grid-cols-3 grid-rows-2; + @apply grid-cols-6; } & > * { @@ -24,7 +24,7 @@ } .layoutNormal { - @apply gap-3; + @apply gap-6; } @screen md { diff --git a/package.json b/package.json index 0a682a5b6..ee407ba97 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ }, "dependencies": { "@react-spring/web": "^9.2.1", + "@tailwindcss/line-clamp": "^0.2.1", "@vercel/fetch": "^6.1.0", "autoprefixer": "^10.2.6", "body-scroll-lock": "^3.1.5", diff --git a/pages/index.tsx b/pages/index.tsx index b399923f7..de9049b13 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -1,8 +1,7 @@ import commerce from '@lib/api/commerce' import { Layout } from '@components/common' import { ProductCard } from '@components/product' -import { Grid, Marquee, Hero } from '@components/ui' -// import HomeAllProductsGrid from '@components/common/HomeAllProductsGrid' +import { Grid, Container, Marquee } from '@components/ui' import type { GetStaticPropsContext, InferGetStaticPropsType } from 'next' export async function getStaticProps({ @@ -15,8 +14,6 @@ export async function getStaticProps({ variables: { first: 6 }, config, preview, - // Saleor provider only - ...({ featured: true } as any), }) const pagesPromise = commerce.getAllPages({ config, preview }) const siteInfoPromise = commerce.getSiteInfo({ config, preview }) @@ -40,49 +37,26 @@ export default function Home({ }: InferGetStaticPropsType) { return ( <> - - {products.slice(0, 3).map((product: any, i: number) => ( - - ))} - - - {products.slice(0, 3).map((product: any, i: number) => ( - - ))} - - - - {products.slice(0, 3).map((product: any, i: number) => ( - - ))} - - - {products.slice(3).map((product: any, i: number) => ( - - ))} - - {/* */} + +

New releases

+ + {products.slice(0, 6).map((product: any, i: number) => ( + + ))} + +

Bestsellers

+ + {products.slice(0, 6).map((product: any, i: number) => ( + + ))} + +
) } diff --git a/pages/products/[slug].tsx b/pages/products/[slug].tsx index 87a340664..5283d9a31 100644 --- a/pages/products/[slug].tsx +++ b/pages/products/[slug].tsx @@ -24,7 +24,7 @@ export async function getStaticProps({ }) const allProductsPromise = commerce.getAllProducts({ - variables: { first: 4 }, + variables: { first: 6 }, config, preview, }) diff --git a/public/icon-audiobook.svg b/public/icon-audiobook.svg new file mode 100644 index 000000000..a26afdaf2 --- /dev/null +++ b/public/icon-audiobook.svg @@ -0,0 +1,3 @@ + + + diff --git a/public/icon-ebook.svg b/public/icon-ebook.svg new file mode 100644 index 000000000..d44ea0939 --- /dev/null +++ b/public/icon-ebook.svg @@ -0,0 +1,3 @@ + + + diff --git a/tailwind.config.js b/tailwind.config.js index 5467f9270..9c6130792 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,4 +1,5 @@ module.exports = { + plugins: [require('@tailwindcss/line-clamp')], future: { purgeLayersByDefault: true, applyComplexClasses: true, @@ -58,9 +59,13 @@ module.exports = { magical: 'rgba(0, 0, 0, 0.02) 0px 30px 30px, rgba(0, 0, 0, 0.03) 0px 0px 8px, rgba(0, 0, 0, 0.05) 0px 1px 0px', }, + fontFamily: { + sans: '"Inter","Helvetica Neue",HelveticaNeue,"TeX Gyre Heros",TeXGyreHeros,FreeSans,"Nimbus Sans L","Liberation Sans",Arimo,Helvetica,sans-serif', + }, fontSize: { html: '15px', 'html-lg': '18px', + '4xl': '2rem', }, lineHeight: { 'extra-loose': '2.2', @@ -68,6 +73,12 @@ module.exports = { scale: { 120: '1.2', }, + width: { + '9/12': '75%', + }, + height: { + '9/12': '75%', + }, }, }, }