From 0d2ed87d7559291e4af9de66addc1d951b79a61d Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Sat, 1 Mar 2025 11:56:39 -0700 Subject: [PATCH] remove buster list row component --- .../ui/list/BusterList/BusterList.stories.tsx | 15 +++- .../BusterList/BusterListRowComponent.tsx | 76 +++++-------------- 2 files changed, 34 insertions(+), 57 deletions(-) diff --git a/web/src/components/ui/list/BusterList/BusterList.stories.tsx b/web/src/components/ui/list/BusterList/BusterList.stories.tsx index 9a20cd05b..48d7a2694 100644 --- a/web/src/components/ui/list/BusterList/BusterList.stories.tsx +++ b/web/src/components/ui/list/BusterList/BusterList.stories.tsx @@ -49,12 +49,12 @@ const sampleColumns = [ { dataIndex: 'address', title: 'Address', - width: 300 + width: 200 }, { dataIndex: 'email', title: 'Email', - width: 200 + width: 100 }, { dataIndex: 'actions', @@ -79,6 +79,17 @@ const generateSampleRows = (count: number): BusterListRow[] => { email: faker.internet.email() } }); + + if (i === 3) { + rows.push({ + id: 'section1', + data: null, + rowSection: { + title: faker.company.name(), + secondaryTitle: faker.company.catchPhrase() + } + }); + } } // Add a section row in the middle diff --git a/web/src/components/ui/list/BusterList/BusterListRowComponent.tsx b/web/src/components/ui/list/BusterList/BusterListRowComponent.tsx index 42b48a00d..fa9f74509 100644 --- a/web/src/components/ui/list/BusterList/BusterListRowComponent.tsx +++ b/web/src/components/ui/list/BusterList/BusterListRowComponent.tsx @@ -4,8 +4,8 @@ import React, { useMemo } from 'react'; import { BusterListRow, BusterListColumn, BusterListRowItem, BusterListProps } from './interfaces'; import Link from 'next/link'; import { CheckboxColumn } from './CheckboxColumn'; -import { createStyles } from 'antd-style'; import { HEIGHT_OF_ROW } from './config'; +import { cn } from '@/lib/classMerge'; export const BusterListRowComponent = React.memo( React.forwardRef< @@ -38,7 +38,6 @@ export const BusterListRowComponent = React.memo( }, ref ) => { - const { styles, cx } = useStyles(); const link = row.link; const onContextMenu = useMemoizedFn((e: React.MouseEvent) => { @@ -56,20 +55,28 @@ export const BusterListRowComponent = React.memo( row.onClick?.(); }); + const rowStyles = { + height: `${HEIGHT_OF_ROW}px`, + minHeight: `${HEIGHT_OF_ROW}px`, + ...style + }; + return (
{!!onSelectChange ? ( @@ -106,8 +113,6 @@ const BusterListCellComponent: React.FC<{ onSelectChange?: (v: boolean, id: string) => void; render?: (data: string | number | React.ReactNode, row: BusterListRowItem) => React.ReactNode; }> = React.memo(({ data, width, row, render, isFirstCell, isLastCell, onSelectChange }) => { - const { styles, cx } = useStyles(); - const memoizedStyle = useMemo(() => { return { width: width || '100%', @@ -117,9 +122,10 @@ const BusterListCellComponent: React.FC<{ return (
{render ? render(data, row?.data) : data}
@@ -138,43 +144,3 @@ const LinkWrapper: React.FC<{ ); }; - -export const useStyles = createStyles(({ css, token }) => ({ - row: css` - height: ${HEIGHT_OF_ROW}px; - min-height: ${HEIGHT_OF_ROW}px; - border-bottom: 0.5px solid ${token.colorBorder}; - - &.clickable { - cursor: pointer; - - &:hover { - background-color: ${token.controlItemBgHover}; - } - } - - .row-cell { - padding: 0 4px; - display: flex; - align-items: center; - height: 100%; - } - - &.checked { - background-color: ${token.colorPrimaryBg}; - &:hover { - background-color: ${token.colorPrimaryBgHover}; - } - } - `, - cell: css` - color: ${token.colorText}; - font-size: 13px; - @apply text-base; - - &.secondary { - color: ${token.colorTextTertiary}; - @apply text-xs; - } - ` -}));