Skip to content

Commit c890fd8

Browse files
committed
feat(): replace modalimage with r-i-g
BREAKING CHANGE: modalimage is replaced with react-image-gallery. Squashed commit of the following: commit 56bef69 Author: Anna Baldwin <anna.baldwin21@gmail.com> Date: Wed Jan 5 10:11:42 2022 -0700 fix: fix path of package css commit e72906c Author: Anna Baldwin <anna.baldwin21@gmail.com> Date: Tue Jan 4 16:07:06 2022 -0700 fix: restore changed message background color commit db4b546 Author: Anna Baldwin <anna.baldwin21@gmail.com> Date: Tue Jan 4 15:58:49 2022 -0700 fix: remove modalimage css, add react-image-gallery css commit 7d73339 Merge: 0cb5dfd b9b9ae7 Author: Zachery Converse <zachery.converse@getstream.io> Date: Wed Dec 15 11:34:54 2021 -0700 Merge pull request #26 from GetStream/develop fix(): update button styles
1 parent 7a25283 commit c890fd8

4 files changed

Lines changed: 226 additions & 13 deletions

File tree

src/styles/Modal.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,4 @@
7474
display: flex;
7575
width: 86px;
7676
justify-content: space-between;
77-
}
77+
}

src/styles/ModalImage.scss

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/styles/index.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
@import './vendor/emoji-mart.scss'; // copy from '../../node_modules/emoji-mart/css/emoji-mart.css'
77
@import './vendor/mml-react.scss'; // copy from '../../node_modules/mml-react/dist/styles/index.css'
88
@import './vendor/react-file-utils.scss'; // copy from '../../node_modules/react-file-utils/dist/index.css'
9+
@import './vendor/react-image-gallery.scss'; // copy from '../../node_modules/react-image-gallery/styles/css/image-gallery.css'
910

