penpot/frontend/src/app/main/ui/viewer.scss
Eva Marco 48a5875a71
♻️ Use DS icon buttons in the viewer board navigation (#12527)
* ♻️ Use DS icon buttons in the viewer board navigation

The previous, next and first board buttons of the viewer become
secondary DS icon buttons with the DS arrow and reload icons. They keep
their size and the viewer background at rest; on hover they take the DS
secondary look. The first board button had no accessible name; it is
now labelled. The position classes move to the tooltip wrappers, so the
fullscreen and comments sidebar offsets still apply.

New key: viewer.go-to-first-board (en, es). A visual test covers the
buttons at rest and on hover.

AI-assisted-by: claude-opus-5-5

* ♻️ Move viewer styles off the deprecated styles

Spacing, sizes, borders, typographies and color aliases move to DS
tokens and logical properties, and the file no longer imports
refactor/. The section scrollbar uses the DS custom-scrollbar mixin; the
text selection and placeholder styles that %new-scrollbar gave to the
comments layer stay, with DS tokens of the same value. An invalid
padding-right with four values, which the browser ignored, is gone.

The DS body-small typography differs from the old one only in a more
compact line-height, so the board counter sits 1px higher. The z-index
values (10, 2) have no DS token and keep a TODO. The .viewer-header,
.not-fixed, .fixed and .frame-children rules are not used by this module
and are commented out with a TODO.

AI-assisted-by: claude-opus-5-5

* 🔥 Remove unused styles from the viewer

The SCSS refactor of the viewer left rules commented out with a TODO
because the module does not use them, or because they target an svg
inside a DS icon that is the svg itself. CSS modules scope the classes
to this module and no other source uses them, so they go:
.viewer-header, .not-fixed, .fixed, .frame-children g. No visual change.

AI-assisted-by: claude-opus-5-5
2026-10-26 12:48:43 +01:00

233 lines
4.8 KiB
SCSS

// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Copyright (c) KALEIDOS SUBSIDIARY SL
@use "ds/_borders.scss" as *;
@use "ds/_sizes.scss" as *;
@use "ds/_utils.scss" as *;
@use "ds/mixins.scss" as *;
@use "ds/typography.scss" as *;
.viewer-layout {
block-size: 100vh;
display: grid;
grid-template-rows: $sz-48 auto;
grid-template-columns: 1fr;
user-select: none;
}
.viewer-content {
overflow: hidden;
grid-row: 2 / span 1;
display: grid;
grid-template-rows: $sz-252 auto;
grid-template-columns: 1fr;
background-color: var(--color-background-secondary);
}
.empty-state {
@include use-typography("body-small");
color: var(--color-foreground-secondary);
display: grid;
place-items: center;
block-size: 100%;
inline-size: 100%;
}
.inspect-layout {
display: grid;
grid-template-rows: $sz-48 auto;
grid-template-columns: 1fr;
block-size: 100vh;
margin-block-start: 0;
user-select: none;
}
.thumbnails-close {
border: none;
background: none;
cursor: pointer;
grid-row: 1 / span 2;
grid-column: 1 / span 1;
// TODO: no DS z-index token for 10; it keeps the backdrop above the
// viewer content (z-index 2), level with the thumbnails panel.
z-index: 10;
background-color: var(--color-overlay-default);
}
.thumbnails-close.invisible {
display: none;
}
.viewer-section {
@include custom-scrollbar($include-selection: false, $include-placeholder: false);
grid-row: 1 / span 2;
grid-column: 1 / span 1;
display: flex;
align-items: center;
flex-wrap: wrap;
block-size: calc(100vh - #{$sz-48});
overflow: auto;
// The comments layer renders inside the section: its text selection and
// placeholders keep the styles they had.
::selection {
background: var(--color-accent-background-select);
color: var(--color-static-white);
}
::placeholder {
@include use-typography("body-small");
color: var(--color-foreground-secondary);
}
}
.inspect-layout .viewer-section {
flex-wrap: nowrap;
margin-block-start: 0;
block-size: 100%;
overflow: hidden;
}
// Tooltip wrappers of the previous and next buttons.
.viewer-go-prev,
.viewer-go-next {
position: absolute;
inset-inline-end: var(--sp-s);
inset-block-start: calc(50vh - #{$sz-32});
// TODO: no DS z-index token for 2; it keeps the controls above the
// viewer section.
z-index: 2;
transition: transform 400ms ease 300ms;
}
.viewer-go-button {
--button-height: #{$sz-64};
--button-bg-color: var(--color-background-primary);
--button-border-color: var(--color-background-tertiary);
}
.viewer-go-next.comment-sidebar {
inset-inline-end: #{px2rem(280)};
}
.viewer-go-prev {
inset-inline-start: var(--sp-s);
inset-inline-end: unset;
}
.viewer-bottom {
position: fixed;
inset-block-end: 0;
display: flex;
align-items: flex-start;
justify-content: space-between;
inline-size: 100%;
block-size: $sz-40;
transition: transform 400ms ease 300ms;
// TODO: no DS z-index token for 2; it keeps the controls above the
// viewer section.
z-index: 2;
pointer-events: none;
}
.reset-button-wrapper {
margin-inline-start: var(--sp-s);
}
.reset-button {
--button-width: #{$sz-28};
--button-bg-color: var(--color-background-primary);
--button-border-color: var(--color-background-tertiary);
pointer-events: all;
}
.counter {
@include use-typography("body-small");
display: flex;
justify-content: center;
align-items: center;
border-radius: $br-8;
inline-size: $sz-64;
block-size: $sz-32;
color: var(--color-foreground-secondary);
background-color: var(--color-background-primary);
}
.viewer-wrapper {
position: relative;
margin: 0 auto;
}
.viewer-clipper {
display: grid;
grid-template-rows: 1fr;
grid-template-columns: 1fr;
place-items: center center;
overflow: hidden;
}
.viewer-overlay-background {
position: absolute;
inset-block-start: 0;
inset-inline-start: 0;
&.visible {
background-color: rgb(0 0 0 / 0.2);
}
}
.viewer-overlay {
position: absolute;
}
.viewport-container {
clip-path: inset(0 0 0 0);
grid-column: 1 / 1;
grid-row: 1 / 1;
}
/** FULLSCREEN */
[data-fullscreen="true"] .viewer-bottom {
transform: translateY($sz-40);
}
[data-force-visible="true"] .viewer-bottom {
transform: translateY(0);
}
[data-fullscreen="true"] .viewer-go-next {
transform: translateX($sz-40);
}
[data-fullscreen="true"] .viewer-go-prev {
transform: translateX(-#{$sz-40});
}
[data-fullscreen="true"] .viewer-content {
transform: translateY(-#{$sz-48});
block-size: 100vh;
}
[data-fullscreen="true"] .viewer-section {
block-size: 100vh;
}
[data-force-visible="true"] .viewer-go-next {
transform: translateX(0);
}
[data-force-visible="true"] .viewer-go-prev {
transform: translateX(0);
}