Skip to content

Commit

Permalink
Permission Grid: stick the headers to handle a lot of tags (#2887)
Browse files Browse the repository at this point in the history
* sticky thead th & tbody th, adapt PermissionPage and PermissionGrid layout

* adjust height size

* cleanup

* cleanup with some SychO9's recommendation

* remove the `thead th` `first-child` "protection"
  • Loading branch information
Ornanovitch authored Aug 14, 2021
1 parent 2a83022 commit 634dfc6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion js/src/admin/components/PermissionGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default class PermissionGrid extends Component {
<table className="PermissionGrid">
<thead>
<tr>
<td></td>
<th></th>
{scopes.map((scope) => (
<th>
{scope.label}{' '}
Expand Down
26 changes: 25 additions & 1 deletion less/admin/PermissionsPage.less
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@


.PermissionsPage-permissions {
padding: 20px 0 200px;
margin: 20px 0 30px;
overflow-x: auto;
max-height: 75vh;
}

.PermissionGrid {
Expand All @@ -49,19 +50,36 @@
color: @muted-color;
}
thead th {
position: -webkit-sticky;
position: sticky;
top: 0;
padding-bottom: 10px;
text-transform: uppercase;
font-weight: bold;
font-size: 12px;
color: @muted-color;
background: @body-bg;
min-width: 140px;
z-index: 1;

&:first-child {
left: 0;
z-index: 3;
background: @body-bg;
}

&:not(:hover) .PermissionGrid-removeScope {
display: none;
}
}
tbody {
th {
position: -webkit-sticky;
position: sticky;
left: 0;
padding-right: 50px;
z-index: 2;
background: inherit;

.icon {
margin-right: 5px;
Expand Down Expand Up @@ -114,17 +132,23 @@
}
}
.PermissionGrid-section {
background: @body-bg;

td, th {
padding-top: 10px;
}
}
.PermissionGrid-child {
background: @body-bg;

td, th {
position: relative;
z-index: 0;
}
th {
font-weight: normal;
}

&:hover {
background: lighten(@control-bg, 3%);
}
Expand Down

0 comments on commit 634dfc6

Please sign in to comment.