Skip to content

Commit 04c6bc5

Browse files
author
Nikos Katsikanis
committed
transparent button and hero bg option
1 parent dac89ce commit 04c6bc5

File tree

6 files changed

+32
-33
lines changed

6 files changed

+32
-33
lines changed

css/button-badge.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ button,
3636
background-color: var(--minor-text);
3737
}
3838
}
39+
&.transparent {
40+
background-color: transparent;
41+
color: var(--default-text);
42+
border: 1px solid var(--default-text);
43+
&:hover {
44+
color: var(--primary-color);
45+
background-color: var(--default-text);
46+
}
47+
}
3948

4049
&.destructive {
4150
background-color: var(--destructive-color);

js/components/fullscreen-hero.js

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
export default (hostComponent) => {
2-
// Extract data attributes
3-
const imageUrl = hostComponent.getAttribute('data-image-url') || 'https://picsum.photos/1600/900';
4-
const overlayColor = hostComponent.getAttribute('data-overlay-color') || 'rgba(0, 0, 0, 0.5)';
5-
const header = hostComponent.getAttribute('data-header') || 'Welcome';
6-
const text = hostComponent.getAttribute('data-text') || 'Your default hero text here.';
7-
const buttonText = hostComponent.getAttribute('data-button-text') || 'Learn More';
8-
const buttonLink = hostComponent.getAttribute('data-button-link') || '#';
2+
// Extract data attributes
3+
const imageUrl = hostComponent.getAttribute('data-image-url') || 'https://picsum.photos/1600/900';
4+
const overlayColor = hostComponent.getAttribute('data-overlay-color') || 'rgba(0, 0, 0, 0.5)';
5+
const header = hostComponent.getAttribute('data-header') || 'Welcome';
6+
const text = hostComponent.getAttribute('data-text') || 'Your default hero text here.';
7+
const buttonText = hostComponent.getAttribute('data-button-text') || 'Learn More';
8+
const buttonLink = hostComponent.getAttribute('data-button-link') || '#';
9+
const parallax = hostComponent.getAttribute('data-parallax') !== 'false'; // Default to true
910

10-
// Inject HTML
11-
hostComponent.innerHTML = `
11+
// Inject HTML
12+
hostComponent.innerHTML = `
1213
<style>
1314
.hero-container {
1415
position: relative;
@@ -17,7 +18,7 @@ export default (hostComponent) => {
1718
background-image: url('${imageUrl}');
1819
background-size: cover;
1920
background-position: center;
20-
background-attachment: fixed;
21+
background-attachment: ${parallax ? 'fixed' : 'scroll'};
2122
}
2223
.hero-overlay {
2324
position: absolute;
@@ -44,27 +45,15 @@ export default (hostComponent) => {
4445
font-size: 1.125rem;
4546
margin-bottom: 1.5rem;
4647
}
47-
.hero-button {
48-
display: inline-block;
49-
padding: 0.75rem 1.5rem;
50-
border: 2px solid white;
51-
color: white;
52-
text-decoration: none;
53-
font-weight: bold;
54-
border-radius: 5px;
55-
transition: background-color 0.3s, color 0.3s;
56-
}
57-
.hero-button:hover {
58-
background-color: white;
59-
color: #1a202c;
60-
}
48+
49+
6150
</style>
6251
<div class="hero-container">
6352
<div class="hero-overlay"></div>
6453
<div class="hero-content">
6554
<h1 class="hero-header">${header}</h1>
6655
<p class="hero-text">${text}</p>
67-
<a href="${buttonLink}" class="hero-button">${buttonText}</a>
56+
<a href="${buttonLink}" class="button transparent squarify">${buttonText}</a>
6857
</div>
6958
</div>
7059
`;

js/components/nav.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@ export default (hostComponent) => {
6767
6868
/* Non-header-bar-mode specific styles */
6969
nav:not(.header-bar-mode) {
70-
@media (max-width: 399px) {
70+
@media (max-width: 499px) {
7171
.text {
7272
display: none;
7373
}
7474
}
7575
76-
@media (min-width: 400px) {
76+
@media (min-width: 500px) {
7777
.icon {
7878
display: none;
7979
}

js/components/toggle-switch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Stored in /components/toggle-switch.js
1+
// js/components/toggle-switch.js
22

33
export default (hostComponent) => {
44
const render = () => {

js/routes/form.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default (hostComponent) => {
77
<h1>Form</h1>
88
<form class="centered">
99
<h2>Centered class form</h2>
10-
10+
<span data-component="toggle-switch"></span>
1111
<div>
1212
<label for="name">Name</label>
1313
<input type="text" id="name" name="name">

js/routes/heros.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ export default (hostComponent) => {
44
<div data-component="fullscreen-hero"
55
data-image-url="https://picsum.photos/1600/900"
66
data-overlay-color="rgba(0, 0, 0, 0.5)"
7-
data-header="Herzlich willkommen"
8-
data-text="Mit unserer umfassenden Kenntnis des aktuellen Markts..."
9-
data-button-text="Mehr dazu"
10-
data-button-link="/kontakt">
7+
data-header="This is a fullscreen-hero"
8+
data-text="Some text you want to right here"
9+
data-button-text="Add your link url here"
10+
data-button-link="#"
11+
>
1112
</div>
1213
1314
<div data-component="narrow-hero"

0 commit comments

Comments
 (0)