From 83b0a5cf510702141ccb17a5651ec04e1a36ab6b Mon Sep 17 00:00:00 2001 From: Saad <38024451+sdadn@users.noreply.github.com> Date: Mon, 4 Mar 2024 13:34:41 -0600 Subject: [PATCH] removed comment headers and updated functions --- .../terra-table/src/subcomponents/Cell.jsx | 26 +++++-------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/packages/terra-table/src/subcomponents/Cell.jsx b/packages/terra-table/src/subcomponents/Cell.jsx index 14e3010b7db..4525cf4ff42 100644 --- a/packages/terra-table/src/subcomponents/Cell.jsx +++ b/packages/terra-table/src/subcomponents/Cell.jsx @@ -150,8 +150,6 @@ function Cell(props) { tableId, } = props; - // ----- refs & states variables ----- - const cellRef = useRef(); const theme = useContext(ThemeContext); @@ -163,8 +161,6 @@ function Cell(props) { const isGridContext = gridContext.role === GridConstants.GRID; - // ----- Utility functions ----- - /** * Determine if cell has focusable elements */ @@ -173,12 +169,6 @@ function Cell(props) { return focusableElements.length > 0; }; - useEffect(() => { - if (isGridContext) { - setIsInteractable(hasFocusableElements()); - } - }, [isGridContext]); - /** * * @param {HTMLElement} element - The element to check if it is a text input @@ -217,9 +207,13 @@ function Cell(props) { } }; - // ----- Event handlers ----- + useEffect(() => { + if (isGridContext) { + setIsInteractable(hasFocusableElements()); + } + }, [isGridContext]); - const onMouseDown = ((event) => { + const onMouseDown = (event) => { if (!isFocusTrapEnabled) { onCellSelect({ sectionId, @@ -232,7 +226,7 @@ function Cell(props) { isCellSelectable: (!isMasked && isSelectable), }); } - }); + }; const handleKeyDown = (event) => { const key = event.keyCode; @@ -283,8 +277,6 @@ function Cell(props) { } }; - // ----- Cell content setup ----- - // Create cell content for masked and blank cells let cellContent; if (isMasked) { @@ -328,8 +320,6 @@ function Cell(props) { ); } - // ----- Rendering constants ----- - // Determine table cell header attribute values const cellLeftEdge = (columnIndex < columnContext.pinnedColumnOffsets.length) ? columnContext.pinnedColumnOffsets[columnIndex] : null; const CellTag = isRowHeader ? 'th' : 'td'; @@ -347,8 +337,6 @@ function Cell(props) { blank: !children, }, theme.className); - // ----- Rendering ----- - return (