Skip to content

Commit

Permalink
Complete landing page [docs]
Browse files Browse the repository at this point in the history
  • Loading branch information
bboonstra committed Oct 21, 2024
1 parent c4b12ec commit 970972b
Show file tree
Hide file tree
Showing 6 changed files with 400 additions and 48 deletions.
Empty file added docs/docs/docs.css
Empty file.
83 changes: 83 additions & 0 deletions docs/home.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
html,
body {
height: 100%; /* Ensure the body takes full height */
overflow: hidden; /* Prevent default scrolling */
}

.section {
height: 100vh; /* Each section takes full viewport height */
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
scroll-snap-align: start; /* Align sections for snapping */
padding: 20px;
text-align: center;
}

.section * {
max-width: 80%;
}

.section h2 {
font-size: 2rem;
margin-bottom: 1rem;
}

.section p {
font-size: 1.2rem;
margin: 0.5rem 0;
}

.section ul {
list-style-type: none;
padding: 0;
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
}

.section ul li {
font-size: 1.1rem;
margin: 0.5rem 0;
text-align: center;
width: 100%;
}

.cta-button {
background-color: var(--background-color);
color: var(--text-color);
padding: 10px 20px;
text-decoration: none;
border-radius: 5px;
transition: background-color 0.3s;
}

.cta-button:hover {
background-color: color-mix(in srgb, var(--hover-color) 80%, var(--effortless-white));
}

.arrow {
font-size: 2rem;
color: var(--primary-color);
cursor: pointer;
position: fixed;
z-index: 1000;
opacity: 0;
transition: opacity 0.3s ease, color 0.3s ease;
}
.up-arrow {
top: 90px;
left: 50%;
transform: translateX(-50%);
}
.down-arrow {
bottom: 20px;
left: 50%;
transform: translateX(-50%);
}

.show {
opacity: 1;
}
108 changes: 108 additions & 0 deletions docs/home.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
document.addEventListener("templateConstructed", function () {
const sections = document.querySelectorAll(".section");
const upArrow = document.getElementById("upArrow");
const downArrow = document.getElementById("downArrow");
let currentSection = 0;
let isScrolling = false;
let scrollTimer = null;

function updateSectionColors() {
sections.forEach((section, index) => {
section.style.backgroundColor =
index % 2 === 0
? "var(--background-color)"
: "var(--effortless-blue)";
});
}

function updateArrowColors() {
var currentSectionColor = getComputedStyle(sections[currentSection]).backgroundColor;
var backgroundColorHex = getComputedStyle(document.documentElement).getPropertyValue("--background-color").trim();
var backgroundColorRgb = hexToRgb(backgroundColorHex);
console.log(currentSectionColor);
var arrowColor = currentSectionColor === backgroundColorRgb
? "var(--primary-color)"
: "var(--background-color)";

upArrow.style.color = arrowColor;
downArrow.style.color = arrowColor;
}

function updateArrowVisibility() {
upArrow.classList.toggle("show", currentSection > 0);
downArrow.classList.toggle("show", currentSection < sections.length - 1);
}

function scrollToSection(index) {
if (index < 0 || index >= sections.length || isScrolling) return;

sections[index].scrollIntoView({ behavior: "smooth" });
isScrolling = true;
setTimeout(() => {
isScrolling = false;
currentSection = index;
updateArrowVisibility();
updateArrowColors();
}, 750);
}

function handleScroll(direction) {
const newSection = currentSection + direction;
scrollToSection(newSection);
}

function queueScroll(direction) {
if (!scrollTimer) {
handleScroll(direction);
}
clearTimeout(scrollTimer);
scrollTimer = setTimeout(() => {
scrollTimer = null;
}, 50);
}

window.addEventListener("wheel", (event) => {
const direction = event.deltaY > 0 ? 1 : -1;
queueScroll(direction);
});

let touchStartY = 0;
window.addEventListener("touchstart", (event) => {
touchStartY = event.touches[0].clientY;
});

window.addEventListener("touchmove", (event) => {
const touchEndY = event.touches[0].clientY;
const difference = touchStartY - touchEndY;
if (Math.abs(difference) > 50) {
const direction = difference > 0 ? 1 : -1;
queueScroll(direction);
}
});

window.addEventListener("keydown", (event) => {
if (event.key === "ArrowUp") {
handleScroll(-1);
} else if (event.key === "ArrowDown") {
handleScroll(1);
}
});

upArrow.addEventListener("click", () => handleScroll(-1));
downArrow.addEventListener("click", () => handleScroll(1));
updateSectionColors();
setTimeout(() => {
updateArrowVisibility();
updateArrowColors();
}, 750);
});

