Skip to content

Commit ea71ba2

Browse files
Merge pull request #7386 from KhushamBansal/fix/layout-in-mobile-view
fix: CTA FullWidth responsiveness on mobile devices
2 parents c46f53a + 35ca9d8 commit ea71ba2

File tree

1 file changed

+32
-23
lines changed
  • src/components/Call-To-Actions/CTA_FullWidth

1 file changed

+32
-23
lines changed

src/components/Call-To-Actions/CTA_FullWidth/index.js

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,33 +27,30 @@ const CTA_FullWidthWrapper = styled.div`
2727
}
2828
2929
.cta-content {
30-
padding: 0.5rem;
30+
padding: 2rem;
3131
display: flex;
3232
flex: auto;
3333
text-align: center;
3434
align-items: center;
3535
height: 100%;
3636
3737
div {
38-
flex: 0 0 75%;
38+
flex: 1;
39+
padding-right: 1rem;
3940
}
4041
4142
p {
4243
margin-top: 0.5rem;
4344
}
45+
4446
a {
45-
flex: 0 0 25%;
47+
flex: 0 0 auto;
4648
}
4749
}
4850
4951
@media screen and (max-width: 1200px) {
5052
.cta-content {
51-
div {
52-
flex: 0 0 65%;
53-
}
54-
a {
55-
flex: 0 0 35%;
56-
}
53+
padding: 1rem;
5754
}
5855
}
5956
@@ -64,31 +61,43 @@ const CTA_FullWidthWrapper = styled.div`
6461
}
6562
6663
@media screen and (max-width: 699px) {
67-
display: block;
64+
display: flex;
65+
flex-direction: column;
6866
width: 18rem;
69-
height: 18rem;
67+
height: auto;
7068
margin: 1.5rem auto;
7169
border-radius: 0.25rem;
7270
7371
img {
74-
width: 18rem;
75-
height: 18rem;
76-
position: absolute;
77-
opacity: 0.35;
78-
border-radius: 0.25rem;
72+
width: 100%;
73+
height: auto;
74+
object-fit: cover;
75+
border-radius: 0.25rem 0.25rem 0 0;
7976
}
8077
8178
.cta-content {
82-
position: absolute;
83-
height: 18rem;
84-
display: block;
85-
width: 18rem;
86-
background: none;
87-
padding: 4rem 1rem;
79+
display: flex;
80+
flex-direction: column;
81+
justify-content: center;
82+
align-items: center;
83+
width: 100%;
84+
padding: 1.5rem 1rem;
85+
box-sizing: border-box;
86+
87+
div {
88+
flex: none;
89+
width: 100%;
90+
padding-right: 0;
91+
}
8892
8993
p {
9094
color: white;
9195
}
96+
97+
a {
98+
flex: none;
99+
margin-top: 1rem;
100+
}
92101
}
93102
}
94103
`;
@@ -100,7 +109,7 @@ const defaultURL = "https://slack.layer5.io";
100109
const CTA_FullWidth = ({ alt, button_text, category, content, external_link, image, url, heading, ...props }) => {
101110
return (
102111
<CTA_FullWidthWrapper {...props}>
103-
{ category ? (
112+
{category ? (
104113
<>
105114
<img src={Categories[category]["Image"]} alt={Categories[category]["Image_Alt"]} />
106115
<div className="cta-content">

0 commit comments

Comments
 (0)