Skip to content

Commit

Permalink
feat(data-grid): update styles to align with new Paste Twilio theme (#…
Browse files Browse the repository at this point in the history
…3089)

* feat(data-grid): update styles to align with new Paste Twilio theme

* fix: shorted the sticky header story for vrt

* fix: updated selected row styles

* chore: selected rows in selectable data grid story for VRT
  • Loading branch information
SiTaggart committed Mar 17, 2023
1 parent bce8893 commit bba742e
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 7 deletions.
6 changes: 6 additions & 0 deletions .changeset/silver-horses-reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@twilio-paste/data-grid': patch
'@twilio-paste/core': patch
---

[data-grid] Update styles to align with new Paste Twilio theme.
4 changes: 2 additions & 2 deletions packages/paste-core/components/data-grid/src/table/Td.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ export const Td = React.forwardRef<HTMLTableCellElement, TdProps>(
borderBottomWidth="borderWidth10"
fontSize="fontSize30"
lineHeight="lineHeight30"
paddingY="space40"
paddingX="space50"
padding="space50"
position="relative"
textAlign={textAlign}
verticalAlign="inherit"
wordWrap="break-word"
color="inherit"
_first={{
paddingLeft: 'space50',
}}
Expand Down
1 change: 1 addition & 0 deletions packages/paste-core/components/data-grid/src/table/Th.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const Th = React.forwardRef<HTMLTableCellElement, ThProps>(
position="relative"
textAlign={textAlign}
verticalAlign="inherit"
color="inherit"
_first={{
paddingLeft: 'space50',
}}
Expand Down
5 changes: 2 additions & 3 deletions packages/paste-core/components/data-grid/src/table/Tr.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ export interface TrProps {
const StyledTr = styled.tr<TrProps>(
css({
'&[aria-selected=true] > td': {
borderColor: 'colorBorderWeak',
borderColor: 'colorBorderPrimaryWeaker',
},
'&[aria-selected=true] > th': {
borderColor: 'colorBorderWeak',
borderColor: 'colorBorderPrimaryWeaker',
},
})
);
Expand All @@ -33,7 +33,6 @@ export const Tr = React.forwardRef<HTMLTableRowElement, TrProps>(
as={StyledTr}
aria-selected={props.selected}
_even={{backgroundColor: striped ? 'colorBackgroundRowStriped' : 'transparent'}}
_last={{borderWidth: 'borderWidth0'}}
_selected={{
backgroundColor: 'colorBackgroundPrimaryWeakest',
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,18 @@ const CheckboxCell: React.FC<React.PropsWithChildren<CheckboxCellProps>> = ({
export const SelectableRowsDataGrid = (): JSX.Element => {
const seed = useUIDSeed();
// Array of length 10 rows, all unchecked
const [checkedItems, setCheckedItems] = React.useState([...new Array(10)].map(() => false));
const [checkedItems, setCheckedItems] = React.useState([
false,
true,
false,
false,
true,
true,
false,
false,
false,
false,
]);

const allChecked = checkedItems.every(Boolean);
const indeterminate = checkedItems.some(Boolean) && !allChecked;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const StickyHeaderDataGrid: React.FC<React.PropsWithChildren<{element?: B
</DataGridRow>
</DataGridHead>
<DataGridBody data-testid="data-grid-body" element={`${element}_BODY`}>
{[...new Array(50).keys()].map((rowIndex) => (
{[...new Array(20).keys()].map((rowIndex) => (
<DataGridRow key={`row-${rowIndex}`} data-testid="data-grid-row" element={`${element}_ROW`}>
<DataGridCell element={`${element}_CELL`} key="col-0" data-testid="data-grid-cell">
content
Expand Down

0 comments on commit bba742e

Please sign in to comment.