1
Fork 0
mirror of https://github.com/Steffo99/unisteffo.git synced 2024-11-26 18:04:20 +00:00

Start appuntiweb

This commit is contained in:
Steffo 2019-11-07 12:43:27 +01:00
parent 1c2d2451f7
commit 68ad9cf38f
9 changed files with 113 additions and 10 deletions

4
src/components/latex.css Normal file
View file

@ -0,0 +1,4 @@
.latex {
display: inline-block;
vertical-align: bottom;
}

12
src/components/latex.js Normal file
View file

@ -0,0 +1,12 @@
import style from "./latex.css";
import { Component } from 'preact';
export default class Latex extends Component {
render() {
let equation = `{\\color{White} ${this.props.children} }`
return <img src={`https://latex.codecogs.com/png.latex?${equation}`}
alt={this.props.children}
title={this.props.children}
class={style.latex}></img>;
}
}

6
src/components/panel.css Normal file
View file

@ -0,0 +1,6 @@
.panel {
background-color: rgba(62.7%, 80%, 100%, 10%);
padding: 4px;
border-radius: 4px;
margin: 4px;
}

8
src/components/panel.js Normal file
View file

@ -0,0 +1,8 @@
import style from "./panel.css";
import { Component } from 'preact';
export default class Panel extends Component {
render() {
return <div class={style.panel}>{this.props.children}</div>;
}
}

8
src/components/split.css Normal file
View file

@ -0,0 +1,8 @@
.split {
display: flex;
}
.splitchild {
flex-grow: 0;
flex-shrink: 0;
}

12
src/components/split.js Normal file
View file

@ -0,0 +1,12 @@
import style from "./split.css";
import { Component } from 'preact';
export default class Split extends Component {
render() {
let percent = 100 / this.props.children.count;
let children = this.props.children.map(element => {
return (<div class={style.splitchild}>{element}</div>);
});
return <div class={style.split}>{children}</div>;
}
}

13
src/index.css Normal file
View file

@ -0,0 +1,13 @@
body {
background-color: #0d193b;
color: #a0ccff;
font-family: sans-serif;
box-sizing: border-box;
}
h1, h2, h3, h4, h5, h6 {
text-align: center;
margin-top: 4px;
margin-bottom: 4px;
color: #ffffff;
}

View file

@ -1,11 +1,59 @@
import './style'; import './index.css';
import { Component } from 'preact'; import { Component } from 'preact';
import Latex from './components/latex';
import Panel from './components/panel';
import Split from './components/split';
export default class App extends Component { export default class App extends Component {
render() { render() {
return ( return (
<div> <div>
<h1>Hello, World!</h1> <h1>
Titolo
</h1>
<h2>
Sottotitolo
</h2>
<Panel>
Ciao! Sono un paragrafo che include formule matematiche: <Latex>a_1 + b_2 + c_3</Latex>!
</Panel>
<Split>
<Panel>
<h3>Sottoaceto</h3>
<Split>
<Panel>
<h4>Ligma</h4>
<div>
Andross gave his troops ligma!
</div>
</Panel>
<Panel>
<h4>Sugma</h4>
<div>
SLIPPY NO
</div>
</Panel>
<Panel>
<h4>Bofa</h4>
<div>
Falco Lombardi
</div>
</Panel>
</Split>
</Panel>
<Panel>
<h3>Sottolio</h3>
<div>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
</Panel>
<Panel>
<h3>Kebab</h3>
<div>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
</Panel>
</Split>
</div> </div>
); );
} }

View file

@ -1,8 +0,0 @@
html, body {
font: 14px/1.21 'Helvetica Neue', arial, sans-serif;
font-weight: 400;
}
h1 {
text-align: center;
}