From c04d9fc80a02c83314d7dd546eda38e5d70e6a3e Mon Sep 17 00:00:00 2001 From: luizakp Date: Mon, 19 Aug 2024 15:18:39 -0300 Subject: [PATCH 1/2] chore: if image doesn't exist, show value --- .../DataTable/SWRDataTable/index.tsx | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/components/DataTable/SWRDataTable/index.tsx b/src/components/DataTable/SWRDataTable/index.tsx index a0bffc8..f22343f 100644 --- a/src/components/DataTable/SWRDataTable/index.tsx +++ b/src/components/DataTable/SWRDataTable/index.tsx @@ -115,14 +115,18 @@ export const renderDataTableCell = ({ filters, column, row, selectedRows }) => { case "actions": return ; case "image": - if (!row.getValue("image")?.url) return null; - return ( - {row.getValue("name")} - ); + const image = row.getValue("image") || value; + if (image?.url){ + return ( + {image.alt_text} + ); + } else { + return
{value}
; + } case "link": // eslint-disable-next-line no-case-declarations const url = row.getValue("details_url"); From 6e5e41bd29def1949e00191e62f95e35a25dae6b Mon Sep 17 00:00:00 2001 From: luizakp Date: Mon, 19 Aug 2024 15:28:40 -0300 Subject: [PATCH 2/2] chore: fix lint --- src/components/DataTable/SWRDataTable/index.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/DataTable/SWRDataTable/index.tsx b/src/components/DataTable/SWRDataTable/index.tsx index f22343f..1d7322a 100644 --- a/src/components/DataTable/SWRDataTable/index.tsx +++ b/src/components/DataTable/SWRDataTable/index.tsx @@ -115,8 +115,9 @@ export const renderDataTableCell = ({ filters, column, row, selectedRows }) => { case "actions": return ; case "image": + // eslint-disable-next-line no-case-declarations const image = row.getValue("image") || value; - if (image?.url){ + if (image?.url) { return ( { alt={image.alt_text} /> ); - } else { - return
{value}
; } + return
{value}
; + case "link": // eslint-disable-next-line no-case-declarations const url = row.getValue("details_url");