Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implemented types from graphql-codegen #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions components/grid/three-items.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { GridTileImage } from 'components/grid/tile';
import { PLACEHOLDER_IMAGE } from 'lib/constants';
import { getCategoryProducts } from 'lib/swell';
import type { Product } from 'lib/swell/types';
import type { SwellProduct } from 'lib/swell/types';
import Link from 'next/link';

function ThreeItemGridItem({
item,
size,
background
}: {
item: Product;
item: SwellProduct;
size: 'full' | 'half';
background: 'white' | 'pink' | 'purple' | 'black';
}) {
Expand All @@ -19,16 +19,16 @@ function ThreeItemGridItem({
>
<Link className="block h-full" href={`/product/${item.slug}`}>
<GridTileImage
src={ (item.images.length === 0) ? PLACEHOLDER_IMAGE : item.images[0].file.url}
src={ (item!.images!.length === 0) ? PLACEHOLDER_IMAGE : item.images![0]!.file!.url!}
width={size === 'full' ? 1080 : 540}
height={size === 'full' ? 1080 : 540}
priority={true}
background={background}
alt={item.name}
alt={item.name!}
labels={{
title: item.name as string, // TODO: Ensure correct typing
amount: String(item.price), //TODO: Clean this up
currencyCode: 'USD' // TODO: Clean this up
title: item.name as string,
amount: String(item.price),
currencyCode: 'USD' // TODO: Implement Multi-currency support here
}}
/>
</Link>
Expand Down
2 changes: 1 addition & 1 deletion lib/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ export const DEFAULT_OPTION = 'Default Title';
export const SHOPIFY_GRAPHQL_API_ENDPOINT = '/api/2023-01/graphql.json'; // TODO: REMOVE THIS
export const SWELL_GRAPHQL_API_ENDPOINT = '/graphql'

export const PLACEHOLDER_IMAGE = 'https://media.istockphoto.com/id/1147544807/vector/thumbnail-image-vector-graphic.jpg?s=612x612&w=0&k=20&c=rnCKVbdxqkjlcs3xH87-9gocETqpspHFXu5dIGB4wuM='
export const PLACEHOLDER_IMAGE : string = 'https://media.istockphoto.com/id/1147544807/vector/thumbnail-image-vector-graphic.jpg?s=612x612&w=0&k=20&c=rnCKVbdxqkjlcs3xH87-9gocETqpspHFXu5dIGB4wuM='
Loading