Skip to content

Commit 9cb1d9c

Browse files
committed
update highlight card for responsiveness
1 parent 46b5aad commit 9cb1d9c

2 files changed

Lines changed: 20 additions & 6 deletions

File tree

web-components/hero-section/hero-section.css

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,17 @@ section {
4242

4343
.hero {
4444
display: grid;
45-
grid-template-columns: 4em 1fr 1fr;
46-
/* grid-template-rows: 4em 4em 6em 1fr; */
45+
grid-template-columns: 4em 1fr;
4746
grid-template-rows: 4em repeat(3, 1fr);
4847
padding: 3em;
4948
padding-top: 2em;
5049
align-items: center;
5150
}
5251

52+
.hero-highlight {
53+
grid-template-columns: 4em 1fr 1fr;
54+
}
55+
5356
.hero-no-buttons {
5457
grid-template-rows: 4em repeat(2, 1fr);
5558
}
@@ -146,7 +149,7 @@ h6, p {
146149
background-color: white;
147150
padding: 2em 3em 2em 3em;
148151
margin: 1em;
149-
opacity: 0.9;
152+
opacity: 0.75;
150153
display: flex;
151154
flex-flow: column wrap;
152155
gap: 1em;
@@ -174,6 +177,10 @@ h6, p {
174177

175178
@media screen and (min-width: 90em) {
176179
.hero {
180+
grid-template-columns: 4em 4fr 1fr;
181+
}
182+
183+
.hero-highlight {
177184
grid-template-columns: 4em 1fr 1fr;
178185
}
179186
}
@@ -186,4 +193,9 @@ h6, p {
186193
gap: 1em;
187194
padding: 3em 2em;
188195
}
196+
197+
.highlight-card {
198+
padding: 2em;
199+
margin: 0;
200+
}
189201
}

web-components/hero-section/hero-section.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ function createComponent(html) {
6161
const shadow = this.attachShadow({mode: 'open'});
6262
shadow.innerHTML = html;
6363

64+
const heroSection = shadow.querySelector('.hero-section');
65+
const hero = shadow.querySelector('.hero');
66+
6467
// Set content
6568
setImage('.image', this.image, shadow);
6669
setContent('.section', this.section, shadow);
@@ -73,17 +76,16 @@ function createComponent(html) {
7376
img.classList.add('large-icon');
7477
}
7578

79+
// Display highlight card if content is provided
7680
if (this.highlight != undefined) {
7781
setContent('.highlight', this.highlight, shadow);
7882
setLink('.highlight-link', this.highlightlink, shadow);
83+
hero.classList.add('hero-highlight');
7984
} else {
8085
const highlightCard = shadow.querySelector('.highlight-card');
8186
highlightCard.style.display = 'none';
8287
}
8388

84-
const heroSection = shadow.querySelector('.hero-section');
85-
const hero = shadow.querySelector('.hero');
86-
8789
// Check if primary button is used
8890
if (this.link != undefined) {
8991
setLink('.button-primary', this.link, shadow);

0 commit comments

Comments
 (0)