1011
// Components
1112
@import './ActionsBox.scss';
@@ -38,7 +39,6 @@
3839
@import './MessageLivestream.scss';
3940
@import './MessageRepliesCountButton.scss';
4041
@import './Modal.scss';
41-
@import './ModalImage.scss';
4242
@import './ReactionList.scss';
4343
@import './ReactionSelector.scss';
4444
@import './SendButton.scss';
Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
$ig-small-screen: 768px !default;
2+
$ig-xsmall-screen: 480px !default;
3+
$ig-white: #fff !default;
4+
$ig-black: #000 !default;
5+
$ig-blue: #337ab7 !default;
6+
$ig-background-black: rgba(0, 0, 0, 0.4) !default;
7+
$ig-transparent: rgba(0, 0, 0, 0) !default;
8+
$ig-shadow: 0 2px 2px lighten($ig-black, 10%);
9+
10+
@mixin vendor-prefix($name, $value) {
11+
@each $vendor in ('-webkit-', '-moz-', '-ms-', '-o-', '') {
12+
#{$vendor}#{$name}: #{$value};
13+
}
14+
}
15+
16+
// SVG ICON STYLES
17+
.image-gallery-icon {
18+
color: $ig-white;
19+
transition: all 0.3s ease-out;
20+
appearance: none;
21+
background-color: transparent;
22+
border: 0;
23+
cursor: pointer;
24+
outline: none;
25+
position: absolute;
26+
z-index: 4;
27+
filter: drop-shadow($ig-shadow);
28+
29+
@media (hover: hover) and (pointer: fine) {
30+
&:hover {
31+
color: $ig-blue;
32+
.image-gallery-svg {
33+
transform: scale(1.1);
34+
}
35+
}
36+
}
37+
38+
&:focus {
39+
// a11y support
40+
outline: 2px solid $ig-blue;
41+
}
42+
}
43+
44+
.image-gallery-using-mouse {
45+
.image-gallery-icon {
46+
&:focus {
47+
outline: none;
48+
}
49+
}
50+
}
51+
52+
.image-gallery-fullscreen-button {
53+
bottom: 0;
54+
padding: 20px;
55+
56+
.image-gallery-svg {
57+
height: 28px;
58+
width: 28px;
59+
}
60+
61+
@media (max-width: $ig-small-screen) {
62+
padding: 15px;
63+
64+
.image-gallery-svg {
65+
height: 24px;
66+
width: 24px;
67+
}
68+
}
69+
70+
@media (max-width: $ig-xsmall-screen) {
71+
padding: 10px;
72+
73+
.image-gallery-svg {
74+
height: 16px;
75+
width: 16px;
76+
}
77+
}
78+
}
79+
80+
.image-gallery-fullscreen-button {
81+
right: 0;
82+
}
83+
84+
.image-gallery-left-nav,
85+
.image-gallery-right-nav {
86+
padding: 50px 10px;
87+
top: 50%;
88+
transform: translateY(-50%);
89+
90+
.image-gallery-svg {
91+
height: 120px;
92+
width: 60px;
93+
}
94+
95+
@media (max-width: $ig-small-screen) {
96+
.image-gallery-svg {
97+
height: 72px;
98+
width: 36px;
99+
}
100+
}
101+
102+
@media (max-width: $ig-xsmall-screen) {
103+
.image-gallery-svg {
104+
height: 48px;
105+
width: 24px;
106+
}
107+
}
108+
109+
&[disabled] {
110+
cursor: disabled;
111+
opacity: 0.6;
112+
pointer-events: none;
113+
}
114+
}
115+
116+
.image-gallery-left-nav {
117+
left: 0;
118+
}
119+
120+
.image-gallery-right-nav {
121+
right: 0;
122+
}
123+
// End of Icon styles
124+
125+
.image-gallery {
126+
@include vendor-prefix('user-select', none);
127+
-webkit-tap-highlight-color: $ig-transparent;
128+
position: relative;
129+
130+
&.fullscreen-modal {
131+
background: $ig-black;
132+
bottom: 0;
133+
height: 100%;
134+
left: 0;
135+
position: fixed;
136+
right: 0;
137+
top: 0;
138+
width: 100%;
139+
z-index: 5;
140+
141+
.image-gallery-content {
142+
top: 50%;
143+
transform: translateY(-50%);
144+
}
145+
}
146+
}
147+
148+
.image-gallery-content {
149+
position: relative;
150+
line-height: 0;
151+
top: 0;
152+
153+
&.fullscreen {
154+
background: $ig-black;
155+
}
156+
157+
.image-gallery-slide .image-gallery-image {
158+
max-height: calc(100vh - 80px); // 80 px for the thumbnail space
159+
}
160+
161+
&.left,
162+
&.right {
163+
.image-gallery-slide .image-gallery-image {
164+
max-height: 100vh;
165+
}
166+
}
167+
}
168+
169+
.image-gallery-slide-wrapper {
170+
position: relative;
171+
172+
&.left,
173+
&.right {
174+
display: inline-block;
175+
width: calc(100% - 110px); // 100px + 10px for margin
176+
177+
@media (max-width: $ig-small-screen) {
178+
width: calc(100% - 87px); // 81px + 6px for margin
179+
}
180+
}
181+
&.image-gallery-rtl {
182+
direction: rtl;
183+
}
184+
}
185+
186+
.image-gallery-slides {
187+
line-height: 0;
188+
overflow: hidden;
189+
position: relative;
190+
white-space: nowrap;
191+
text-align: center;
192+
}
193+
194+
.image-gallery-slide {
195+
left: 0;
196+
position: absolute;
197+
top: 0;
198+
width: 100%;
199+
200+
&.center {
201+
position: relative;
202+
}
203+
204+
.image-gallery-image {
205+
width: 100%;
206+
object-fit: contain;
207+
}
208+
}
209+
210+
.image-gallery-index {
211+
background: $ig-background-black;
212+
color: $ig-white;
213+
line-height: 1;
214+
padding: 10px 20px;
215+
position: absolute;
216+
right: 0;
217+
top: 0;
218+
z-index: 4;
219+
220+
@media (max-width: $ig-small-screen) {
221+
font-size: 0.8em;
222+
padding: 5px 10px;
223+
}
224+
}

0 commit comments

Comments
 (0)