Skip to content

Commit c74baa9

Browse files
committed
Add GitHub corner, page heading and info box
1 parent cdfae58 commit c74baa9

File tree

5 files changed

+85
-3
lines changed

5 files changed

+85
-3
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"cSpell.words": ["elif", "Forex", "predeploy", "TTFB", "webfonts"]
2+
"cSpell.words": ["elif", "Forex", "octocat", "predeploy", "TTFB", "webfonts"]
33
}

src/App.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
}
1515

1616
.App-header {
17-
padding-block: 0.5rem;
17+
padding-block: 1rem;
1818
background-color: #121212;
19-
min-height: 100vh;
19+
min-height: calc(100vh - 2rem); /* 2 x padding-block */
2020
display: flex;
2121
flex-direction: column;
2222
align-items: center;

src/App.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ import "@fontsource/roboto/700.css";
66
import "./App.css";
77
import { useState } from "react";
88
import { ThemeProvider, createTheme } from "@mui/material/styles";
9+
import Alert from "@mui/material/Alert";
910
import ToggleButton from "@mui/material/ToggleButton";
1011
import ToggleButtonGroup from "@mui/material/ToggleButtonGroup";
1112
import PositionCalculator, { Position } from "positions/PositionCalculator";
13+
import GitHubCorner from "components/GitHubCorner";
1214

1315
const darkTheme = createTheme({
1416
palette: {
@@ -28,8 +30,10 @@ function App() {
2830

2931
return (
3032
<div className="App">
33+
<GitHubCorner />
3134
<header className="App-header">
3235
<ThemeProvider theme={darkTheme}>
36+
<h3>Position Size Calculator</h3>
3337
<ToggleButtonGroup
3438
color="primary"
3539
value={position}
@@ -42,6 +46,9 @@ function App() {
4246
Short Position (Sell & Buy)
4347
</ToggleButton>
4448
</ToggleButtonGroup>
49+
<Alert severity="info">
50+
Fill in any three to four values and click Compute to get the rest.
51+
</Alert>
4552
<PositionCalculator type={position} />
4653
</ThemeProvider>
4754
</header>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import styles from "./styles.module.css";
2+
3+
const title = "Discuss & Contribute on GitHub";
4+
5+
export default function GitHubCorner() {
6+
return (
7+
<a
8+
href="https://github.com/ADTC/simple-position-calc"
9+
target="_blank"
10+
rel="noreferrer"
11+
className={styles.githubCorner}
12+
aria-label={title}
13+
title={title}
14+
>
15+
<svg
16+
width="80"
17+
height="80"
18+
viewBox="0 0 250 250"
19+
className={styles.svg}
20+
aria-hidden="true"
21+
>
22+
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z" />
23+
<path
24+
d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"
25+
fill="currentColor"
26+
className={styles.octocatArm}
27+
/>
28+
<path
29+
d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z"
30+
fill="currentColor"
31+
/>
32+
</svg>
33+
</a>
34+
);
35+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
.githubCorner:hover .octocatArm {
2+
animation: octocatWave 560ms ease-in-out;
3+
}
4+
5+
@keyframes octocatWave {
6+
0%,
7+
100% {
8+
transform: rotate(0);
9+
}
10+
20%,
11+
60% {
12+
transform: rotate(-25deg);
13+
}
14+
40%,
15+
80% {
16+
transform: rotate(10deg);
17+
}
18+
}
19+
@media (max-width: 500px) {
20+
.githubCorner:hover .octocatArm {
21+
animation: none;
22+
}
23+
.githubCorner .octocatArm {
24+
animation: octocatWave 560ms ease-in-out;
25+
}
26+
}
27+
28+
.svg {
29+
fill: #fff;
30+
color: #151513;
31+
position: fixed;
32+
top: 0;
33+
border: 0;
34+
right: 0;
35+
z-index: 999;
36+
}
37+
38+
.octocatArm {
39+
transform-origin: 130px 106px;
40+
}

0 commit comments

Comments
 (0)