Skip to content

Commit

Permalink
feat(documents): Add drop shadow for document pages and placeholders (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jstoffan authored Apr 29, 2021
1 parent 086752a commit 0a8f089
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 26 deletions.
16 changes: 7 additions & 9 deletions src/lib/viewers/doc/Document.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
left: 0;
margin: 0;
overflow-y: scroll;
background-color: $ffive;
opacity: 1;
transition: opacity .5s;

Expand All @@ -26,16 +27,13 @@
opacity: 0;
}

.bp-preload {
background-color: $ffive;

.bp-theme-dark & {
background-color: $sunset-grey;
}
.bp-theme-dark & {
background-color: $sunset-grey;
}

.bp-preload-content,
.bp-preload-overlay {
.bp-preload-overlay,
.bp-preload-placeholder::before {
position: absolute;
top: 0;
right: 0;
Expand All @@ -52,10 +50,10 @@
}

.bp-preload-placeholder {
@include bp-LoadingGhost;
@include bp-DocGhost;
@include bp-DocShadow;

position: relative;
margin: 15px auto 30px;
overflow: hidden;
}
}
13 changes: 5 additions & 8 deletions src/lib/viewers/doc/Presentation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
bottom: 0;
left: 0;
margin: 0;
background-color: $ffive;
transition: opacity .5s;

&.bp-is-invisible {
Expand All @@ -45,12 +46,8 @@
opacity: 0;
}

.bp-preload {
background-color: $ffive;

.bp-theme-dark & {
background-color: $sunset-grey;
}
.bp-theme-dark & {
background-color: $sunset-grey;
}

.bp-preload-content,
Expand All @@ -72,9 +69,9 @@
}

.bp-preload-placeholder {
@include bp-LoadingGhost;
@include bp-DocGhost;
@include bp-DocShadow;

margin: auto;
overflow: hidden;
}
}
19 changes: 16 additions & 3 deletions src/lib/viewers/doc/_docBase.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import '../../boxuiVariables';
@import './annotations';
@import './loading';
@import './mixins';
@import './theme';

$pdfjs-highlight: #b400aa !default;
Expand Down Expand Up @@ -74,7 +74,7 @@ $thumbnail-sidebar-width: 191px; // Extra pixel to account for sidebar border

.bp-thumbnail:not(.bp-thumbnail-image-loaded) {
.bp-thumbnail-nav {
@include bp-LoadingGhost;
@include bp-DocGhost;
}
}

Expand Down Expand Up @@ -256,6 +256,19 @@ $thumbnail-sidebar-width: 191px; // Extra pixel to account for sidebar border
border: 0;
border-image: none;

// Add shadow to an underlying element to avoid overlapping shadows on canvasWrapper and loadingIcon
&::before {
@include bp-DocShadow;

position: absolute;
top: $pdfjs-page-padding;
right: 0;
bottom: $pdfjs-page-padding;
left: 0;
display: block;
content: '';
}

// Override loading icon styles from pdf.js
.loadingIcon {
top: $pdfjs-page-padding;
Expand All @@ -264,7 +277,7 @@ $thumbnail-sidebar-width: 191px; // Extra pixel to account for sidebar border

// Display the ghost state only if the page does not already have rendered content (e.g. during a resize)
&:first-child {
@include bp-LoadingGhost;
@include bp-DocGhost;
}
}

Expand Down
6 changes: 0 additions & 6 deletions src/lib/viewers/doc/_loading.scss

This file was deleted.

10 changes: 10 additions & 0 deletions src/lib/viewers/doc/_mixins.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@import '~box-ui-elements/es/styles/constants/colors';

@mixin bp-DocGhost {
background: $bdl-gray-10 url('../../icons/loading_ghost.gif') repeat-y;
background-size: 100% 100%;
}

@mixin bp-DocShadow {
box-shadow: 0 4px 12px 0 rgba(0, 0, 0, .1);
}

0 comments on commit 0a8f089

Please sign in to comment.