mirror of
https://github.com/pds-nest/nest.git
synced 2025-02-16 12:43:58 +00:00
✨ Add Logo to the sidebar
This commit is contained in:
parent
93a60c02da
commit
d93d7432b2
7 changed files with 62 additions and 25 deletions
|
@ -7,36 +7,39 @@ import { faArchive, faArrowRight, faExclamationTriangle, faSearch, faTrash } fro
|
|||
import Input from "./components/Input"
|
||||
import InputWithIcon from "./components/InputWithIcon"
|
||||
import Layout from "./components/Layout"
|
||||
import ContextTheme from "./contexts/ContextTheme"
|
||||
|
||||
|
||||
export default function App() {
|
||||
const [theme, ] = useState("ThemeDark");
|
||||
const [theme, ] = useState("ThemeLight");
|
||||
|
||||
return (
|
||||
<div className={classNames(Style.App, theme)}>
|
||||
<Layout>
|
||||
<BoxWithHeader
|
||||
header={"Sto provando i bottoni!"}
|
||||
>
|
||||
<div>
|
||||
<ContextTheme.Provider value={theme}>
|
||||
<div className={classNames(Style.App, theme)}>
|
||||
<Layout>
|
||||
<BoxWithHeader
|
||||
header={"Sto provando i bottoni!"}
|
||||
>
|
||||
<div>
|
||||
Ammirate:
|
||||
<div>
|
||||
Ammirate:
|
||||
</div>
|
||||
<div>
|
||||
<Button color={"Green"} icon={faArrowRight}>Verde</Button>
|
||||
<Button color={"Grey"} icon={faArchive}>Grigio</Button>
|
||||
<Button color={"Yellow"} icon={faExclamationTriangle}>Giallo</Button>
|
||||
<Button color={"Red"} icon={faTrash}>Rosso</Button>
|
||||
</div>
|
||||
<div>
|
||||
E già che ci siamo, un Input, con e senza icona:
|
||||
</div>
|
||||
<div>
|
||||
<Input/> <InputWithIcon icon={faSearch}/>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<Button color={"Green"} icon={faArrowRight}>Verde</Button>
|
||||
<Button color={"Grey"} icon={faArchive}>Grigio</Button>
|
||||
<Button color={"Yellow"} icon={faExclamationTriangle}>Giallo</Button>
|
||||
<Button color={"Red"} icon={faTrash}>Rosso</Button>
|
||||
</div>
|
||||
<div>
|
||||
E già che ci siamo, un Input, con e senza icona:
|
||||
</div>
|
||||
<div>
|
||||
<Input/> <InputWithIcon icon={faSearch}/>
|
||||
</div>
|
||||
</div>
|
||||
</BoxWithHeader>
|
||||
</Layout>
|
||||
</div>
|
||||
</BoxWithHeader>
|
||||
</Layout>
|
||||
</div>
|
||||
</ContextTheme.Provider>
|
||||
)
|
||||
}
|
||||
|
|
26
code/frontend/src/components/Logo.js
Normal file
26
code/frontend/src/components/Logo.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
import React, {useContext} from "react"
|
||||
import Style from "./Logo.module.css"
|
||||
import classNames from "classnames"
|
||||
import LogoDark from "../media/LogoDark.png"
|
||||
import LogoLight from "../media/LogoLight.png"
|
||||
import ContextTheme from "../contexts/ContextTheme"
|
||||
|
||||
|
||||
export default function Logo({ children, className, ...props }) {
|
||||
const theme = useContext(ContextTheme)
|
||||
|
||||
let logo;
|
||||
if(theme === "ThemeDark") {
|
||||
logo = LogoDark
|
||||
}
|
||||
else if(theme === "ThemeLight") {
|
||||
logo = LogoLight
|
||||
}
|
||||
else {
|
||||
throw new Error(`Unknown theme: ${theme}`)
|
||||
}
|
||||
|
||||
return (
|
||||
<img src={logo} alt={"N.E.S.T."}/>
|
||||
)
|
||||
}
|
3
code/frontend/src/components/Logo.module.css
Normal file
3
code/frontend/src/components/Logo.module.css
Normal file
|
@ -0,0 +1,3 @@
|
|||
.Logo {
|
||||
|
||||
}
|
|
@ -1,13 +1,14 @@
|
|||
import React from "react"
|
||||
import Style from "./Sidebar.module.css"
|
||||
import classNames from "classnames"
|
||||
import Logo from "./Logo"
|
||||
|
||||
|
||||
export default function Sidebar({ children, className, ...props }) {
|
||||
return (
|
||||
<div className={classNames(Style.Sidebar, className)} {...props}>
|
||||
{/* TODO: Aggiungere il logo qui! */}
|
||||
<img src={""} width={230} height={170}/>
|
||||
<Logo/>
|
||||
{children}
|
||||
</div>
|
||||
)
|
||||
|
|
4
code/frontend/src/contexts/ContextTheme.js
Normal file
4
code/frontend/src/contexts/ContextTheme.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
import {createContext} from "react";
|
||||
|
||||
const ContextTheme = createContext("ThemeDark")
|
||||
export default ContextTheme
|
BIN
code/frontend/src/media/LogoDark.png
Normal file
BIN
code/frontend/src/media/LogoDark.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
BIN
code/frontend/src/media/LogoLight.png
Normal file
BIN
code/frontend/src/media/LogoLight.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
Loading…
Add table
Reference in a new issue