fleet/frontend/components/TableContainer/DataTable/TruncatedTextCell/_styles.scss
Gabriel Hernandez 9f3331ef94
Fix word wrapping on TruncatedTextCell tooltip (#12567)
relates to #12473

Fixes ui bug where the wrapping text on a tooltip in TruncatedTextCell
did not display properly. I fixed this by adding a prop to the component
`tooltipBreakOnWord` which allows devs to configure if the tooltip
breaks on a word, or by default on any character.

**Breaking on a word:**


![image](https://github.com/fleetdm/fleet/assets/1153709/1e3488fd-0051-4bed-8597-e4249a654da3)

**Breaking on any character (default behaviour):**


![image](https://github.com/fleetdm/fleet/assets/1153709/cbb9481f-5cab-4c9b-873a-2343721ebdfe)

- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Manual QA for all new/changed functionality
2023-06-29 17:04:25 +01:00

57 lines
1.1 KiB
SCSS

.truncated-cell {
.text-muted {
color: $ui-fleet-black-50;
}
.data-table__truncated-text {
&--cell {
display: inline-block;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
max-width: 101%;
}
.truncated {
display: inline-block;
max-width: 100%;
// Removes secondary unstyled tooltip created by browser
&::after {
content: "";
display: block;
}
}
}
// allows for the tooltip text to break on a word instead of a character
&.tooltip-break-on-word {
.truncated-tooltip {
word-break: normal
}
}
// Responsive design overrides react-tooltip width that overflows off screen
.truncated-tooltip {
max-width: 300px;
word-break: break-all;
overflow-wrap: break-word;
display: block;
white-space: pre-wrap;
.safari-hack {
height: 0px;
}
}
@media (min-width: $break-990) {
.truncated-tooltip {
max-width: 400px;
}
}
@media (min-width: $break-1400) {
.truncated-tooltip {
max-width: 800px;
}
}
}