From 3092c0b1e868a5ebdda3fb123e088f63367c6b07 Mon Sep 17 00:00:00 2001 From: aruay99 Date: Sat, 18 Nov 2023 05:44:39 +0600 Subject: [PATCH 1/3] fix: fix table layout --- src/features/products/components/Product.tsx | 20 ++++++++++++------- .../products/components/ProductsList.tsx | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/features/products/components/Product.tsx b/src/features/products/components/Product.tsx index 1025ceca..a1401114 100644 --- a/src/features/products/components/Product.tsx +++ b/src/features/products/components/Product.tsx @@ -11,17 +11,23 @@ interface Props { export function Product({ product, pending, actions }: Props) { return ( <> -
- x{product.quantity} - {product.name} - {product.brand} -
- {actions} + + + x{product.quantity} + {product.name} + + {product.brand} + + {actions} + + + ); } diff --git a/src/features/products/components/ProductsList.tsx b/src/features/products/components/ProductsList.tsx index d419dc78..101f3b75 100644 --- a/src/features/products/components/ProductsList.tsx +++ b/src/features/products/components/ProductsList.tsx @@ -22,7 +22,7 @@ export function ProductsList() { {products!.map((product) => (
  • Date: Sat, 18 Nov 2023 18:05:17 +0600 Subject: [PATCH 2/3] fix:ui fixes --- .../products/components/DeleteProduct.tsx | 1 + src/features/products/components/Product.tsx | 16 ++++++++++------ .../products/components/ProductsList.tsx | 4 ++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/features/products/components/DeleteProduct.tsx b/src/features/products/components/DeleteProduct.tsx index 61c62c14..8d2bc5cd 100644 --- a/src/features/products/components/DeleteProduct.tsx +++ b/src/features/products/components/DeleteProduct.tsx @@ -24,6 +24,7 @@ export function DeleteProduct({ disabled ? 'bg-red-3 text-red-1' : 'hover:bg-red-6 bg-red-5 text-white ', + 'sm:w-24 md:w-32 lg:w-32 xl:w-32 hidden sm:inline md:inline lg:inline xl:inline', )} disabled={disabled} > diff --git a/src/features/products/components/Product.tsx b/src/features/products/components/Product.tsx index a1401114..57f54e68 100644 --- a/src/features/products/components/Product.tsx +++ b/src/features/products/components/Product.tsx @@ -13,18 +13,22 @@ export function Product({ product, pending, actions }: Props) { <> - - - - + + + - +
    x{product.quantity}{product.name} +
    + x{product.quantity} + + {product.name} + {product.brand} {actions}{actions}
    diff --git a/src/features/products/components/ProductsList.tsx b/src/features/products/components/ProductsList.tsx index 101f3b75..7a82d53e 100644 --- a/src/features/products/components/ProductsList.tsx +++ b/src/features/products/components/ProductsList.tsx @@ -22,7 +22,7 @@ export function ProductsList() { {products!.map((product) => (
  • ))} {variables.map((variable) => ( -
  • +
  • Date: Sat, 18 Nov 2023 20:49:30 +0600 Subject: [PATCH 3/3] feat:add table haeders that still need to be fixed --- tsconfig.node.json => .json | 0 src/features/products/components/Product.tsx | 33 ++++++++----------- .../products/components/ProductsList.tsx | 23 +++++++++---- 3 files changed, 30 insertions(+), 26 deletions(-) rename tsconfig.node.json => .json (100%) diff --git a/tsconfig.node.json b/.json similarity index 100% rename from tsconfig.node.json rename to .json diff --git a/src/features/products/components/Product.tsx b/src/features/products/components/Product.tsx index 57f54e68..820e281a 100644 --- a/src/features/products/components/Product.tsx +++ b/src/features/products/components/Product.tsx @@ -11,26 +11,19 @@ interface Props { export function Product({ product, pending, actions }: Props) { return ( <> - - - - - - - - - +
    - x{product.quantity} - - {product.name} - - {product.brand} - {actions}
    + + + + + +
    + x{product.quantity} + + {product.name} + + {product.brand} + {actions}
    ); diff --git a/src/features/products/components/ProductsList.tsx b/src/features/products/components/ProductsList.tsx index 7a82d53e..3a7bf0a2 100644 --- a/src/features/products/components/ProductsList.tsx +++ b/src/features/products/components/ProductsList.tsx @@ -2,6 +2,7 @@ import { useMutationState } from '@tanstack/react-query'; import { ProductType, useQueryProducts } from '..'; import { DeleteProduct } from './DeleteProduct'; import { Product } from './Product'; +import { twJoin } from 'tailwind-merge'; export function ProductsList() { const query = useQueryProducts(); @@ -18,9 +19,19 @@ export function ProductsList() { <> {query.isLoading &&

    Loading...

    } {query.isSuccess && products!.length > 0 && ( -
      +
      + + + + + + + + + +
      QuantityNameBrandActions
      {products!.map((product) => ( -
    • @@ -28,10 +39,10 @@ export function ProductsList() { product={product} actions={} /> -
    • +
      ))} {variables.map((variable) => ( -
    • +
      } /> -
    • + ))} -
    + )} {query.isError &&

    Error: {query.error?.message}

    }