Skip to content

Commit

Permalink
Replicate some style and js functionality from FE setup
Browse files Browse the repository at this point in the history
  • Loading branch information
ericweissman committed Mar 20, 2023
1 parent 6120989 commit a3bd235
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 2 deletions.
37 changes: 35 additions & 2 deletions _sass/content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,43 @@

.note {
@extend %call-to-action-shared;
border-left: 8px solid lighten($back-end-secondary, 25%);
background-color: lighten($back-end-primary, 40%);
border-left: 8px solid lighten($front-end-secondary, 25%);
background-color: lighten($front-end-primary, 40%);
}

.answer {
@extend %call-to-action-shared;
border-left: 8px solid #CCC;

h3 {
cursor: pointer;
}
}

.expander-arrow {
cursor: pointer;
transform: rotate(0deg);
transition: transform 0.2s ease;
height: 15px;
width: 15px;
}

.expander-arrow.expanded {
transform: rotate(90deg);
transition: transform 0.2s ease;
}

.google-form {
border: none;
}

.mod-description {
color: #666;
font-size: 0.9em;
width: 70%;
}

.wide-text {
width: 100%;
font-family: monospace;
}
19 changes: 19 additions & 0 deletions public/js/expander.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

$('.answer h3').each(function(idx, title) {
const titleText = $(title).text();
$(title).replaceWith(`<h3><img class="expander-arrow" src="/assets/images/arrow.svg" alt="expander arrow" /> ${titleText}</h3>`);
});

$('.answer h3').nextAll().hide();

$('.answer h3').on('click', function() {
let arrowEl = $(this).find('img.expander-arrow');

if (!arrowEl.hasClass('expanded')) {
arrowEl.addClass('expanded');
arrowEl.parent('h3').nextAll().show(150);
} else {
arrowEl.removeClass('expanded');
arrowEl.parent('h3').nextAll().hide(150);
}
});

0 comments on commit a3bd235

Please sign in to comment.