From 01108c898eed110c5c07cd81d770527cd10f86e7 Mon Sep 17 00:00:00 2001 From: Gabriel Hernandez Date: Mon, 7 Jul 2025 15:32:19 +0100 Subject: [PATCH] redo about card layout to use grid instead of flex (#30547) Fixes [#29696](https://github.com/fleetdm/fleet/issues/29696) This is a more thorough fix for the issue of overflowing data on the about card. The change here is to reimplement the about card layout to use CSS grid instead of flexbox. This handles responsiveness of the data better and is easier to maintain when new data fields are added - [x] Manual QA for all new/changed functionality ## Summary by CodeRabbit * **New Features** * IP address fields in the About card now display tooltips for truncated text, improving readability of long values. * **Style** * Updated the About card layout from flexbox to a responsive grid, enhancing alignment and adaptability across screen sizes. * Adjusted the details panel grid layout to ensure cards remain within their intended width, preventing overflow issues. --- .../details/HostDetailsPage/_styles.scss | 10 ++++- .../pages/hosts/details/cards/About/About.tsx | 9 ++-- .../hosts/details/cards/About/_styles.scss | 44 +++++-------------- 3 files changed, 26 insertions(+), 37 deletions(-) diff --git a/frontend/pages/hosts/details/HostDetailsPage/_styles.scss b/frontend/pages/hosts/details/HostDetailsPage/_styles.scss index 902aeb889e..25376dceac 100644 --- a/frontend/pages/hosts/details/HostDetailsPage/_styles.scss +++ b/frontend/pages/hosts/details/HostDetailsPage/_styles.scss @@ -12,9 +12,15 @@ } @media screen and (min-width: $break-md) { + // This details tab must be selected to use these grid stylings. They are + // irrelevant for the other tabs. &__details-panel.react-tabs__tab-panel--selected { - // Must be selected to show grid - grid-template-columns: repeat(2, 1fr); + // We want the grid to be 2 columns on medium and larger screens and for + // those two columns to always be equal width and take up half the + // available space. We use 50% here instead of 1fr as there were some + // issue with the tooltips in some of the cards forcing the card to be + // wider then half the available space. + grid-template-columns: repeat(2, 50%); } // these are used for positiong the cards in the grid. place these classes diff --git a/frontend/pages/hosts/details/cards/About/About.tsx b/frontend/pages/hosts/details/cards/About/About.tsx index 821664d90b..aa0f21c73d 100644 --- a/frontend/pages/hosts/details/cards/About/About.tsx +++ b/frontend/pages/hosts/details/cards/About/About.tsx @@ -60,14 +60,17 @@ const About = ({ title="Serial number" value={} /> - + } + /> Public IP address } - value={aboutData.public_ip} + value={} /> ); @@ -163,7 +166,7 @@ const About = ({ includeShadow > -
+