From 4b20f8036316a58b61a3eea85afea53cb054bd66 Mon Sep 17 00:00:00 2001 From: Oliver Chang Date: Wed, 6 Apr 2022 12:11:47 +1000 Subject: [PATCH] V2: Vulnerability details page fixes. - Various wrapping fixes to make this render better on mobile. - Make tab bar collapse on mobile, and when the package list is too long. - Render events properly. - Add links to schema documentation. - Work around spicy-sections bug. --- gcp/appengine/frontend3/src/styles.scss | 68 +++++++++++++++-- .../src/templates/vulnerability.html | 76 ++++++++++++++----- gcp/appengine/frontend_handlers.py | 53 +++++++++++++ 3 files changed, 171 insertions(+), 26 deletions(-) diff --git a/gcp/appengine/frontend3/src/styles.scss b/gcp/appengine/frontend3/src/styles.scss index 2f8a9f830bb..c338378f272 100644 --- a/gcp/appengine/frontend3/src/styles.scss +++ b/gcp/appengine/frontend3/src/styles.scss @@ -360,8 +360,16 @@ mwc-icon-button.mdc-data-table__sort-icon-button { /** Vulnerability page */ -.vulnerability-page .title { - font-size: 60px; +.vulnerability-page { + .title { + font-size: $osv-heading-size; + } + + @media (max-width: 500px) { + .title { + font-size: $osv-heading-size-mobile; + } + } } dl.vulnerability-details, @@ -382,6 +390,7 @@ dl.vulnerability-details, pre { white-space: pre-wrap; + overflow: auto; } .links { @@ -389,11 +398,28 @@ dl.vulnerability-details, display: flex; flex-direction: column; gap: 10px; + overflow-wrap: break-word; } } .vulnerability-packages-container { - margin-top: 80px; + margin-top: 50px; + + .title { + margin-left: 20px; + font-size: 24px; + margin-bottom: 16px; + font-weight: bold; + } + + // Tab bar styling. + --const-mq-affordances: + [screen and (max-width: 500px) ] collapse | + [screen and (min-width: 501px) ] tab-bar; + + .force-collapse { + --const-mq-affordances: [screen] collapse; + } } .vulnerability-packages { @@ -410,10 +436,38 @@ dl.vulnerability-details, font-size: 20px; } - // Tab bar styling. - --const-mq-affordances: - [screen] tab-bar - ; + .version-value { + font-family: $osv-heading-font-family; + } + + .events { + gap: 4px; + } + + .spicy-sections-workaround { + // https://github.com/tabvengers/spicy-sections/issues/64. + pointer-events: none; + } + + &[affordance="collapse"] h2 { + .vuln-ecosystem { + display: inline; + font-weight: bold; + text-transform: uppercase; + } + .vuln-name { + display: inline; + font-weight: normal; + } + + &[expanded] { + background: #fff; + color: $osv-accent-color; + } + + width: 100%; + } + &[affordance="tab-bar"] h2 { cursor: default; diff --git a/gcp/appengine/frontend3/src/templates/vulnerability.html b/gcp/appengine/frontend3/src/templates/vulnerability.html index 8b4ec3f99d0..7c7724d06b1 100644 --- a/gcp/appengine/frontend3/src/templates/vulnerability.html +++ b/gcp/appengine/frontend3/src/templates/vulnerability.html @@ -17,7 +17,7 @@

{{ vulnerability.id }}

Modified
{{ vulnerability.modified }}
Details
-
{{ vulnerability.details }}
+
{{ vulnerability.details }}
References