Skip to content

Commit

Permalink
feat: add accordion component
Browse files Browse the repository at this point in the history
  • Loading branch information
pataruco committed Jan 18, 2025
1 parent 0e06f99 commit c7e3cdf
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 136 deletions.
60 changes: 0 additions & 60 deletions website/src/app/[lang]/register-a-patient/page-body.module.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@use '@styles/layout';
@use '@styles/breakpoints';
@use '@styles/text-styles';
@use '@styles/icons';

.page-layout {
padding: var(--spacing-6) var(--spacing-16) var(--spacing-24);
Expand Down Expand Up @@ -114,62 +113,3 @@
display: none;
}
}

.accordion {
background-color: var(--background-accent-navy);
padding: 0 var(--spacing-6);

&:first-of-type {
border-top-right-radius: var(--border-radius-xl);
border-top-left-radius: var(--border-radius-xl);
}

&:last-of-type {
border-bottom-right-radius: var(--border-radius-xl);
border-bottom-left-radius: var(--border-radius-xl);
}

&:not(:first-of-type) summary {
border-block-start: 1px solid var(--border-default);
}

&[open] summary {
&::after {
background-image: url(icons.$chevron-up-navy);
}
}

summary {
@include text-styles.header-3;
padding: var(--spacing-6) 0;
cursor: pointer;
display: flex;
justify-content: space-between;
align-items: center;
&::marker,
&::-webkit-details-marker {
display: none;
content: '';
}

&::after {
aspect-ratio: 1 / 1;
background-image: url(icons.$chevron-down-navy);
background-position: center;
background-size: contain;
content: '';
display: block;
width: var(--spacing-5);
}
}

& > div {
padding-block-end: var(--spacing-6);
& p:last-of-type {
margin-block-end: 0;
}
& li:last-of-type {
margin-block-end: 0;
}
}
}
114 changes: 38 additions & 76 deletions website/src/app/[lang]/register-a-patient/page-body.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import styles from './page-body.module.scss';

import Accordion from '@components/accordion';
import PageContents from '@components/page-contents';
import PageLatestNews from '@components/page-latest-news';
import SignupForm from '@components/signup-form';
Expand Down Expand Up @@ -173,82 +174,43 @@ const RegisterPageBody: React.FC<RegisterPageBodyProps> = async ({ lang }) => {
>
{registerPatientRegistryLoginLink?.content}
</a>
<details className={styles.accordion}>
<summary>Who can take part?</summary>
<div>
<p>
Parents or carers of a confirmed BBSOAS patient or BBSOAS
patients themselves. By confirmed we mean with a genetic
report showing the diagnosis.
</p>
</div>
</details>
<details className={styles.accordion}>
<summary>Who will have access to the data?</summary>
<div>
<p>
Only a few study administrators have access to patient
identifying data. The patient or carer owns their own data.
They can share it with whoever they want, including doctors,
teachers, other carers, etc. if useful.
</p>
<p>Anonymous data is accessed by:</p>
<ul>
<li>
The NR2F1 Foundation - limited to whose working on Patient
Registry 
</li>
<li>COMBINEDBrain - our scientific partner</li>
<li>
Subject to approval by the NR2F1 Foundation - researchers
and industry who are working on BBSOAS studies
</li>
<li>Matrix - the company behind the Patient Registry tool</li>
</ul>
</div>
</details>
<details className={styles.accordion}>
<summary>
Other than filling out surveys, how else can I use Patient
Registry?
</summary>
<div>
<p>
Patient Registry can also be used as a personal health
monitoring tool. It has features that make managing daily
medical care easier.
</p>
</div>
</details>
<details className={styles.accordion}>
<summary>
What languages is Matrix and the surveys available in?
</summary>
<div>
<p>
Matrix is available in English, Spanish, Italian, French,
German, Portuguese and Korean. Surveys are available in
English, Spanish, Italian, French and German. Coming soon:
Portuguese, Korean and Hebrew.
</p>
</div>
</details>
<details className={styles.accordion}>
<summary>
Who can I contact about the Patient Registry for more help or
answers?
</summary>
<div>
<p>
Email{' '}
<a href="mailto:[email protected]">
[email protected]
</a>{' '}
and we can help or offer a Zoom meeting to help you get
registered.
</p>
</div>
</details>

<Accordion
title={whoContactAccordion?.title ?? ''}
content={documentToReactComponents(
whoContactAccordion?.content?.json,
)}
/>
<Accordion
title={whoCanTakePartAccordion?.title ?? ''}
content={documentToReactComponents(
whoCanTakePartAccordion?.content?.json,
)}
/>
<Accordion
title={whoWillHaveAccessAccordion?.title ?? ''}
content={documentToReactComponents(
whoWillHaveAccessAccordion?.content?.json,
)}
/>
<Accordion
title={otherThanFillSurveysAccordion?.title ?? ''}
content={documentToReactComponents(
otherThanFillSurveysAccordion?.content?.json,
)}
/>
<Accordion
title={matrixLanguagesAccordion?.title ?? ''}
content={documentToReactComponents(
matrixLanguagesAccordion?.content?.json,
)}
/>
<Accordion
title={whoCanTakePartAccordion?.title ?? ''}
content={documentToReactComponents(
whoCanTakePartAccordion?.content?.json,
)}
/>
</section>

<section>
Expand Down
61 changes: 61 additions & 0 deletions website/src/components/accordion/index.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
@use '@styles/icons';
@use '@styles/text-styles';

.accordion {
background-color: var(--background-accent-navy);
padding: 0 var(--spacing-6);

&:first-of-type {
border-top-right-radius: var(--border-radius-xl);
border-top-left-radius: var(--border-radius-xl);
}

&:last-of-type {
border-bottom-right-radius: var(--border-radius-xl);
border-bottom-left-radius: var(--border-radius-xl);
}

&:not(:first-of-type) summary {
border-block-start: 1px solid var(--border-default);
}

&[open] summary {
&::after {
background-image: url(icons.$chevron-up-navy);
}
}

summary {
@include text-styles.header-3;
padding: var(--spacing-6) 0;
cursor: pointer;
display: flex;
justify-content: space-between;
align-items: center;
&::marker,
&::-webkit-details-marker {
display: none;
content: '';
}

&::after {
aspect-ratio: 1 / 1;
background-image: url(icons.$chevron-down-navy);
background-position: center;
background-size: contain;
content: '';
display: block;
width: var(--spacing-5);
}
}

& > div {
padding-block-end: var(--spacing-6);
& p:last-of-type {
margin-block-end: 0;
}
& li:last-of-type {
margin-block-end: 0;
}
}
}
19 changes: 19 additions & 0 deletions website/src/components/accordion/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import styles from './index.module.scss';

interface AccordionProps {
title: string;
content: React.ReactNode;
}

const Accordion: React.FC<AccordionProps> = ({ title, content }) => {
return (
<details className={styles.accordion}>
<summary>{title}</summary>
<div>
<p>{content}</p>
</div>
</details>
);
};

export default Accordion;

0 comments on commit c7e3cdf

Please sign in to comment.