1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-28 23:44:19 +00:00

Add BoxWithHeader component

This commit is contained in:
Stefano Pigozzi 2021-04-21 01:03:59 +02:00
parent 99894a8486
commit ed7d39a65a
Signed by untrusted user who does not match committer: steffo
GPG key ID: 6965406171929D01
5 changed files with 92 additions and 16 deletions

View file

@ -1,22 +1,51 @@
import {useState} from "react" import {useState} from "react"
import classNames from "classnames" import classNames from "classnames"
import Style from "./App.module.css" import Style from "./App.module.css"
import Box from "./components/Box" import BoxWithHeader from "./components/BoxWithHeader"
export default function App() { export default function App() {
const [theme, ] = useState("ThemeDark"); const [theme, ] = useState("ThemeDark");
return ( return (
<div className={classNames(Style["app"], theme)}> <div className={classNames(Style.App, theme)}>
<Box direction={"column"}> <BoxWithHeader
<div> header={{
Ciao children: "Ciao mondo!"
</div> }}
<div> body={{
mondo! children: (
</div> <div>
</Box> <div>
Il CSS è pura magia.
</div>
<div>
Change my mind.
</div>
</div>
),
}}
/>
<BoxWithHeader
header={{
children: "Questa è un'altra Box."
}}
body={{
children: (
<div>
E altro testo.
</div>
)
}}
/>
<BoxWithHeader
header={{
children: "Ecco, così va meglio.",
}}
body={{
children: "No."
}}
/>
</div> </div>
) )
} }

View file

@ -1,6 +1,8 @@
.app { .App {
min-height: 100vh; height: 100vh;
min-width: 100vw; width: 100vw;
padding: 16px;
background-color: var(--bg-primary); background-color: var(--bg-primary);
color: var(--fg-primary); color: var(--fg-primary);

View file

@ -0,0 +1,17 @@
import React from "react"
import Style from "./BoxWithHeader.module.css"
import classNames from "classnames"
export default function BoxWithHeader({ header, body, className, ...props }) {
return (
<div className={classNames(Style.BoxWithHeader, className)} {...props}>
<div className={classNames(Style.BoxHeader, header.className)}>
{header.children}
</div>
<div className={classNames(Style.BoxBody, body.className)}>
{body.children}
</div>
</div>
)
}

View file

@ -0,0 +1,27 @@
.BoxWithHeader {
margin: 25px;
display: flex;
flex-direction: column;
}
.BoxHeader {
padding: 10px 40px;
border-radius: 25px 25px 0 0;
background-color: var(--bg-light);
font-size: x-large;
font-family: var(--font-title);
}
.BoxBody {
min-height: 40px;
padding: 10px 40px;
border-radius: 0 0 25px 25px;
background-color: var(--bg-dark);
font-size: medium;
font-family: var(--font-regular);
}

View file

@ -1,16 +1,17 @@
@import url('https://fonts.googleapis.com/css2?family=Bree+Serif&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Bree+Serif&family=Poppins&display=swap');
* { * {
box-sizing: border-box; box-sizing: border-box;
} }
body { body {
--font-title: "Bree Serif", serif;
--font-regular: "Poppins", sans-serif;
margin: 0; margin: 0;
min-height: 100%; min-height: 100%;
min-width: 100%; min-width: 100%;
font-family: "Bree Serif", serif;
} }
.ThemeDark { .ThemeDark {