fleet/frontend/components/TableContainer/DataTable/_styles.scss
jacobshandling 17979b07bc
UI – Update software table loading state (#20982)
## #20535 


~https://github.com/user-attachments/assets/4c39bd5d-3d75-46f0-9f39-05ec36dac0d0~

### Improved solution:

**Flow**:

![Screenshot-2024-08-19-at-114948A](https://github.com/user-attachments/assets/03de39c1-1436-49bd-a077-d73b248dcdfe)

**Just loading state:**
<img width="1617" alt="Screenshot 2024-08-19 at 11 50 18 AM"
src="https://github.com/user-attachments/assets/df429956-0699-4e73-a017-4022013ccce4">

****

- [x] Changes file added for user-visible changes in `changes/`
- [x] Manual QA for all new/changed functionality

---------

Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
2024-08-21 13:12:42 -07:00

373 lines
8.2 KiB
SCSS
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

$shadow-width: 40px;
$shadow-transition-width: 10px;
.data-table-block {
position: relative;
display: inline-block;
width: 100%;
.data-table {
&__wrapper {
position: relative;
border: 1px solid $ui-fleet-black-10;
border-radius: 6px;
margin-top: $pad-small;
flex-grow: 1;
width: 100%;
// Shadow
background-image:
/* Shadows */ linear-gradient(
to right,
white,
$transparent
),
linear-gradient(to left, white, $transparent),
/* Shadow covers */
linear-gradient(to right, $ui-shadow, white $shadow-transition-width),
linear-gradient(to left, $ui-shadow, white $shadow-transition-width);
background-position: left center, right center, left center, right center;
background-repeat: no-repeat;
background-color: white;
background-size: $shadow-width 100%, $shadow-width 100%, 50% 100%,
50% 100%;
/* Opera doesn't support this in the shorthand */
background-attachment: local, local, scroll, scroll;
// End shadow
}
// applied to same element as data-table__table while loading
&__no-rows {
min-height: 272px;
}
&__table {
position: relative;
width: 100%;
border-collapse: collapse;
color: $core-fleet-black;
font-size: $x-small;
}
tr {
border-bottom: 1px solid $ui-fleet-black-10;
&:last-child {
border-bottom: 0;
}
// override styles of checkbox data cells
.form-field--checkbox {
display: flex;
justify-content: center;
margin-bottom: 0;
.fleet-checkbox__label {
padding-left: 0;
}
}
}
thead {
background-color: $ui-off-white-opaque; // opaque needed for horizontal scroll shadow
color: $core-fleet-black;
text-align: left;
border-bottom: 1px solid $ui-fleet-black-10;
// resize header icons
img {
width: 16px;
height: 16px;
vertical-align: top;
}
// do not resize button icons inside headers
.button {
img {
width: initial;
height: initial;
vertical-align: initial;
}
}
th {
padding: $pad-medium $pad-large;
white-space: nowrap;
border-right: 1px solid $ui-fleet-black-10;
font-weight: $bold;
&:first-child {
border-top-left-radius: 6px;
}
&.selection__header {
width: 22px;
padding: $pad-medium;
}
&:last-child {
border-right: none;
border-top-right-radius: 6px;
}
.column-header {
span {
display: flex;
align-items: center;
gap: 3px;
}
}
}
&.active-selection {
background: none;
z-index: 1;
th {
border: 0;
}
.fleet-checkbox {
opacity: 0;
}
.active-selection__container {
background-color: $ui-off-white;
width: 100% !important; // Too much specificity currently at page-level styling. Revisit after data table CSS update to remove !important.
.active-selection__inner {
justify-content: flex-start;
}
}
}
}
.active-selection {
position: absolute;
top: 0px;
width: 100%;
border: 0;
border-radius: 6px;
&__checkbox {
padding: 16px;
width: 20px;
}
&__container {
padding: 0 24px;
}
&__inner {
display: flex;
justify-content: space-between;
align-items: center;
p {
margin: 0 $pad-medium 0 0;
font-weight: $regular;
span {
font-weight: $bold;
}
}
button {
margin-right: $pad-medium;
}
}
&__inner-left,
&__inner-right {
display: flex;
align-items: center;
}
}
tbody {
.component__tooltip-wrapper {
margin: 10px 0; // vertical padding multiline text with tooltip
}
.component__tooltip-wrapper__element {
white-space: initial; // wraps long text with tooltip
}
tr,
.single-row {
transition: background-color 150ms ease-out;
&:hover {
background-color: $ui-off-white-opaque; // opaque needed for horizontal scroll shadow
}
}
.single-row {
&:hover {
cursor: pointer;
}
&:active {
background-color: $ui-vibrant-blue-10-opaque; // opaque needed for horizontal scroll shadow
}
}
td {
height: 40px;
padding: 0 $pad-large;
max-width: 500px;
word-wrap: break-word;
&.linkToFilteredHosts__cell {
text-align: right;
}
&.selection__cell {
width: 0px;
padding: 0 $pad-medium;
}
.link-cell,
.text-cell {
display: block; // inline-block is not vertically centered
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
margin: 0;
.__react_component_tooltip {
white-space: normal;
}
}
.link-cell {
padding: $pad-small 0; // larger clickable area
&:hover {
text-decoration: underline;
}
> div {
display: block;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
// css to properly style link-cell with tooltip
.link-cell-tooltip-wrapper {
overflow: visible; // fixes tooltip overflow cut off by cell
white-space: nowrap; // single line
margin: 0; // padding applied to .link-cell for larger clickable area
.component__tooltip-wrapper {
&__element {
display: block;
white-space: nowrap; // single line
text-overflow: ellipsis; // truncates text
overflow: hidden;
// TODO this naming is now confusing, as this .link-cell is not the outermost layer of
// the cell it's a NameCell
.link-cell {
padding: 0;
}
}
&__tip-text {
cursor: auto;
}
}
}
.w400 {
max-width: calc(400px - 48px);
min-width: 100%;
text-align: left;
}
.w250 {
max-width: calc(250px - 48px);
min-width: 100%;
text-align: left;
}
.italic-cell {
font-style: italic;
.__react_component_tooltip {
font-style: normal;
}
}
.grey-cell {
color: $ui-fleet-black-50;
}
}
.disable-highlight:hover {
background-color: initial;
}
}
}
.loading-overlay {
display: flex;
flex-grow: 1;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: rgba(255, 255, 255, 0.8);
z-index: 1;
}
&__pagination {
display: flex;
justify-content: flex-end;
margin-top: $pad-small;
margin-bottom: $pad-small;
margin-left: auto;
text-align: right;
button {
color: $core-vibrant-blue;
padding: 6px;
font-weight: $bold;
.fleeticon-chevronleft {
margin-right: $pad-small;
&:before {
font-size: 0.6rem;
font-weight: $bold;
position: relative;
top: -1px;
}
}
.fleeticon-chevronright {
margin-left: $pad-small;
&:before {
font-size: 0.6rem;
font-weight: $bold;
position: relative;
top: -1px;
}
}
}
button:hover,
button:focus {
background-color: $ui-vibrant-blue-10;
}
.button--disabled:hover,
.button--disabled:focus {
background-color: transparent;
}
button:last-child {
margin-left: $pad-large;
}
}
&__footer {
display: flex;
align-items: center;
}
&__table-help-text {
font-size: $x-small;
display: flex;
align-items: center;
}
}