mirror of
https://github.com/penpot/penpot.git
synced 2025-02-14 11:09:04 -05:00
💄 Change some styles in viewer mode
This commit is contained in:
parent
8285cb8f62
commit
5b658c2f8a
7 changed files with 137 additions and 23 deletions
|
@ -4,6 +4,9 @@
|
||||||
|
|
||||||
### :boom: Breaking changes & Deprecations
|
### :boom: Breaking changes & Deprecations
|
||||||
### :sparkles: New features
|
### :sparkles: New features
|
||||||
|
|
||||||
|
- Add some cosmetic changes in viewer mode [Taiga #3688](https://tree.taiga.io/project/penpot/us/3688)
|
||||||
|
|
||||||
### :bug: Bugs fixed
|
### :bug: Bugs fixed
|
||||||
### :arrow_up: Deps updates
|
### :arrow_up: Deps updates
|
||||||
### :heart: Community contributions by (Thank you!)
|
### :heart: Community contributions by (Thank you!)
|
||||||
|
|
|
@ -19,14 +19,35 @@ $width-settings-bar: 256px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.fullscreen.handoff-layout.force-visible {
|
||||||
|
display: grid;
|
||||||
|
grid-template-rows: 1fr;
|
||||||
|
|
||||||
|
& .viewer-header {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
transition: top 400ms ease 300ms;
|
||||||
|
margin-bottom: 0;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
& .viewer-bottom {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
transition: bottom 400ms ease 300ms;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.fullscreen.handoff-layout:not(.force-visible) {
|
.fullscreen.handoff-layout:not(.force-visible) {
|
||||||
.viewer-header {
|
& .viewer-header {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: -48px;
|
top: -48px;
|
||||||
left: 0;
|
left: 0;
|
||||||
transition: top 400ms ease 300ms;
|
transition: top 400ms ease 300ms;
|
||||||
z-index: 25;
|
z-index: 2;
|
||||||
|
margin-bottom: 48px;
|
||||||
|
|
||||||
&::after {
|
&::after {
|
||||||
content: " ";
|
content: " ";
|
||||||
|
@ -43,7 +64,29 @@ $width-settings-bar: 256px;
|
||||||
transition: top 200ms;
|
transition: top 200ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
.viewer-content {
|
& .viewer-bottom {
|
||||||
|
width: 100%;
|
||||||
|
position: fixed;
|
||||||
|
bottom: -48px;
|
||||||
|
left: 0;
|
||||||
|
transition: bottom 400ms ease 300ms;
|
||||||
|
z-index: 2;
|
||||||
|
&::after {
|
||||||
|
content: " ";
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 1rem;
|
||||||
|
left: 0;
|
||||||
|
bottom: 0px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
& .viewer-bottom:hover {
|
||||||
|
bottom: 0px;
|
||||||
|
transition: bottom 200ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
& .viewer-content {
|
||||||
grid-row: 1 / span 2;
|
grid-row: 1 / span 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,6 +94,7 @@ $width-settings-bar: 256px;
|
||||||
.handoff-layout {
|
.handoff-layout {
|
||||||
.viewer-section {
|
.viewer-section {
|
||||||
flex-wrap: nowrap;
|
flex-wrap: nowrap;
|
||||||
|
margin-top: 0;
|
||||||
&.fullscreen {
|
&.fullscreen {
|
||||||
.settings-bar,
|
.settings-bar,
|
||||||
.settings-bar {
|
.settings-bar {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
.viewer-layout {
|
.viewer-layout {
|
||||||
|
height: 100vh;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-rows: 48px auto;
|
grid-template-rows: 48px auto;
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
|
@ -15,14 +16,34 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.fullscreen.viewer-layout.force-visible {
|
||||||
|
grid-template-rows: 1fr;
|
||||||
|
& .viewer-header {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
transition: top 400ms ease 300ms;
|
||||||
|
margin-bottom: 0;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
& .viewer-bottom {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
transition: bottom 400ms ease 300ms;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.fullscreen.viewer-layout:not(.force-visible) {
|
.fullscreen.viewer-layout:not(.force-visible) {
|
||||||
|
grid-template-rows: 1fr;
|
||||||
& .viewer-header {
|
& .viewer-header {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: -48px;
|
top: -48px;
|
||||||
left: 0;
|
left: 0;
|
||||||
transition: top 400ms ease 300ms;
|
transition: top 400ms ease 300ms;
|
||||||
z-index: 1;
|
z-index: 2;
|
||||||
|
margin-bottom: 48px;
|
||||||
&::after {
|
&::after {
|
||||||
content: " ";
|
content: " ";
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -38,6 +59,28 @@
|
||||||
transition: top 200ms;
|
transition: top 200ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
& .viewer-bottom {
|
||||||
|
width: 100%;
|
||||||
|
position: fixed;
|
||||||
|
bottom: -48px;
|
||||||
|
left: 0;
|
||||||
|
transition: bottom 400ms ease 300ms;
|
||||||
|
z-index: 2;
|
||||||
|
&::after {
|
||||||
|
content: " ";
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 1rem;
|
||||||
|
left: 0;
|
||||||
|
bottom: 0px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
& .viewer-bottom:hover {
|
||||||
|
bottom: 0px;
|
||||||
|
transition: bottom 200ms;
|
||||||
|
}
|
||||||
|
|
||||||
& .viewer-content {
|
& .viewer-content {
|
||||||
grid-row: 1 / span 2;
|
grid-row: 1 / span 2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
grid-template-columns: 45% 10% 45%;
|
grid-template-columns: 45% 10% 45%;
|
||||||
height: 48px;
|
height: 48px;
|
||||||
padding: 0 $size-4 0 55px;
|
padding: 0 $size-4 0 55px;
|
||||||
position: relative;
|
top: 0;
|
||||||
|
position: absolute;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
.viewer-content {
|
.viewer-content {
|
||||||
background-color: black;
|
background-color: black;
|
||||||
|
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-rows: 232px auto;
|
grid-template-rows: 232px auto;
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
|
@ -8,19 +7,19 @@
|
||||||
|
|
||||||
.viewer-section {
|
.viewer-section {
|
||||||
height: calc(100vh - 48px);
|
height: calc(100vh - 48px);
|
||||||
&.fullscreen {
|
|
||||||
height: 100vh;
|
|
||||||
}
|
|
||||||
grid-row: 1 / span 2;
|
grid-row: 1 / span 2;
|
||||||
grid-column: 1 / span 1;
|
grid-column: 1 / span 1;
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex-flow: wrap;
|
flex-flow: wrap;
|
||||||
|
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
|
||||||
|
&.fullscreen {
|
||||||
|
height: 100vh;
|
||||||
|
margin-top: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
& .viewer-go-prev,
|
& .viewer-go-prev,
|
||||||
& .viewer-go-next {
|
& .viewer-go-next {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -28,7 +27,7 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
width: 53px;
|
width: 53px;
|
||||||
|
z-index: 2;
|
||||||
.arrow {
|
.arrow {
|
||||||
display: none;
|
display: none;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
@ -87,6 +86,7 @@
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
&.left-bar {
|
&.left-bar {
|
||||||
width: calc(100% - 512px);
|
width: calc(100% - 512px);
|
||||||
|
|
|
@ -230,6 +230,19 @@
|
||||||
interactions-mode
|
interactions-mode
|
||||||
(:interactions-mode local)
|
(:interactions-mode local)
|
||||||
|
|
||||||
|
click-on-screen
|
||||||
|
(mf/use-callback
|
||||||
|
(fn [event]
|
||||||
|
(let [origin (dom/get-target event)
|
||||||
|
over-section? (dom/class? origin "viewer-section")
|
||||||
|
layout (dom/get-element "viewer-layout")
|
||||||
|
has-force? (dom/class? layout "force-visible")]
|
||||||
|
|
||||||
|
(when over-section?
|
||||||
|
(if has-force?
|
||||||
|
(dom/remove-class! layout "force-visible")
|
||||||
|
(dom/add-class! layout "force-visible"))))))
|
||||||
|
|
||||||
on-click
|
on-click
|
||||||
(mf/use-callback
|
(mf/use-callback
|
||||||
(mf/deps section)
|
(mf/deps section)
|
||||||
|
@ -368,6 +381,7 @@
|
||||||
:handoff-layout (= section :handoff)
|
:handoff-layout (= section :handoff)
|
||||||
:fullscreen fullscreen?)}
|
:fullscreen fullscreen?)}
|
||||||
|
|
||||||
|
[:div.viewer-content
|
||||||
[:& header {:project project
|
[:& header {:project project
|
||||||
:index index
|
:index index
|
||||||
:file file
|
:file file
|
||||||
|
@ -376,8 +390,6 @@
|
||||||
:permissions permissions
|
:permissions permissions
|
||||||
:zoom zoom
|
:zoom zoom
|
||||||
:section section}]
|
:section section}]
|
||||||
|
|
||||||
[:div.viewer-content
|
|
||||||
[:div.thumbnail-close {:on-click #(st/emit! dv/close-thumbnails-panel)
|
[:div.thumbnail-close {:on-click #(st/emit! dv/close-thumbnails-panel)
|
||||||
:class (dom/classnames :invisible (not (:show-thumbnails local false)))}]
|
:class (dom/classnames :invisible (not (:show-thumbnails local false)))}]
|
||||||
[:& thumbnails-panel {:frames frames
|
[:& thumbnails-panel {:frames frames
|
||||||
|
@ -387,7 +399,8 @@
|
||||||
:thumbnail-data (:thumbnails file)}]
|
:thumbnail-data (:thumbnails file)}]
|
||||||
[:section.viewer-section {:id "viewer-section"
|
[:section.viewer-section {:id "viewer-section"
|
||||||
:ref viewer-section-ref
|
:ref viewer-section-ref
|
||||||
:class (if fullscreen? "fullscreen" "")}
|
:class (if fullscreen? "fullscreen" "")
|
||||||
|
:on-click click-on-screen}
|
||||||
(cond
|
(cond
|
||||||
(empty? frames)
|
(empty? frames)
|
||||||
[:section.empty-state
|
[:section.empty-state
|
||||||
|
|
|
@ -22,7 +22,17 @@
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(dom/prevent-default event)
|
(dom/prevent-default event)
|
||||||
(dom/stop-propagation event)
|
(dom/stop-propagation event)
|
||||||
(st/emit! (dv/select-shape (:id frame)))))
|
(st/emit! (dv/select-shape (:id frame)))
|
||||||
|
|
||||||
|
(let [origin (dom/get-target event)
|
||||||
|
over-section? (dom/class? origin "handoff-svg-container")
|
||||||
|
layout (dom/get-element "viewer-layout")
|
||||||
|
has-force? (dom/class? layout "force-visible")]
|
||||||
|
|
||||||
|
(when over-section?
|
||||||
|
(if has-force?
|
||||||
|
(dom/remove-class! layout "force-visible")
|
||||||
|
(dom/add-class! layout "force-visible"))))))
|
||||||
|
|
||||||
(mf/defc viewport
|
(mf/defc viewport
|
||||||
[{:keys [local file page frame index viewer-pagination size]}]
|
[{:keys [local file page frame index viewer-pagination size]}]
|
||||||
|
|
Loading…
Add table
Reference in a new issue