Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lucascumsille committed Oct 3, 2024
1 parent 81b00a3 commit 49aaaf5
Show file tree
Hide file tree
Showing 5 changed files with 899 additions and 23 deletions.
71 changes: 71 additions & 0 deletions www/docs/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,77 @@ function wrap_error($message){
return '<div class="donate-form__error-wrapper"><p class="donate-form__error">' + $message + '</p></div>';
}

function createAccordion(triggerSelector, contentSelector) {
var triggers = document.querySelectorAll(triggerSelector);

triggers.forEach(function(trigger) {
var content = document.querySelector(trigger.getAttribute('href'));

var openAccordion = function() {
content.style.maxHeight = content.scrollHeight + "px"; // Dynamically calculate height
content.setAttribute('aria-hidden', 'false');
trigger.setAttribute('aria-expanded', 'true');
};

var closeAccordion = function() {
content.style.maxHeight = null; // Collapse
content.setAttribute('aria-hidden', 'true');
trigger.setAttribute('aria-expanded', 'false');
};

trigger.addEventListener('click', function(e) {
e.preventDefault();

if (content.style.maxHeight) {
closeAccordion();
} else {
openAccordion();
}
});

// Accessibility
trigger.setAttribute('aria-controls', content.getAttribute('id'));
trigger.setAttribute('aria-expanded', 'false');
content.setAttribute('aria-hidden', 'true');
content.style.maxHeight = null;
});
}

// Initialize accordion when DOM is loaded
document.addEventListener('DOMContentLoaded', function() {
createAccordion('.accordion-button', '.accordion-content');
});

// Create alert form
$(document).ready(function() {
let currentStep = 0;
let steps = $(".alert-step");

// Show the first step
$(steps[currentStep]).show();

// Focus management: Set focus to the first input on each step change
function focusFirstInput(stepIndex) {
$(steps[stepIndex]).find('input, button').first().focus();
}

// Next button click
$(".next").click(function() {
$(steps[currentStep]).hide();
currentStep++;
$(steps[currentStep]).show();
focusFirstInput(currentStep); // Set focus to the first input of the new step
});

// Previous button click
$(".prev").click(function() {
$(steps[currentStep]).hide();
currentStep--;
$(steps[currentStep]).show();
focusFirstInput(currentStep); // Set focus to the first input of the new step
});
});

$(function() {

$('#how-often-annually').click(function() {
Expand Down
57 changes: 35 additions & 22 deletions www/docs/style/sass/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@
@import url(https://fonts.googleapis.com/css2?family=Manrope:wght@700&family=Merriweather:wght@400;700&display=swap);
/* Foundation Icons v 3.0 MIT License */
@font-face {
font-family: "foundation-icons";
src: url("/style/foundation-icons/foundation-icons.woff") format("woff");
font-weight: normal;
font-style: normal;
font-family: "foundation-icons";
src: url("/style/foundation-icons/foundation-icons.woff") format("woff");
font-weight: normal;
font-style: normal;
}

.fi-social-facebook:before,
Expand All @@ -75,17 +75,23 @@
.fi-megaphone:before,
.fi-pound:before,
.fi-magnifying-glass:before,
.fi-heart:before
.fi-heart:before,
.fi-plus:before,
.fi-pause:before,
.fi-trash:before,
.fi-page-edit:before,
.fi-x:before,
.fi-save:before
{
font-family: "foundation-icons";
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
display: inline-block;
text-decoration: inherit;
font-family: "foundation-icons";
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
display: inline-block;
text-decoration: inherit;
}

// https://github.com/zurb/foundation-icon-fonts/blob/master/_foundation-icons.scss
Expand All @@ -97,6 +103,12 @@
.fi-pound:before {content: "\f19a"}
.fi-magnifying-glass:before {content: "\f16c"}
.fi-heart:before { content: "\f159"; }
.fi-plus:before { content: "\f199"; }
.fi-pause:before { content: "\f191"; }
.fi-trash:before { content: "\f204"; }
.fi-page-edit:before { content: "\f184"; }
.fi-x:before { content: "\f217"; }
.fi-save:before { content: "\f1ac"; }

html,
body {
Expand Down Expand Up @@ -129,13 +141,13 @@ h3 {
}

.pull-right {
@media (min-width: $medium-screen) {
@media (min-width: $medium-screen) {
float: right;
margin-left: 1em;
}
}
.pull-left {
@media (min-width: $medium-screen) {
@media (min-width: $medium-screen) {
float: left;
margin-left: 1em;
}
Expand Down Expand Up @@ -166,12 +178,12 @@ ul {
a {
overflow-wrap: break-word;
word-wrap: break-word;

-webkit-hyphens: auto;
-moz-hyphens: auto;
-ms-hyphens: auto;
hyphens: auto;

-moz-hyphens: auto;
-ms-hyphens: auto;
hyphens: auto;
color: $links;
}

Expand All @@ -198,7 +210,7 @@ a:focus {
// for .button elements!!
vertical-align: -0.4em;
}

&.tertiary {
@include button-style($bg: $links);
}
Expand Down Expand Up @@ -231,6 +243,7 @@ form {

@import "parts/panels";
@import "parts/promo-banner";
@import "parts/accordion";

@import "pages/mp";
@import "pages/topics";
Expand Down
Loading

0 comments on commit 49aaaf5

Please sign in to comment.