refactor: tweak styling

This commit is contained in:
Carlos Valente
2024-12-17 17:06:25 +01:00
committed by Carlos Valente
parent 1bdea8e436
commit 3d37f42fe0
3 changed files with 16 additions and 8 deletions
@@ -33,6 +33,10 @@ $table-header-font-size: calc(1rem - 2px);
.tableHeader, .tableHeader,
.eventRow { .eventRow {
.indexColumn { .indexColumn {
display: flex;
align-items: center;
justify-content: end;
min-width: 3em; // allow for 3-digit numbers min-width: 3em; // allow for 3-digit numbers
text-align: right; text-align: right;
font-weight: 400; font-weight: 400;
@@ -40,10 +44,11 @@ $table-header-font-size: calc(1rem - 2px);
position: sticky; position: sticky;
left: 0; left: 0;
z-index: 1; z-index: 1;
background-color: $gray-1300; background-color: $gray-1300; // will be overridden inline
} }
.actionColumn { .actionColumn {
width: 2rem; width: calc(1.5rem + 0.5rem); // sm button size (--chakra-sizes-6) + 2 * padding
} }
} }
@@ -53,7 +58,8 @@ $table-header-font-size: calc(1rem - 2px);
z-index: 10; z-index: 10;
background-color: $ui-black; background-color: $ui-black;
font-size: $table-header-font-size; font-size: $table-header-font-size;
color: $label-gray;} color: $label-gray;
}
th { th {
background-color: $gray-1300; background-color: $gray-1300;
@@ -1,4 +1,5 @@
import { memo, MutableRefObject, PropsWithChildren, useLayoutEffect, useRef, useState } from 'react'; import { memo, MutableRefObject, PropsWithChildren, useLayoutEffect, useRef, useState } from 'react';
import Color from 'color';
import { cx, getAccessibleColour } from '../../../../common/utils/styleUtils'; import { cx, getAccessibleColour } from '../../../../common/utils/styleUtils';
@@ -18,9 +19,6 @@ function EventRow(props: PropsWithChildren<EventRowProps>) {
const ownRef = useRef<HTMLTableRowElement>(null); const ownRef = useRef<HTMLTableRowElement>(null);
const [isVisible, setIsVisible] = useState(false); const [isVisible, setIsVisible] = useState(false);
const textColour = getAccessibleColour(colour);
const bgColour = textColour.backgroundColor;
useLayoutEffect(() => { useLayoutEffect(() => {
const observer = new IntersectionObserver( const observer = new IntersectionObserver(
([entry]) => { ([entry]) => {
@@ -48,13 +46,16 @@ function EventRow(props: PropsWithChildren<EventRowProps>) {
}; };
}, [ownRef, selectedRef]); }, [ownRef, selectedRef]);
const { color, backgroundColor } = getAccessibleColour(colour);
const mutedText = Color(color).fade(0.4).hexa();
return ( return (
<tr <tr
className={cx([style.eventRow, skip ?? style.skip])} className={cx([style.eventRow, skip ?? style.skip])}
style={{ opacity: `${isPast ? '0.2' : '1'}` }} style={{ opacity: `${isPast ? '0.2' : '1'}` }}
ref={selectedRef ?? ownRef} ref={selectedRef ?? ownRef}
> >
<td className={style.indexColumn} style={{ backgroundColor: bgColour, color: textColour.color }}> <td className={style.indexColumn} style={{ backgroundColor, color: mutedText }}>
{showIndexColumn && eventIndex} {showIndexColumn && eventIndex}
</td> </td>
{isVisible ? children : null} {isVisible ? children : null}
@@ -22,7 +22,8 @@ const MultiLineCell = (props: MultiLineCellProps) => {
inputref={ref} inputref={ref}
rows={1} rows={1}
size='sm' size='sm'
style={{ padding: 0 }} padding={0}
fontSize='1rem'
transition='none' transition='none'
variant='ontime-transparent' variant='ontime-transparent'
value={value} value={value}