Skip to content

Commit

Permalink
Enable table headers to be stickied when scrolling (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean committed Jun 5, 2020
1 parent 4af578f commit c39d65c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/components/Table/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,17 +233,10 @@ const Table = () => {
return (
<Container className="table">
<ReactTooltip />
<ReactTable
align="center"
responsive
borderless
striped
hover
{...getTableProps()}
>
<ReactTable align="center" borderless striped hover {...getTableProps()}>
<thead>
{headerGroups.map(headerGroup => (
<tr {...headerGroup.getHeaderGroupProps()}>
<tr className="sticky" {...headerGroup.getHeaderGroupProps()}>
{headerGroup.headers.map(column => (
<th {...column.getHeaderProps()}>
{column.render('Header')}
Expand Down
6 changes: 6 additions & 0 deletions src/components/Table/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
display: none;
}

tr.sticky th {
background: white;
position: sticky;
top: 0;
}

.nav-link {
padding: 0;
}
Expand Down

0 comments on commit c39d65c

Please sign in to comment.