Skip to content

Commit 164160e

Browse files
Merge pull request #7283 from kishore08-07/responsive-cards
Fix mobile responsiveness of Related Resources cards
2 parents 59f55e1 + 76abdd8 commit 164160e

2 files changed

Lines changed: 94 additions & 33 deletions

File tree

src/components/Related-Posts/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ const RelatedPosts = props => {
2727
speed= "500"
2828
slidesToShow= {window.innerWidth <= 720 ? 1 : window.innerWidth <= 991 ? 2 : 3}
2929
slidesToScroll= {1}
30+
swipe={true}
31+
swipeToSlide={true}
32+
touchThreshold={10}
3033
>
3134
{
3235
postType === "blogs" ? relatedPosts.map((item) => {

src/components/Related-Posts/relatedPosts.style.js

Lines changed: 91 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,16 @@ const RelatedPostsWrapper = styled.div`
2121
.cardCol{
2222
padding: 0 1rem;
2323
}
24-
@media screen and (max-width: 992px) {
25-
.cardCol{
26-
padding: 0 1rem;
27-
margin: auto;
28-
}
29-
}
3024
3125
.slick-list{
3226
padding-top: 2px;
3327
text-align: center;
3428
}
35-
@media screen and (max-width: 992px) {
36-
.slick-list{
37-
margin: 0;
38-
}
39-
}
4029
4130
.slick-arrow{
4231
width: 4.8rem;
4332
height: 5rem;
33+
z-index: 1;
4434
}
4535
.slick-arrow:before{
4636
color: ${props => props.theme.primaryColor};
@@ -55,15 +45,13 @@ const RelatedPostsWrapper = styled.div`
5545
content: "‹";
5646
line-height: 0;
5747
opacity: 1;
58-
color: ${props => props.theme.primaryColor};
5948
margin-left: -3rem;
6049
}
6150
.slick-next:before{
6251
content: "›";
6352
line-height: 0;
6453
opacity: 1;
6554
margin-left: 2rem;
66-
color: ${props => props.theme.primaryColor};
6755
}
6856
.slick-disabled{
6957
visibility: hidden;
@@ -96,26 +84,6 @@ const RelatedPostsWrapper = styled.div`
9684
height: 22rem;
9785
}
9886
99-
@media screen and (min-width: 1200px) {
100-
.post-content-block {
101-
height: 8rem;
102-
}
103-
104-
.allBlogs{
105-
height: 19.5rem;
106-
}
107-
}
108-
109-
@media screen and (max-width: 720px) and (min-width: 385px){
110-
.post-content-block{
111-
height: 8rem;
112-
}
113-
114-
.allBlogs{
115-
height: 19.5rem;
116-
}
117-
}
118-
11987
.allBlogs_card{
12088
display: inline-block;
12189
height: inherit;
@@ -155,6 +123,96 @@ const RelatedPostsWrapper = styled.div`
155123
}
156124
}
157125
}
126+
127+
@media screen and (min-width: 721px) and (max-width: 992px) {
128+
.cardCol{
129+
padding: 0 1rem;
130+
margin: auto;
131+
}
132+
.slick-list{
133+
margin: 0;
134+
}
135+
}
136+
137+
@media screen and (min-width: 1200px) {
138+
.post-content-block {
139+
height: 8rem;
140+
}
141+
142+
.allBlogs{
143+
height: 19.5rem;
144+
}
145+
}
146+
147+
@media screen and (max-width: 720px) {
148+
.cardCol{
149+
padding: 0 0.75rem;
150+
margin: auto;
151+
width: 100%;
152+
}
153+
154+
.slick-list{
155+
margin: 0;
156+
padding: 2px 0;
157+
overflow: hidden;
158+
}
159+
.slick-track {
160+
display: flex;
161+
align-items: stretch;
162+
}
163+
.slick-slide {
164+
height: auto;
165+
> div {
166+
height: 100%;
167+
}
168+
}
169+
170+
.slick-arrow{
171+
width: 3rem;
172+
height: 4rem;
173+
}
174+
.slick-arrow:before{
175+
font-size: 4rem;
176+
}
177+
178+
.slick-prev:before{
179+
margin-left: -1.5rem;
180+
}
181+
182+
.slick-next:before{
183+
margin-left: 1rem;
184+
}
185+
186+
.slick-dots {
187+
bottom: -35px;
188+
padding: 0;
189+
margin: 0;
190+
}
191+
.slick-dots li {
192+
margin: 0 4px;
193+
}
194+
.slick-dots li button:before {
195+
font-size: 0.8rem;
196+
}
197+
198+
.post-content-block{
199+
height: 8rem;
200+
}
201+
202+
.allBlogs{
203+
height: 19.5rem;
204+
}
205+
}
206+
207+
@media screen and (max-width: 384px){
208+
.post-content-block{
209+
height: 10rem;
210+
}
211+
212+
.allBlogs{
213+
height: 22rem;
214+
}
215+
}
158216
`;
159217

160218

0 commit comments

Comments
 (0)