-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sketch dropdown before merging main into this branch
- Loading branch information
1 parent
970f069
commit 12e1770
Showing
5 changed files
with
63 additions
and
10 deletions.
There are no files selected for viewing
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 @@ | ||
@keyframes openTriangle { | ||
from { transform: rotate(0deg); } | ||
to { transform: rotate(180deg); } | ||
} | ||
|
||
@keyframes closeTriangle { | ||
from { transform: rotate(180deg); } | ||
to { transform: rotate(0deg); } | ||
} | ||
|
||
.dropdown { | ||
margin-left: 8px; | ||
margin-top: 7px; | ||
margin-bottom: 5px; | ||
} | ||
|
||
|
||
.dropdown[data-collapsed=false] { | ||
animation: openTriangle 0.3s forwards ease-in-out; | ||
} | ||
|
||
.dropdown[data-collapsed=true] { | ||
animation: closeTriangle 0.3s forwards ease-in-out; | ||
} |
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,26 @@ | ||
import { useState } from 'react'; | ||
import styles from './SampleCategory.module.css'; | ||
|
||
interface SampleCategoryProps { | ||
title: string; | ||
} | ||
|
||
export const SampleCategory = ({ title }: SampleCategoryProps) => { | ||
const [open, setOpen] = useState<boolean>(true); | ||
return ( | ||
<div style={{ display: 'flex' }} onClick={() => setOpen(!open)}> | ||
<h3 | ||
style={{ | ||
marginTop: '5px', | ||
}} | ||
> | ||
{title} | ||
</h3> | ||
<div className={`${styles.dropdown}`} data-collapsed={open}> | ||
<svg width="15" height="15" viewBox="0 0 20 20"> | ||
<path d="M0 7 L 20 7 L 10 16" fill="black" /> | ||
</svg> | ||
</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
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
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