// Helper function to convert hex to rgb
function hexToRgb(hex) {
hex = hex.replace(/^#/, "");
var bigint = parseInt(hex, 16);
var r = (bigint >> 16) & 255;
var g = (bigint >> 8) & 255;
var b = bigint & 255;
return `rgb(${r}, ${g}, ${b})`;
}
44 changes: 41 additions & 3 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,50 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Effortless - Home</title>
<link rel="stylesheet" href="styles.css">
<link rel="stylesheet" href="home.css">
<script src="templating.js"></script>
<script src="home.js"></script>
</head>
<body>
<main>
<div class="arrow up-arrow" id="upArrow">&#8593;</div> <!-- Up arrow -->
<div class="section" id="section1">
<img src="./images/bannerlogotextright.png" alt="Effortless Logo" class="banner-logo">
<h1 class="effortless">Databases should be <i>Effortless</i>.</h1>
</main>
<h1 class="feature">Databases should be <i>Effortless</i>.</h1>
</div>
<div class="section" id="section2">
<h2>What is Effortless?</h2>
<p>Effortless is a user-friendly database solution designed to simplify data management for everyone. It's a powerful tool that makes working with databases accessible to beginners while providing advanced features for experienced developers.</p>
</div>
<div class="section" id="section3">
<h2>Why Choose Effortless?</h2>
<p>Effortless stands out from other database solutions for several reasons:</p>
<ul>
<li><strong>Simplicity:</strong> With an intuitive interface, Effortless makes database management straightforward for users of all skill levels.</li>
<li><strong>Flexibility:</strong> Whether you're working on a small project or a complex application, Effortless adapts to your needs.</li>
<li><strong>Security:</strong> Your data is protected with automatic backups and optional encryption features.</li>
<li><strong>Powerful Querying:</strong> Find exactly what you need with our advanced filtering system.</li>
</ul>
</div>
<div class="section" id="section4">
<h2>Who Can Benefit from Effortless?</h2>
<p>Effortless is designed for a wide range of users, including:</p>
<ul>
<li><strong>Students:</strong> Learn database concepts with a gentle learning curve.</li>
<li><strong>Educators:</strong> Teach database management without the complexity of traditional systems.</li>
<li><strong>Developers:</strong> Rapidly prototype ideas and manage data for small to medium-sized projects.</li>
<li><strong>Data Analysts:</strong> Quickly store, retrieve, and analyze data sets.</li>
<li><strong>Small Business Owners:</strong> Manage customer information, inventory, or other business data easily.</li>
</ul>
</div>
<div class="section" id="section5">
<h2>Getting Started</h2>
<p>Getting started with Effortless is simple. While it's primarily a Python library, its concepts can be understood by anyone interested in data management. For those ready to dive in, Effortless can be installed and set up in just a few minutes.</p>
</div>
<div class="section" id="section6">
<h2>Join the Effortless Community</h2>
<p>Become part of the growing Effortless community. Share your experiences, ask questions, and contribute to the development of this innovative database solution.</p>
<a href="https://github.com/bboonstra/Effortless" class="cta-button">Get Involved</a>
</div>
<div class="arrow down-arrow" id="downArrow">&#8595;</div> <!-- Down arrow -->
</body>
</html>
Loading

0 comments on commit 970972b

Please sign in to comment.