commerce/lib/constants.ts
Kristian Duda ccf6d51eee wip
2024-06-28 08:21:04 +02:00

62 lines
1.5 KiB
TypeScript

import { Collection, Page } from 'lib/shopify/types';
export type SortFilterItem = {
title: string;
slug: string | null;
sortKey: 'RELEVANCE' | 'BEST_SELLING' | 'CREATED_AT' | 'PRICE';
reverse: boolean;
};
export const defaultSort: SortFilterItem = {
title: 'Relevance',
slug: null,
sortKey: 'RELEVANCE',
reverse: false
};
export const sorting: SortFilterItem[] = [
defaultSort,
{ title: 'Trending', slug: 'trending-desc', sortKey: 'BEST_SELLING', reverse: false }, // asc
{ title: 'Latest arrivals', slug: 'latest-desc', sortKey: 'CREATED_AT', reverse: true },
{ title: 'Price: Low to high', slug: 'price-asc', sortKey: 'PRICE', reverse: false }, // asc
{ title: 'Price: High to low', slug: 'price-desc', sortKey: 'PRICE', reverse: true }
];
export const TAGS = {
collections: 'collections',
products: 'products',
cart: 'cart'
};
export const HIDDEN_PRODUCT_TAG = 'nextjs-frontend-hidden';
export const DEFAULT_OPTION = 'Default Title';
export const SHOPIFY_GRAPHQL_API_ENDPOINT = '/api/2023-01/graphql.json';
export const PAGES: Page[] = [];
const CURRENT_DATE = new Date().toISOString();
export const COLLECTIONS: Collection[] = [
{
handle: '',
title: 'All',
description: 'All products',
seo: {
title: 'All',
description: 'All products'
},
path: '/search',
updatedAt: CURRENT_DATE
},
{
handle: 'shirts',
title: 'Shirts',
description: 'Shirts',
seo: {
title: 'Shirts',
description: 'Shirts'
},
path: '/search/shirts',
updatedAt: CURRENT_DATE
}
];