forked from crowetic/commerce
Fix: color option
This commit is contained in:
parent
029a8372a2
commit
553a1fd9d3
@ -25,8 +25,8 @@ const ProductCard: FC<Props> = ({
|
|||||||
<a className={cn(s.root, { [s.simple]: variant === 'simple' }, className)}>
|
<a className={cn(s.root, { [s.simple]: variant === 'simple' }, className)}>
|
||||||
{variant === 'slim' ? (
|
{variant === 'slim' ? (
|
||||||
<div className="relative overflow-hidden box-border">
|
<div className="relative overflow-hidden box-border">
|
||||||
<div className="absolute inset-0 flex items-center justify-end mr-8 z-20">
|
<div className="absolute inset-0 flex items-start justify-end m-1 z-20">
|
||||||
<span className="bg-black text-white inline-block p-3 font-bold text-xl break-words">
|
<span className="text-black inline-block p-3 font-bold text-xl break-words">
|
||||||
{product.name}
|
{product.name}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -22,14 +22,17 @@ const normalizeProductOption = ({
|
|||||||
name: displayName,
|
name: displayName,
|
||||||
values,
|
values,
|
||||||
...rest
|
...rest
|
||||||
}: ProductOption) => ({
|
}: ProductOption) => {
|
||||||
__typename: 'MultipleChoiceOption',
|
return {
|
||||||
displayName,
|
__typename: 'MultipleChoiceOption',
|
||||||
values: values.map((value) => ({
|
displayName,
|
||||||
label: value,
|
values: values.map((value) => ({
|
||||||
})),
|
label: value,
|
||||||
...rest,
|
hexColors: displayName === 'Color' ? [value] : null,
|
||||||
})
|
})),
|
||||||
|
...rest,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const normalizeProductImages = ({ edges }: ImageConnection) =>
|
const normalizeProductImages = ({ edges }: ImageConnection) =>
|
||||||
edges?.map(({ node: { originalSrc: url, ...rest } }) => ({
|
edges?.map(({ node: { originalSrc: url, ...rest } }) => ({
|
||||||
|
@ -29,6 +29,8 @@ const getProduct = async (options: {
|
|||||||
|
|
||||||
const product = data?.productByHandle
|
const product = data?.productByHandle
|
||||||
|
|
||||||
|
console.info(normalizeProduct(product))
|
||||||
|
|
||||||
return {
|
return {
|
||||||
product: product ? normalizeProduct(product) : null,
|
product: product ? normalizeProduct(product) : null,
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user