Skip to content

Commit

Permalink
fix: remove modalimage css, add react-image-gallery css
Browse files Browse the repository at this point in the history
  • Loading branch information
ambaldwin committed Jan 4, 2022
1 parent 7d73339 commit db4b546
Show file tree
Hide file tree
Showing 5 changed files with 227 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/styles/Message.scss
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@
font-size: var(--lg-font);
color: var(--black);
border-radius: var(--border-radius) var(--border-radius) var(--border-radius) 0;
background: var(--white-snow);
background: pink;
border: 1px solid var(--border);
margin-left: 0; /* set spacing when unfocused */

Expand Down
2 changes: 1 addition & 1 deletion src/styles/Modal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@
display: flex;
width: 86px;
justify-content: space-between;
}
}
11 changes: 0 additions & 11 deletions src/styles/ModalImage.scss

This file was deleted.

2 changes: 1 addition & 1 deletion src/styles/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
@import './vendor/emoji-mart.scss'; // copy from '../../node_modules/emoji-mart/css/emoji-mart.css'
@import './vendor/mml-react.scss'; // copy from '../../node_modules/mml-react/dist/styles/index.css'
@import './vendor/react-file-utils.scss'; // copy from '../../node_modules/react-file-utils/dist/index.css'
@import './vendor/react-image-gallery.scss'; // copy from '../../node_modules/react-image-gallery/dist/index.css'

// Components
@import './ActionsBox.scss';
Expand Down Expand Up @@ -38,7 +39,6 @@
@import './MessageLivestream.scss';
@import './MessageRepliesCountButton.scss';
@import './Modal.scss';
@import './ModalImage.scss';
@import './ReactionList.scss';
@import './ReactionSelector.scss';
@import './SendButton.scss';
Expand Down
224 changes: 224 additions & 0 deletions src/styles/vendor/react-image-gallery.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,224 @@
$ig-small-screen: 768px !default;
$ig-xsmall-screen: 480px !default;
$ig-white: #fff !default;
$ig-black: #000 !default;
$ig-blue: #337ab7 !default;
$ig-background-black: rgba(0, 0, 0, .4) !default;
$ig-transparent: rgba(0, 0, 0, 0) !default;
$ig-shadow: 0 2px 2px lighten($ig-black, 10%);

@mixin vendor-prefix($name, $value) {
@each $vendor in ('-webkit-', '-moz-', '-ms-', '-o-', '') {
#{$vendor}#{$name}: #{$value};
}
}

// SVG ICON STYLES
.image-gallery-icon {
color: $ig-white;
transition: all .3s ease-out;
appearance: none;
background-color: transparent;
border: 0;
cursor: pointer;
outline: none;
position: absolute;
z-index: 4;
filter: drop-shadow($ig-shadow);

@media (hover: hover) and (pointer: fine) {
&:hover {
color: $ig-blue;
.image-gallery-svg {
transform: scale(1.1);
}
}
}

&:focus {
// a11y support
outline: 2px solid $ig-blue;
}
}

.image-gallery-using-mouse {
.image-gallery-icon {
&:focus {
outline: none;
}
}
}

.image-gallery-fullscreen-button {
bottom: 0;
padding: 20px;

.image-gallery-svg {
height: 28px;
width: 28px;
}

@media (max-width: $ig-small-screen) {
padding: 15px;

.image-gallery-svg {
height: 24px;
width: 24px;
}
}

@media (max-width: $ig-xsmall-screen) {
padding: 10px;

.image-gallery-svg {
height: 16px;
width: 16px;
}
}
}

.image-gallery-fullscreen-button {
right: 0;
}

.image-gallery-left-nav,
.image-gallery-right-nav {
padding: 50px 10px;
top: 50%;
transform: translateY(-50%);

.image-gallery-svg {
height: 120px;
width: 60px;
}

@media (max-width: $ig-small-screen) {
.image-gallery-svg {
height: 72px;
width: 36px;
}
}

@media (max-width: $ig-xsmall-screen) {
.image-gallery-svg {
height: 48px;
width: 24px;
}
}

&[disabled] {
cursor: disabled;
opacity: .6;
pointer-events: none;
}
}

.image-gallery-left-nav {
left: 0;
}

.image-gallery-right-nav {
right: 0;
}
// End of Icon styles

.image-gallery {
@include vendor-prefix('user-select', none);
-webkit-tap-highlight-color: $ig-transparent;
position: relative;

&.fullscreen-modal {
background: $ig-black;
bottom: 0;
height: 100%;
left: 0;
position: fixed;
right: 0;
top: 0;
width: 100%;
z-index: 5;

.image-gallery-content {
top: 50%;
transform: translateY(-50%);
}
}
}

.image-gallery-content {
position: relative;
line-height: 0;
top: 0;

&.fullscreen {
background: $ig-black;
}

.image-gallery-slide .image-gallery-image {
max-height: calc(100vh - 80px); // 80 px for the thumbnail space
}

&.left,
&.right {
.image-gallery-slide .image-gallery-image {
max-height: 100vh;
}
}
}

.image-gallery-slide-wrapper {
position: relative;

&.left,
&.right {
display: inline-block;
width: calc(100% - 110px); // 100px + 10px for margin

@media (max-width: $ig-small-screen) {
width: calc(100% - 87px); // 81px + 6px for margin
}
}
&.image-gallery-rtl {
direction: rtl;
}
}

.image-gallery-slides {
line-height: 0;
overflow: hidden;
position: relative;
white-space: nowrap;
text-align: center;
}

.image-gallery-slide {
left: 0;
position: absolute;
top: 0;
width: 100%;

&.center {
position: relative;
}

.image-gallery-image {
width: 100%;
object-fit: contain;
}
}

.image-gallery-index {
background: $ig-background-black;
color: $ig-white;
line-height: 1;
padding: 10px 20px;
position: absolute;
right: 0;
top: 0;
z-index: 4;

@media(max-width: $ig-small-screen) {
font-size: .8em;
padding: 5px 10px;
}
}

0 comments on commit db4b546

Please sign in to comment.