Skip to content
Snippets Groups Projects
Commit a5e9b5da authored by Planoetscher Daniel (Student Com20)'s avatar Planoetscher Daniel (Student Com20)
Browse files

dropdown

parent 79d47ae4
No related branches found
No related tags found
No related merge requests found
@use 'styles/settings.scss'as s;
.dropdown-container {
position: relative;
cursor: pointer;
padding-bottom: 5px;
&.open {
.dropdown {
opacity: 1;
transform: translateY(100%);
visibility: visible;
}
}
.dropdown {
position: absolute;
bottom: 0;
left: 0;
transform: translateY(75%);
background: s.$white;
z-index: 2000;
max-width: 200px;
border-radius: 5px;
box-shadow: 0 0 5px rgba(s.$black, 0.05);
visibility: hidden;
opacity: 0;
.dropdown-item {
padding: 10px 20px;
display: block;
color: s.$body-color;
border-radius: 5px;
&:hover {
box-shadow: 0 0 10px rgba(s.$black, 0.1);
}
}
}
}
\ No newline at end of file
import { ReactNode, useState } from 'react';
import { Link } from 'react-router-dom';
import './dropdown.scss';
interface DropDownItem {
label: string;
route: string;
}
interface Props {
children: ReactNode;
items: DropDownItem[]
}
export default function Dropdown({ children, items }: Props) {
const [isOpen, setOpen] = useState(false);
return (
<div className={'dropdown-container' + (isOpen ? ' open' : '')} onClick={() => setOpen(state => !state)}>
{children}
<div className="dropdown">
{
items.map((item) => (
<Link className="dropdown-item" to={item.route}>
{item.label}
</Link>
))
}
</div>
</div>
);
}
\ No newline at end of file
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
justify-content: space-between; justify-content: space-between;
background: rgba(s.$white, 0.25); background: rgba(s.$white, 0.25);
border-radius: 15px; border-radius: 15px;
margin-top: 30px;
position: relative; position: relative;
.tab { .tab {
......
...@@ -34,11 +34,8 @@ ...@@ -34,11 +34,8 @@
} }
@include mx.breakpoint(medium) { @include mx.breakpoint(medium) {
width: 64px;
height: 64px;
.icon { .icon {
font-size: 32px; font-size: 28px;
} }
} }
} }
......
import Dropdown from 'components/navigation/Dropdown';
import './teams-stats.scss'; import './teams-stats.scss';
export default function TeamsStats() { export default function TeamsStats() {
return ( return (
<section className="teams-stats-section"> <section className="teams-stats-section">
<div className="content-container"> <div className="content-container">
<Dropdown items={[{ label: "Last month", route: "lastmonth" }]}>
<div className="filter-label">
<span className="material-icons icon">
expand_more
</span>
Last week
</div>
</Dropdown>
test test
</div> </div>
</section> </section>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment