diff --git a/app/[locale]/[[...slug]]/category-page.tsx b/app/[locale]/[[...slug]]/category-page.tsx
new file mode 100644
index 000000000..045aa315f
--- /dev/null
+++ b/app/[locale]/[[...slug]]/category-page.tsx
@@ -0,0 +1,15 @@
+
+interface CategoryPageProps {
+ data: object | any
+}
+
+// This is a Client Component. It receives data as props and
+// has access to state and effects just like Page components
+// in the `pages` directory.
+export default function ProductPage({data }: CategoryPageProps) {
+ console.log(data);
+
+ return (
+ <>Category page>
+ )
+}
diff --git a/app/[locale]/[[...slug]]/home-page.tsx b/app/[locale]/[[...slug]]/home-page.tsx
index a1c871b59..8ea1be716 100644
--- a/app/[locale]/[[...slug]]/home-page.tsx
+++ b/app/[locale]/[[...slug]]/home-page.tsx
@@ -1,9 +1,13 @@
-import DynamicContentManager from 'components/ui/dynamic-content-manager'
+import DynamicContentManager from 'components/layout/dynamic-content-manager'
+
+interface HomePageProps {
+ data: object | any
+}
// This is a Client Component. It receives data as props and
// has access to state and effects just like Page components
// in the `pages` directory.
-export default function HomePage({ data }: { data: object | any }) {
+export default function HomePage({ data }: HomePageProps) {
return (
)
diff --git a/app/[locale]/[[...slug]]/page.tsx b/app/[locale]/[[...slug]]/page.tsx
index 064210dd0..ad523a414 100644
--- a/app/[locale]/[[...slug]]/page.tsx
+++ b/app/[locale]/[[...slug]]/page.tsx
@@ -4,7 +4,9 @@ import getQueryFromSlug from 'helpers/getQueryFromSlug';
import { docQuery } from 'lib/sanity/queries';
import { client } from 'lib/sanity/sanity.client';
import { groq } from 'next-sanity';
+import CategoryPage from './category-page';
import HomePage from './home-page';
+import ProductPage from './product-page';
import SinglePage from './single-page';
export async function generateStaticParams() {
@@ -57,11 +59,11 @@ export default async function Page({
const data = filterDataToSingleItem(pageData, false)
return (
-
- <>
+ <>
{docType === 'home' &&
}
+ {docType === 'product' &&
}
+ {docType === 'category' &&
}
{docType === 'page' &&
}
>
-
)
}
\ No newline at end of file
diff --git a/app/[locale]/[[...slug]]/product-page.tsx b/app/[locale]/[[...slug]]/product-page.tsx
new file mode 100644
index 000000000..8745d689d
--- /dev/null
+++ b/app/[locale]/[[...slug]]/product-page.tsx
@@ -0,0 +1,16 @@
+import ProductView from "components/product/product-view";
+
+interface ProductPageProps {
+ data: object | any
+}
+
+// This is a Client Component. It receives data as props and
+// has access to state and effects just like Page components
+// in the `pages` directory.
+export default function ProductPage({data }: ProductPageProps) {
+ const { product } = data;
+
+ return (
+
+ )
+}
diff --git a/app/[locale]/[[...slug]]/single-page.tsx b/app/[locale]/[[...slug]]/single-page.tsx
index af08f5fe3..68aaed56d 100644
--- a/app/[locale]/[[...slug]]/single-page.tsx
+++ b/app/[locale]/[[...slug]]/single-page.tsx
@@ -3,7 +3,7 @@
import dynamic from 'next/dynamic'
const DynamicContentManager = dynamic(
- () => import('components/ui/dynamic-content-manager')
+ () => import('components/layout/dynamic-content-manager')
)
interface SinglePageProps {
diff --git a/app/[locale]/globals.css b/app/[locale]/globals.css
index 0fd7dd278..71647370b 100644
--- a/app/[locale]/globals.css
+++ b/app/[locale]/globals.css
@@ -39,15 +39,6 @@ body {
}
/* COMPONENTS */
-.glider {
- scrollbar-width: none;
- -ms-overflow-style: none;
-}
-
-.glider::-webkit-scrollbar {
- display: none;
-}
-
.glider-dots {
@apply flex !space-x-[2px] !mt-8;
}
@@ -56,10 +47,6 @@ body {
@apply !m-0 !rounded-none !w-12 !h-4 !bg-transparent after:content-[''] after:block after:w-12 after:h-[3px] after:bg-ui-border 2xl:!w-16 2xl:after:w-16;
}
-.glider-slide {
- @apply max-w-full;
-}
-
.glider-dot.active {
@apply after:!bg-high-contrast;
}
diff --git a/components/cart/edit-item-quantity-button.tsx b/components/cart/edit-item-quantity-button.tsx
index 2249bd1aa..1b837a772 100644
--- a/components/cart/edit-item-quantity-button.tsx
+++ b/components/cart/edit-item-quantity-button.tsx
@@ -4,8 +4,8 @@ import { startTransition, useState } from 'react';
import clsx from 'clsx';
import MinusIcon from 'components/icons/minus';
import PlusIcon from 'components/icons/plus';
+import LoadingDots from 'components/ui/loading-dots';
import type { CartItem } from 'lib/shopify/types';
-import LoadingDots from '../loading-dots';
export default function EditItemQuantityButton({
item,
diff --git a/components/cart/modal.tsx b/components/cart/modal.tsx
index 4220cfe94..6f92a556e 100644
--- a/components/cart/modal.tsx
+++ b/components/cart/modal.tsx
@@ -5,7 +5,7 @@ import Link from 'next/link';
import CloseIcon from 'components/icons/close';
import ShoppingBagIcon from 'components/icons/shopping-bag';
-import Price from 'components/price';
+import Price from 'components/product/price';
import { DEFAULT_OPTION } from 'lib/constants';
import type { Cart } from 'lib/shopify/types';
import { createUrl } from 'lib/utils';
diff --git a/components/ui/dynamic-content-manager/dynamic-content-manager.tsx b/components/layout/dynamic-content-manager/dynamic-content-manager.tsx
similarity index 86%
rename from components/ui/dynamic-content-manager/dynamic-content-manager.tsx
rename to components/layout/dynamic-content-manager/dynamic-content-manager.tsx
index 87c586f4e..33f1b3a7b 100644
--- a/components/ui/dynamic-content-manager/dynamic-content-manager.tsx
+++ b/components/layout/dynamic-content-manager/dynamic-content-manager.tsx
@@ -3,11 +3,11 @@
import { Info } from 'lucide-react'
import dynamic from 'next/dynamic'
-import Hero from 'components/ui/hero'
-const Slider = dynamic(() => import('components/ui/slider'))
-const BlurbSection = dynamic(() => import('components/ui/blurb-section'))
+import Hero from 'components/modules/hero'
+const Slider = dynamic(() => import('components/modules/slider'))
+const BlurbSection = dynamic(() => import('components/modules/blurb-section'))
const FilteredProductList = dynamic(
- () => import('components/ui/filtered-product-list')
+ () => import('components/modules/filtered-product-list')
)
interface getContentComponentProps {
diff --git a/components/ui/dynamic-content-manager/index.tsx b/components/layout/dynamic-content-manager/index.tsx
similarity index 100%
rename from components/ui/dynamic-content-manager/index.tsx
rename to components/layout/dynamic-content-manager/index.tsx
diff --git a/components/ui/blurb-section/blurb-section.tsx b/components/modules/blurb-section/blurb-section.tsx
similarity index 90%
rename from components/ui/blurb-section/blurb-section.tsx
rename to components/modules/blurb-section/blurb-section.tsx
index 90dc20052..d36d31c1e 100644
--- a/components/ui/blurb-section/blurb-section.tsx
+++ b/components/modules/blurb-section/blurb-section.tsx
@@ -1,15 +1,13 @@
-'use client'
-
import {
CarouselItemProps as ItemProps,
CarouselProps as Props,
-} from 'components/ui/carousel/carousel'
+} from 'components/modules/carousel/carousel'
import dynamic from 'next/dynamic'
const Carousel = dynamic(() =>
- import('components/ui/carousel/carousel').then((mod) => mod.Carousel)
+ import('components/modules/carousel/carousel').then((mod) => mod.Carousel)
)
const CarouselItem = dynamic(() =>
- import('components/ui/carousel/carousel').then((mod) => mod.CarouselItem)
+ import('components/modules/carousel/carousel').then((mod) => mod.CarouselItem)
)
const Card = dynamic(() => import('components/ui/card'))
@@ -80,12 +78,12 @@ const BlurbSection = ({
{blurbs && (
= ({
children,
+ className = 'ml-2 first:ml-0 lg:ml-4'
}: CarouselItemProps) => {
- return <>{children}>
+ return {children}
}
export interface CarouselProps {
@@ -20,7 +20,6 @@ export interface CarouselProps {
gliderClasses?: string
hasArrows?: boolean
hasDots?: boolean
- gliderItemWrapperClasses?: string
slidesToShow?: number
slidesToScroll?: number
responsive?: any
@@ -31,15 +30,16 @@ export const Carousel: React.FC = ({
gliderClasses,
hasArrows = true,
hasDots = true,
- gliderItemWrapperClasses,
slidesToShow = 1,
slidesToScroll = 1,
responsive,
}) => {
+
+
return (
-
+ <>
= ({
iconLeft={}
iconRight={}
responsive={[responsive]}
- skipTrack
>
-
{React.Children.map(children, (child) => {
return React.cloneElement(child)
})}
-
+
-
+ >
)
}
diff --git a/components/ui/filtered-product-list/filtered-product-list.tsx b/components/modules/filtered-product-list/filtered-product-list.tsx
similarity index 100%
rename from components/ui/filtered-product-list/filtered-product-list.tsx
rename to components/modules/filtered-product-list/filtered-product-list.tsx
diff --git a/components/ui/filtered-product-list/index.ts b/components/modules/filtered-product-list/index.ts
similarity index 100%
rename from components/ui/filtered-product-list/index.ts
rename to components/modules/filtered-product-list/index.ts
diff --git a/components/ui/hero/hero.tsx b/components/modules/hero/hero.tsx
similarity index 100%
rename from components/ui/hero/hero.tsx
rename to components/modules/hero/hero.tsx
diff --git a/components/ui/hero/index.ts b/components/modules/hero/index.ts
similarity index 100%
rename from components/ui/hero/index.ts
rename to components/modules/hero/index.ts
diff --git a/components/modules/slider/index.ts b/components/modules/slider/index.ts
new file mode 100644
index 000000000..c3d5aba06
--- /dev/null
+++ b/components/modules/slider/index.ts
@@ -0,0 +1,2 @@
+export { default } from './slider';
+
diff --git a/components/ui/slider/slider.tsx b/components/modules/slider/slider.tsx
similarity index 85%
rename from components/ui/slider/slider.tsx
rename to components/modules/slider/slider.tsx
index b05107d46..0a6597cc0 100644
--- a/components/ui/slider/slider.tsx
+++ b/components/modules/slider/slider.tsx
@@ -1,15 +1,15 @@
import {
CarouselItemProps as ItemProps,
CarouselProps as Props,
-} from 'components/ui/carousel/carousel'
+} from 'components/modules/carousel/carousel'
import Text from 'components/ui/text'
import dynamic from 'next/dynamic'
import { useEffect, useState } from 'react'
const Carousel = dynamic(() =>
- import('components/ui/carousel/carousel').then((mod) => mod.Carousel)
+ import('components/modules/carousel/carousel').then((mod) => mod.Carousel)
)
const CarouselItem = dynamic(() =>
- import('components/ui/carousel/carousel').then((mod) => mod.CarouselItem)
+ import('components/modules/carousel/carousel').then((mod) => mod.CarouselItem)
)
const ProductCard = dynamic(() => import('components/ui/product-card'))
const CategoryCard = dynamic(() => import('components/ui/category-card'))
@@ -49,8 +49,7 @@ const Slider = ({ products, categories, title, sliderType }: SliderProps) => {
{items && (
import('components/ui/product-card'))
+const Carousel = dynamic(() =>
+ import('components/modules/carousel/carousel').then((mod) => mod.Carousel)
+)
+const CarouselItem = dynamic(() =>
+ import('components/modules/carousel/carousel').then((mod) => mod.CarouselItem)
+)
+const Text = dynamic(() => import('components/ui/text'))
+interface ProductViewProps {
+ product: Product
+ relatedProducts: Product[]
+}
+
+export default function ProductView({product, relatedProducts }: ProductViewProps) {
+ const images = product.images
+ const productImage: object | any = product.images[0]
+ const t = useTranslations('product')
+
+ return (
+
+
+
+
+
+ {images && (
+
+ {images.map((image: any, index: number) => (
+
+
+
+ ))}
+
+ )}
+
+
+
+ {images.map((image: any, index: number) => (
+
+
+
+ ))}
+
+
+
+
+ {product.name}
+
+
+
+
+ {relatedProducts.length > 0 && (
+
+
+ {t('related')}
+
+
+
+ {relatedProducts.map((p, index) => (
+
+
+
+ ))}
+
+
+ )}
+
+ )
+}
\ No newline at end of file
diff --git a/components/ui/product-card/product-card.tsx b/components/ui/product-card/product-card.tsx
index ccaf863dc..a44f5d0fa 100644
--- a/components/ui/product-card/product-card.tsx
+++ b/components/ui/product-card/product-card.tsx
@@ -27,7 +27,7 @@ const ProductCard: FC = ({
}) => {
const rootClassName = cn(
- 'w-full group relative overflow-hidden transition-transform ease-linear',
+ 'w-full group relative overflow-hidden',
className
)
@@ -39,7 +39,7 @@ const ProductCard: FC = ({
locale={product.locale}
>
{variant === 'default' && (
-
+
= ({
product?.variants ? (product.variants[0] as any) : null
}
/>
-
+
{product?.images && (
)}
diff --git a/components/ui/product-tag/index.ts b/components/ui/product-tag/index.ts
deleted file mode 100644
index 0c00d74ce..000000000
--- a/components/ui/product-tag/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export { default } from './product-tag';
-
diff --git a/components/ui/product-tag/product-tag.tsx b/components/ui/product-tag/product-tag.tsx
deleted file mode 100644
index c9ddc319f..000000000
--- a/components/ui/product-tag/product-tag.tsx
+++ /dev/null
@@ -1,48 +0,0 @@
-'use client'
-
-import { cn } from 'lib/utils'
-import dynamic from 'next/dynamic'
-const Text = dynamic(() => import('components/ui/text'))
-
-interface ProductTagProps {
- className?: string
- name: string
- price: string
- variant?: 'productView' | 'cardView'
-}
-
-const ProductTag: React.FC
= ({
- name,
- price,
- className = '',
- variant = 'cardView',
-}) => {
- return (
-
-
- {name}
-
-
- {price}
-
-
- )
-}
-
-export default ProductTag
diff --git a/components/ui/slider/index.ts b/components/ui/slider/index.ts
deleted file mode 100644
index 19a6da94b..000000000
--- a/components/ui/slider/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { default } from './Slider'
diff --git a/helpers/getQueryFromSlug.ts b/helpers/getQueryFromSlug.ts
index c0fc0388e..30f5ddf0a 100644
--- a/helpers/getQueryFromSlug.ts
+++ b/helpers/getQueryFromSlug.ts
@@ -1,12 +1,16 @@
import { groq } from 'next-sanity'
import {
+ categoryQuery,
homePageQuery,
pageQuery,
+ productQuery
} from '../lib/sanity/queries'
const getQueryFromSlug = (slugArray: string[], locale: string) => {
const docQuery = {
homePage: groq`${homePageQuery}`,
+ product: groq`${productQuery}`,
+ category: groq`${categoryQuery}`,
page: groq`${pageQuery}`,
}
@@ -28,10 +32,10 @@ const getQueryFromSlug = (slugArray: string[], locale: string) => {
locale: locale
}
- if (slugStart === 'articles' && slugArray.length === 2) {
- docType = `article`
- } else if (slugStart === 'work' && slugArray.length === 2) {
- docType = `work`
+ if (slugStart === `produkt` || slugStart === `product`) {
+ docType = `product`
+ } else if (slugStart === `kategori` || slugStart === `category`) {
+ docType = `category`
} else {
docType = `page`
}
diff --git a/languages.json b/languages.json
deleted file mode 100644
index ae7e823c5..000000000
--- a/languages.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "i18n": {
- "languages": [
- { "id": "sv", "title": "Swedish", "isDefault": true },
- { "id": "nn", "title": "Norwegian" },
- { "id": "en", "title": "English" }
- ],
- "base": "sv"
- }
-}
\ No newline at end of file
diff --git a/next.config.js b/next.config.js
index 4bf1c6d09..5e4ed1c56 100644
--- a/next.config.js
+++ b/next.config.js
@@ -1,6 +1,4 @@
/** @type {import('next').NextConfig} */
-const { i18n } = require('./languages.json')
-
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.BUNDLE_ANALYZE === 'true',
})
@@ -12,7 +10,8 @@ module.exports = withBundleAnalyzer(
ignoreDuringBuilds: true
},
experimental: {
- appDir: true
+ appDir: true,
+ scrollRestoration: true,
},
images: {
formats: ['image/avif', 'image/webp'],