Removed multiline renderer
This commit is contained in:
parent
6cbdbf61b5
commit
a4b0a915f6
4 changed files with 7 additions and 51 deletions
|
|
@ -1,37 +0,0 @@
|
|||
import React, { useEffect, useRef, useState } from "react";
|
||||
import { cn } from "../../utils/utils";
|
||||
|
||||
const DynamicLineClamp = ({ children, initial, className }) => {
|
||||
const [lineClamp, setLineClamp] = useState(initial);
|
||||
const parentRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const updateLineClamp = () => {
|
||||
if (parentRef.current) {
|
||||
const parentHeight = parentRef.current.clientHeight;
|
||||
const lineHeight = parseFloat(
|
||||
getComputedStyle(parentRef.current).lineHeight,
|
||||
);
|
||||
const lines = Math.floor(parentHeight / lineHeight);
|
||||
setLineClamp(lines);
|
||||
}
|
||||
};
|
||||
|
||||
updateLineClamp();
|
||||
window.addEventListener("resize", updateLineClamp);
|
||||
|
||||
return () => {
|
||||
window.removeEventListener("resize", updateLineClamp);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div ref={parentRef} className="relative">
|
||||
<span className={cn(`line-clamp-${lineClamp}`, className)}>
|
||||
{children}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default DynamicLineClamp;
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
import { CustomCellRendererProps } from "ag-grid-react";
|
||||
|
||||
export default function TableMultilineCellRender({
|
||||
value,
|
||||
}: CustomCellRendererProps) {
|
||||
return (
|
||||
<span className="text-wrap py-2.5 leading-5 truncate-multiline">
|
||||
{value}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
|
@ -27,7 +27,7 @@ const useColumnDefs = (
|
|||
},
|
||||
tooltipField: "display_name",
|
||||
tooltipComponent: TableTooltipRender,
|
||||
cellRenderer: TableMultilineCellRender,
|
||||
wrapText: true,
|
||||
autoHeight: true,
|
||||
flex: 1,
|
||||
resizable: false,
|
||||
|
|
@ -38,7 +38,7 @@ const useColumnDefs = (
|
|||
field: "info",
|
||||
tooltipField: "info",
|
||||
tooltipComponent: TableTooltipRender,
|
||||
cellRenderer: TableMultilineCellRender,
|
||||
wrapText: true,
|
||||
autoHeight: true,
|
||||
flex: 2,
|
||||
resizable: false,
|
||||
|
|
|
|||
|
|
@ -103,6 +103,10 @@ select:-webkit-autofill:focus {
|
|||
|
||||
.ag-row .ag-cell {
|
||||
display: flex;
|
||||
justify-content: center; /* align horizontal */
|
||||
align-items: center;
|
||||
}
|
||||
.ag-cell {
|
||||
line-height: 1.25rem;
|
||||
padding-top: 0.675rem;
|
||||
padding-bottom: 0.675rem;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue