-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
frontend/sandbox: added styling to improve UX
- Loading branch information
1 parent
c99f4dd
commit 1959d0b
Showing
13 changed files
with
649 additions
and
273 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
.accordion { | ||
width: 100%; | ||
border: 1px solid #e0e0e0; | ||
border-radius: 4px; | ||
overflow: hidden; | ||
margin: 16px 0; | ||
} | ||
|
||
.accordion-header { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
padding: 8px 24px; | ||
cursor: pointer; | ||
} | ||
|
||
.accordion-header h3 { | ||
line-height: 0; | ||
font-size: 16px; | ||
} | ||
|
||
.toggle-icon { | ||
font-size: 1.2rem; | ||
} | ||
|
||
.accordion-content { | ||
padding: 10px 20px; | ||
border-top: 1px solid #e0e0e0; | ||
background-color: #fff; | ||
} | ||
|
||
@media (prefers-color-scheme: dark) { | ||
.accordion-content { | ||
background-color: #242424; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { useState } from 'react'; | ||
import './Accordion.css'; | ||
|
||
type TProps = { | ||
title: string; | ||
children: React.ReactNode; | ||
opened?: boolean; | ||
} | ||
|
||
export const Accordion = ({ title, children, opened }: TProps) => { | ||
const [isOpen, setIsOpen] = useState(opened); | ||
|
||
return ( | ||
<div className="accordion"> | ||
<div className="accordion-header" onClick={() => setIsOpen(!isOpen)}> | ||
<h3>{title}</h3> | ||
<span className="toggle-icon"> | ||
{isOpen ? '-' : '+'} | ||
</span> | ||
</div> | ||
{isOpen && <div className="accordion-content">{children}</div>} | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,35 @@ | ||
#root { | ||
display: flex; | ||
width: 100%; | ||
max-width: 1280px; | ||
margin: 0 auto; | ||
padding: 2rem; | ||
text-align: center; | ||
overflow-x: hidden; | ||
} | ||
|
||
.action h4 { | ||
margin-bottom: 16px; | ||
} | ||
|
||
.action { | ||
border: 1px solid black; | ||
text-align: left; | ||
display: flex; | ||
flex-direction: column; | ||
padding: 32px 16px; | ||
} | ||
|
||
.action:not(:last-child) { | ||
border-bottom: 1px solid #e0e0e0; | ||
border-radius: 0; | ||
} | ||
|
||
.action button { | ||
margin-top: 8px; | ||
} | ||
|
||
@media (prefers-color-scheme: dark) { | ||
.action:not(:last-child) { | ||
border-color: #626262; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.