Skip to content

Commit

Permalink
refactor(faq): adjusts container width, updates keydown functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
oahnh committed Jan 12, 2024
1 parent 7815078 commit 7380020
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/components/FAQ.astro
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ const faqsCol2 = faqs.slice(split);
.faq-content {
display: flex;
gap: 32px;
width: 100%;
width: 62rem;
align-items: flex-start;
padding: 0 15%;
margin: 0 auto;
}
.faq-container {
display: flex;
Expand Down
8 changes: 7 additions & 1 deletion src/components/FAQDropdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,19 @@ const FAQDropdown = ({ question, defaultOpen }: FAQDropdownProps) => {
);
};

const handleKeyDown = (e: React.KeyboardEvent) => {
if (e.key === 'Enter') {
handleToggle();
}
};

return (
<div className={styles.container}>
<div
className={styles.labelContainer}
onClick={handleToggle}
tabIndex={0}
onKeyUp={handleToggle}
onKeyDown={e => handleKeyDown(e)}
>
<div className={styles.statusIcon}>{isOpen ? '-' : '+'}</div>
<b>{label}</b>
Expand Down
4 changes: 3 additions & 1 deletion src/components/FAQDropdown/style.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
.statusIcon {
font-size: 1.5rem;
text-align: center;
user-select: none;
width: 1rem;
}

b {
Expand All @@ -27,7 +29,7 @@

.content {
display: flex;
margin-left: 2.5rem;
margin-left: 2.75rem;

p {
font-style: normal;
Expand Down

0 comments on commit 7380020

Please sign in to comment.