Introduce wrapper component for DataGridRow

This commit is contained in:
Robert
2023-10-18 14:12:27 +01:00
parent 56d0f28814
commit cac9efa41b
2 changed files with 17 additions and 3 deletions

View File

@@ -31,7 +31,7 @@ export function DataGrid({ gridTemplateColumns, children }: DataGridProps) {
);
}
export const DataGridRow = styled.div<{ $focused?: boolean }>`
const StyledDataGridRow = styled.div<{ $focused?: boolean }>`
display: contents;
&:hover > * {
@@ -47,6 +47,20 @@ export const DataGridRow = styled.div<{ $focused?: boolean }>`
}
`;
interface DataGridRowProps {
focused?: boolean;
children: React.ReactNode;
ref?: React.Ref<HTMLElement | undefined>;
}
export function DataGridRow({ focused, children, ref }: DataGridRowProps) {
return (
<StyledDataGridRow $focused={focused} ref={ref}>
{children}
</StyledDataGridRow>
);
}
const StyledDataGridCell = styled.div<{
$gridRow?: string | number;
$gridColumn?: string | number;

View File

@@ -160,7 +160,7 @@ const ModelableMethodRow = forwardRef<HTMLElement | undefined, MethodRowProps>(
<DataGridRow
data-testid="modelable-method-row"
ref={ref}
$focused={revealedMethodSignature === method.signature}
focused={revealedMethodSignature === method.signature}
>
<DataGridCell>
<ApiOrMethodRow>
@@ -290,7 +290,7 @@ const UnmodelableMethodRow = forwardRef<
<DataGridRow
data-testid="unmodelable-method-row"
ref={ref}
$focused={revealedMethodSignature === method.signature}
focused={revealedMethodSignature === method.signature}
>
<DataGridCell>
<ApiOrMethodRow>