refactor: extract edit element in table

This commit is contained in:
Carlos Valente
2024-12-20 12:39:49 +01:00
committed by Carlos Valente
parent 2fc4e6da16
commit c445c42f8a
4 changed files with 28 additions and 26 deletions
@@ -23,8 +23,8 @@ export default function CuesheetHeader(props: CuesheetHeaderProps) {
return (
<tr key={headerGroup.id}>
<th className={style.indexColumn}>{showIndexColumn && '#'}</th>
<th className={style.actionColumn} />
<th className={style.indexColumn}>{showIndexColumn && '#'}</th>
<SortableContext key={key} items={headerGroup.headers} strategy={horizontalListSortingStrategy}>
{headerGroup.headers.map((header) => {
const width = header.getSize();
@@ -1,4 +1,6 @@
import { memo, MutableRefObject, PropsWithChildren, useLayoutEffect, useRef, useState } from 'react';
import { IconButton, MenuButton } from '@chakra-ui/react';
import { IoEllipsisHorizontal } from '@react-icons/all-files/io5/IoEllipsisHorizontal';
import Color from 'color';
import { cx, getAccessibleColour } from '../../../../common/utils/styleUtils';
@@ -55,6 +57,15 @@ function EventRow(props: PropsWithChildren<EventRowProps>) {
style={{ opacity: `${isPast ? '0.2' : '1'}` }}
ref={selectedRef ?? ownRef}
>
<td className={style.actionColumn}>
<MenuButton
as={IconButton}
size='sm'
aria-label='Options'
icon={<IoEllipsisHorizontal />}
variant='ontime-subtle'
/>
</td>
<td className={style.indexColumn} style={{ backgroundColor, color: mutedText }}>
{showIndexColumn && eventIndex}
</td>