import { Card, CardAction, CardContent, CardDescription, CardHeader, CardTitle } from '@components/common/ui/Card.js'; import React from 'react'; import './Bestsellers.scss'; import { Image } from '@components/common/Image.js'; import { ProductNoThumbnail } from '@components/common/ProductNoThumbnail.js'; import { Table, TableRow, TableBody, TableCell } from '@components/common/ui/Table.js'; interface BestSellersProps { bestSellers: Array<{ name: string; price: { regular: { value: number; text: string; }; }; soldQty: number; image?: { url?: string; }; editUrl?: string; }>; listUrl: string; } export default function BestSellers({ bestSellers, listUrl }: BestSellersProps) { return ( Best Sellers A list of best selling products View All Products {bestSellers.length === 0 && ( Look like you just started. No bestsellers yet. )} {bestSellers.map((p, i) => (
{p.image?.url && ( )} {!p.image?.url && ( )}
{p.price.regular.text} {p.soldQty} sold
))}
); } export const layout = { areaId: 'leftSide', sortOrder: 20 }; export const query = ` query Query { bestSellers { name price { regular { value text } } soldQty image { url } editUrl } listUrl: url(routeId: "productGrid") } `;