Skip to content

Commit

Permalink
💄 Donor Table Styling Fixes for Dropdown Panel (#1983)
Browse files Browse the repository at this point in the history
* Apply `min-height` to table so the panel can be used without scrolling when there isn't enough data
* Prevent table header opacity change when all data is filtered out
  • Loading branch information
mistryrn committed Jul 29, 2021
1 parent daf1546 commit b176ce4
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .storybook/PropTypesTable/ReactTableContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@ export default styled('div')`
border-collapse: collapse;
overflow: auto;
}
.ReactTable.has-filters .rt-table {
opacity: 1 !important;
min-height: 220px;
.rt-tbody .rt-tr-group {
max-height: 28px;
}
}
.ReactTable.has-filters.no-data .rt-table {
margin-bottom: -165px;
border-bottom: none;
}
.ReactTable .rt-thead {
-webkit-box-flex: 1;
-ms-flex: 1 0 auto;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,8 @@ export default ({
onPageSizeChange={onPageSizeChange}
onSortedChange={onSortedChange}
defaultSorted={getDefaultSort(initialSorts)}
// filter panel style workarounds
className={`has-filters${!programDonorSummaryEntries.length ? ' no-data' : ''}`}
/>
</>
)}
Expand Down
11 changes: 11 additions & 0 deletions uikit/Table/reactTableDefaultStyle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@ export default css`
border-collapse: collapse;
overflow: auto;
}
&.ReactTable.has-filters .rt-table {
opacity: 1 !important;
min-height: 220px;
.rt-tbody .rt-tr-group {
max-height: 28px;
}
}
&.ReactTable.has-filters.no-data .rt-table {
margin-bottom: -165px;
border-bottom: none;
}
&.ReactTable .rt-thead {
flex: 1 0 auto;
display: flex;
Expand Down
15 changes: 15 additions & 0 deletions uikit/Table/styledComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,21 @@ export const StyledTable = styled<typeof ReactTable, StyledTableProps>(ReactTabl
&.ReactTable {
border: none;
&.has-filters {
.rt-table {
opacity: 1 !important;
min-height: 220px;
.rt-tbody .rt-tr-group {
max-height: 28px;
}
}
&.no-data {
.rt-table {
margin-bottom: -165px;
border-bottom: none;
}
}
}
& .rt-table {
${({ theme, withOutsideBorder }) =>
withOutsideBorder
Expand Down

0 comments on commit b176ce4

Please sign in to comment.