UNPKG

ar-design

Version:

AR Design is a (react | nextjs) ui library.

28 lines (27 loc) • 1.28 kB
import React from "react"; const MemoizedTHeadCell = function ({ columns }) { return (React.createElement(React.Fragment, null, columns.map((c, cIndex) => { let _className = []; if (c.config?.sticky) _className.push(`sticky-${c.config.sticky}`); if (!c.config?.width) _className.push("min-w"); if (c.config?.alignContent) { _className.push(`align-content-${c.config.alignContent}`); } return (React.createElement("th", { key: `column-${cIndex}-${Math.random()}`, ...(_className.length > 0 && { className: `${_className.map((c) => c).join(" ")}`, }), ...(c.config?.width ? { style: { minWidth: c.config.width, maxWidth: c.config.width }, } : // : { style: { maxWidth: thWidths[cIndex], minWidth: thWidths[cIndex] } })} { style: {} }), ...(c.config?.sticky && { "data-sticky-position": c.config.sticky, }) }, React.createElement("span", { style: { fontWeight: 500 } }, c.title))); }))); }; // 👇 React.memo kullanımı sırasında generic tipi koruyoruz const THeadCell = React.memo(MemoizedTHeadCell); export default THeadCell;