-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
GFier
committed
Apr 2, 2024
1 parent
72afc30
commit 8ea1f92
Showing
18 changed files
with
3,338 additions
and
2,970 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import cn from 'clsx' | ||
import { Image } from 'components/image' | ||
import { getCollectionProducts } from 'libs/shopify' | ||
import { AddToCart } from 'libs/shopify/cart/add-to-cart' | ||
import s from './product.module.scss' | ||
|
||
export async function Product() { | ||
const data = await getCollectionProducts({ collection: 'frontpage' }) | ||
|
||
const product = data?.find((product) => product.handle === 'darkroom-board') | ||
|
||
return ( | ||
<div className={cn('layout-grid-inner', s.product)}> | ||
<div className={s.media}> | ||
<Image src={product?.images[0].url} alt={product?.altText} /> | ||
</div> | ||
<aside className={s.details}> | ||
<h1>{product?.title}</h1> | ||
<p>{product?.description}</p> | ||
</aside> | ||
<AddToCart variants={product?.variants} className={s.add} /> | ||
</div> | ||
) | ||
} |
60 changes: 60 additions & 0 deletions
60
app/(pages)/shopify/(components)/product/product.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
.product { | ||
margin: auto; | ||
height: 50vh; | ||
align-items: center; | ||
justify-items: center; | ||
|
||
.details { | ||
grid-column: 4/-4; | ||
display: flex; | ||
flex-direction: column; | ||
gap: desktop-vw(16px); | ||
text-align: center; | ||
margin-bottom: desktop-vw(16px); | ||
} | ||
|
||
.media { | ||
position: relative; | ||
grid-column: 3/-3; | ||
aspect-ratio: 341/1404; | ||
height: 50vh; | ||
} | ||
|
||
.add { | ||
position: relative; | ||
grid-column: 4/-4; | ||
display: flex; | ||
border: 2px solid var(--black); | ||
padding: desktop-vw(16px); | ||
border-radius: desktop-vw(8px); | ||
overflow: hidden; | ||
cursor: pointer; | ||
|
||
&::before { | ||
content: ''; | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
width: 100%; | ||
height: 100%; | ||
background-color: var(--black); | ||
clip-path: circle(0%); | ||
} | ||
|
||
button { | ||
position: relative; | ||
} | ||
|
||
@include hover { | ||
&:hover { | ||
color: var(--white); | ||
|
||
&::before { | ||
transition: 1000ms clip-path var(--gleasing); | ||
clip-path: circle(100%); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
'use client' | ||
|
||
import cn from 'clsx' | ||
import { useCartModal } from 'libs/shopify/cart/modal' | ||
|
||
export const ShowCart = ({ className }) => { | ||
const openCart = useCartModal() | ||
|
||
return ( | ||
<button onClick={openCart} className={cn(className, 'link')}> | ||
Cart | ||
</button> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Cart } from 'libs/shopify/cart' | ||
import { Wrapper } from '../(components)/wrapper' | ||
import { Product } from './(components)/product' | ||
import { ShowCart } from './(components)/show-cart' | ||
import s from './shopify.module.scss' | ||
|
||
export default async function Storyblok() { | ||
return ( | ||
<Wrapper theme="red" className={s.page}> | ||
<Cart> | ||
<ShowCart className={s.cart} /> | ||
<Product /> | ||
</Cart> | ||
</Wrapper> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.page { | ||
text-transform: uppercase; | ||
font-family: var(--font-ibm-plex-mono); | ||
} | ||
|
||
.cart { | ||
position: fixed; | ||
top: var(--layout-margin); | ||
right: var(--layout-margin); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { useEffect } from 'react' | ||
|
||
export const useBeforeUnload = (stop) => { | ||
useEffect(() => { | ||
const handleBeforeUnload = (e) => { | ||
if (!stop) return | ||
e.preventDefault() | ||
} | ||
window.addEventListener('beforeunload', handleBeforeUnload) | ||
|
||
return () => { | ||
window.removeEventListener('beforeunload', handleBeforeUnload) | ||
} | ||
}, [stop]) | ||
} |
Oops, something went wrong.