All files / src/components/grid_cells/GridCell GridCell.tsx

0% Statements 0/16
0% Branches 0/9
0% Functions 0/2
0% Lines 0/16

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42                                                                                   
import React from "react";
import "./GridCell.css";
import { Link } from "react-router-dom";
import { guidGenerator } from "@/util/id";
 
export class GridCellProps {
  key: string = guidGenerator();
  classes: string[] = [];
  component: React.ReactNode = null;
  href: string | null = null;
  min_height: number | null = null;
  max_height: number | null = null;
 
  constructor(
    classes: string[] = [],
    component: React.ReactNode = null,
    href: string | null = null,
    min_height: number | null = null,
    max_height: number | null = null
  ) {
    this.classes = classes;
    this.component = component;
    this.href = href;
    this.min_height = min_height;
    this.max_height = max_height;
  }
}
 
const GridCell: React.FC<GridCellProps> = (cell) => {
  let classes = "";
  if (cell.classes.length > 0) {
    classes += cell.classes.join(" ");
  }
  return (
    <Link to={cell.href ?? ""} className={classes}>
      {cell.component}
    </Link>
  );
};
 
export default GridCell;