Skip to content

Commit

Permalink
fix: refactor accordion content (#1391)
Browse files Browse the repository at this point in the history
* fix: refactor accordion content

* style: reduce mobile padding below faq accordion

Co-authored-by: orun <orun@agencyundone.com>
  • Loading branch information
joannaong and orvn authored Jun 10, 2022
1 parent 29f45ca commit 1817d3b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@
// ///////////////////////////////////////////////////////// Accordion [Content]
// -----------------------------------------------------------------------------
.accordion-content {
position: relative;
transition: height 150ms ease-in-out;
&.measuring-content {
position: absolute;
visibility: hidden;
z-index: -1000px;
}
max-height: 0;
padding: 0 1em;
transition: all 0.35s;
}

.accordion-section.open .accordion-content {
max-height: 100vh;
padding: 1em;
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useRouter } from 'next/router';
import React, { useState, useEffect, useRef } from 'react';
import clsx from 'clsx';
import ZeroAccordionHeader from 'ZeroComponents/accordion/accordionHeader';
import ZeroAccordionContent from 'ZeroComponents/accordion/accordionContent';

/**
* @param {any} props TODO: Define props
Expand Down Expand Up @@ -36,7 +35,6 @@ const generateUID = () => {
function AccordionSection({ active, toggle, toggleOnLoad, reportUID, slug, disabled, children }) {
const [uid, setUID] = useState(generateUID);
const [openOnNavigate, setopenOnNavigate] = useState(false);
const firstUpdate = useRef(true);
const router = useRouter();
const header = children.find(child => child.type === Header);
const content = children.find(child => child.type === Content);
Expand Down Expand Up @@ -71,10 +69,7 @@ function AccordionSection({ active, toggle, toggleOnLoad, reportUID, slug, disab
>
{header ? header.props.children : null}
</ZeroAccordionHeader>

<ZeroAccordionContent uid={uid} toggle={toggle} open={open} toggleOnLoad={openOnNavigate || toggleOnLoad}>
{content ? content.props.children : null}
</ZeroAccordionContent>
<div className="accordion-content">{content ? content.props.children : null}</div>
</div>
);
}
Expand Down
3 changes: 3 additions & 0 deletions packages/website/pages/faq.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
z-index: 1;
padding-top: 6.5rem;
padding-bottom: 20rem;
@include tiny {
padding-bottom: 8rem;
}
.accordion-block {
a {
color: #3c3cd6;
Expand Down

0 comments on commit 1817d3b

Please sign in to comment.