Skip to content

Commit

Permalink
Merge pull request #205 from fedspendingtransparency/mod/10888-dtui-c…
Browse files Browse the repository at this point in the history
…olors-for-prime-awards-columns

10888 - added subawards prop to Table.jsx and TableHeader.jsx; added …
  • Loading branch information
nick-torres authored May 29, 2024
2 parents ca883c0 + c387902 commit e625a40
Show file tree
Hide file tree
Showing 57 changed files with 70 additions and 43 deletions.
11 changes: 10 additions & 1 deletion components/table/Table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ const propTypes = {
screenReaderCaption: PropTypes.string,
onClickHandler: PropTypes.func,
isMobile: PropTypes.bool,
stickyFirstColumn: PropTypes.bool
stickyFirstColumn: PropTypes.bool,
subAward: PropTypes.bool
};

const defaultProps = {
Expand Down Expand Up @@ -107,6 +108,13 @@ const Table = (props) => {
{props.screenReaderCaption && (
<caption className="usa-dt-sr-only">{props.screenReaderCaption}</caption>
)}
{props.subAward
&& (
<colgroup>
<col span={6} />
<col span={2} className="usda-table__body-special-color" />
</colgroup>
)}
<thead className="usda-table__head">
<tr className="usda-table__row" style={{ height: props.headerRowHeight }}>
{props.columns.map((col, index) => (
Expand All @@ -115,6 +123,7 @@ const Table = (props) => {
currentSort={props.currentSort}
updateSort={props.updateSort}
stickyFirstColumn={props.stickyFirstColumn}
subAward={props.subAward}
index={index}
{...col} />
))}
Expand Down
9 changes: 5 additions & 4 deletions components/table/TableData.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ const propTypes = {
onClickHandler: PropTypes.func,
isMobile: PropTypes.bool,
atMaxLevel: PropTypes.bool,
stickyFirstColumn: PropTypes.bool
stickyFirstColumn: PropTypes.bool,
subAward: PropTypes.bool
};

const TableData = ({
Expand All @@ -32,7 +33,8 @@ const TableData = ({
onClickHandler,
isMobile,
atMaxLevel,
stickyFirstColumn = false
stickyFirstColumn = false,
subAward
}) => {
const [firstClick, setFirstClick] = useState(false);
const [rowIndexForMessage, setRowIndexForMessage] = useState();
Expand Down Expand Up @@ -86,8 +88,7 @@ const TableData = ({
localClickHandler(row, i);
}
}}
className={`usda-table__row-item usda-table__row${oddClass}`}
style={{ height: rowHeight }}>
className={`usda-table__row-item usda-table__row${oddClass} ${subAward ? 'special-hover-color' : ''}`} style={{ height: rowHeight }}>
{row.map((data, j) => (
columns[j]?.bodyHeader
? (
Expand Down
6 changes: 4 additions & 2 deletions components/table/TableHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const propTypes = {
bodyHeader: PropTypes.bool,
stickyFirstColumn: PropTypes.bool,
columnWidth: PropTypes.number,
subAward: PropTypes.bool,
index: PropTypes.number
};

Expand All @@ -88,6 +89,7 @@ const TableHeaderCell = ({
bodyHeader = false,
stickyFirstColumn = false,
columnWidth,
subAward,
index
}) => {
const handleClickedSort = (e, sortOn = title) => {
Expand All @@ -101,7 +103,8 @@ const TableHeaderCell = ({
};
return (
<th
className={`${className} table-header${bodyHeader ? ' table-header_body-header' : ''} ${stickyFirstColumn && index === 0 ? ' stickyColumn' : ''} `}
className={`${className} table-header${bodyHeader ? ' table-header_body-header' : ''}
${stickyFirstColumn && index === 0 ? ' stickyColumn' : ''} ${subAward ? 'table-header__subaward-color' : ''} `}
style={{ minWidth: columnWidth }}
colSpan={columnWidth ? '' : columnSpan}
rowSpan={rowsSpan()}
Expand All @@ -124,5 +127,4 @@ const TableHeaderCell = ({
};

TableHeaderCell.propTypes = propTypes;

export default TableHeaderCell;
2 changes: 1 addition & 1 deletion dist/data-transparency-ui.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions docs/211.758cb3ad.iframe.bundle.js

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions docs/211.f0bd0c27.iframe.bundle.js

This file was deleted.

1 change: 0 additions & 1 deletion docs/229.4b90415ecd5b101f001b.manager.bundle.js

This file was deleted.

1 change: 0 additions & 1 deletion docs/229.6d69ce64.iframe.bundle.js

This file was deleted.

1 change: 1 addition & 0 deletions docs/229.df6775d714abc2d29de0.manager.bundle.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/229.f9abf24b.iframe.bundle.js

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions docs/51.12879e96425c0b128042.manager.bundle.js

This file was deleted.

2 changes: 2 additions & 0 deletions docs/51.33304ca29cb8e99bdbad.manager.bundle.js

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions docs/51.62905199.iframe.bundle.js

This file was deleted.

2 changes: 2 additions & 0 deletions docs/51.88af68fd.iframe.bundle.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion docs/551.1ddce1e1.iframe.bundle.js

This file was deleted.

Loading

0 comments on commit e625a40

Please sign in to comment.