mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-24 22:14:18 +00:00
✨ Add ButtonSidebar
This commit is contained in:
parent
d93d7432b2
commit
c726df9531
4 changed files with 63 additions and 0 deletions
16
code/frontend/src/components/ButtonSidebar.js
Normal file
16
code/frontend/src/components/ButtonSidebar.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
import React from "react"
|
||||
import Style from "./ButtonSidebar.module.css"
|
||||
import classNames from "classnames"
|
||||
import make_icon from "../utils/make_icon"
|
||||
|
||||
|
||||
export default function ButtonSidebar({ icon, children, className, ...props }) {
|
||||
return (
|
||||
<button className={classNames(Style.ButtonSidebar, className)} {...props}>
|
||||
{make_icon(icon, Style.ButtonIcon)}
|
||||
<div className={Style.ButtonText}>
|
||||
{children}
|
||||
</div>
|
||||
</button>
|
||||
)
|
||||
}
|
42
code/frontend/src/components/ButtonSidebar.module.css
Normal file
42
code/frontend/src/components/ButtonSidebar.module.css
Normal file
|
@ -0,0 +1,42 @@
|
|||
.ButtonSidebar {
|
||||
font-family: var(--font-title);
|
||||
|
||||
border-width: 0;
|
||||
border-radius: 0 25px 25px 0;
|
||||
box-shadow: 0 4px 4px rgba(0, 0, 0, 0.25);
|
||||
|
||||
padding: 10px;
|
||||
margin: 0;
|
||||
|
||||
cursor: pointer;
|
||||
|
||||
background-color: var(--bg-button-off);
|
||||
color: var(--fg-button-off);
|
||||
font-size: large;
|
||||
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 10px;
|
||||
|
||||
/* Hackerino per ignorare il padding */
|
||||
width: calc(100% + 10px);
|
||||
position: relative;
|
||||
left: -10px;
|
||||
}
|
||||
|
||||
.ButtonSidebar.Active {
|
||||
background-color: var(--bg-button-on);
|
||||
color: var(--fg-button-on);
|
||||
}
|
||||
|
||||
.ButtonIcon {
|
||||
font-size: x-large;
|
||||
|
||||
/* TODO: non so quanto sia una buona idea, ma funziona accettabilmente */
|
||||
line-height: 0;
|
||||
vertical-align: sub;
|
||||
}
|
||||
|
||||
.ButtonText {
|
||||
text-align: center;
|
||||
}
|
|
@ -2,6 +2,8 @@ import React from "react"
|
|||
import Style from "./Sidebar.module.css"
|
||||
import classNames from "classnames"
|
||||
import Logo from "./Logo"
|
||||
import ButtonSidebar from "./ButtonSidebar"
|
||||
import { faHome } from "@fortawesome/free-solid-svg-icons"
|
||||
|
||||
|
||||
export default function Sidebar({ children, className, ...props }) {
|
||||
|
@ -9,6 +11,7 @@ export default function Sidebar({ children, className, ...props }) {
|
|||
<div className={classNames(Style.Sidebar, className)} {...props}>
|
||||
{/* TODO: Aggiungere il logo qui! */}
|
||||
<Logo/>
|
||||
<ButtonSidebar icon={faHome}>Dashboard</ButtonSidebar>
|
||||
{children}
|
||||
</div>
|
||||
)
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
.Sidebar {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
|
|
Loading…
Reference in a new issue