Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
removed comment headers and updated functions
Browse files Browse the repository at this point in the history
  • Loading branch information
sdadn committed Mar 4, 2024
1 parent 41de8bd commit 83b0a5c
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions packages/terra-table/src/subcomponents/Cell.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,6 @@ function Cell(props) {
tableId,
} = props;

// ----- refs & states variables -----

const cellRef = useRef();

const theme = useContext(ThemeContext);
Expand All @@ -163,8 +161,6 @@ function Cell(props) {

const isGridContext = gridContext.role === GridConstants.GRID;

// ----- Utility functions -----

/**
* Determine if cell has focusable elements
*/
Expand All @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -232,7 +226,7 @@ function Cell(props) {
isCellSelectable: (!isMasked && isSelectable),
});
}
});
};

const handleKeyDown = (event) => {
const key = event.keyCode;
Expand Down Expand Up @@ -283,8 +277,6 @@ function Cell(props) {
}
};

// ----- Cell content setup -----

// Create cell content for masked and blank cells
let cellContent;
if (isMasked) {
Expand Down Expand Up @@ -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';
Expand All @@ -347,8 +337,6 @@ function Cell(props) {
blank: !children,
}, theme.className);

// ----- Rendering -----

return (
<CellTag
id={isRowHeader ? `${tableId}-rowheader-${rowId}` : undefined}
Expand Down

0 comments on commit 83b0a5c

Please sign in to comment.