+++ /dev/null
-const React = require('react');
-
-module.exports = ({ links }) => {
- return (
- <nav>
- <div className="menuButton" />
- <h3>Menu</h3>
- <ul>
- {links.map((link, i) => (
- <li key={i}>
- <a href={link.url}>{link.text}</a>
- </li>
- ))}
- </ul>
- </nav>
- );
-};
--- /dev/null
+const React = require('react');
+
+module.exports = ({ links }) => {
+ const navActions = {
+ open: () => document.body.classList.add('isNavOpen'),
+ close: () => document.body.classList.remove('isNavOpen'),
+ toggle: () => document.body.classList.toggle('isNavOpen'),
+ };
+
+ return (
+ <nav className="Menu">
+ <div
+ className="Menu-Closer"
+ onMouseOver={navActions.close}
+ onClick={navActions.close}
+ />
+ <div
+ className="Menu-Button"
+ onMouseOver={navActions.open}
+ onClick={navActions.toggle}
+ />
+ <div className="Menu-Body">
+ <h3>Menu</h3>
+ <ul>
+ {links.map((link, i) => (
+ <li key={i}>
+ <a href={link.url}>{link.text}</a>
+ </li>
+ ))}
+ </ul>
+ </div>
+ </nav>
+ );
+};
--- /dev/null
+:root {
+ --Hero-headerSize: 4em;
+}
+
+header {
+ min-height: 100vh;
+ box-sizing: border-box;
+ background-attachment: fixed;
+ color: rgba(0, 0, 0, 0.6);
+ padding: var(--Hero-headerSize);
+}
+
+header h1 {
+ font-size: var(--Hero-headerSize);
+ padding-bottom: 1em;
+}
+
+header p {
+ line-height: 2em;
+}
+
+@media (max-width: 55em) {
+ :root {
+ --Hero-headerSize: 3em;
+ }
+}
+
+@media (max-width: 25em) {
+ header {
+ padding: 2em;
+ }
+
+ h1 {
+ width: 0;
+ }
+}
+
+@media (max-width: 20em) {
+ header p::first-letter {
+ margin-left: -1.3em;
+ text-align: right;
+ width: 0;
+ float: left;
+ }
+}
--- /dev/null
+.Menu {
+ width: 20em;
+ height: 100vh;
+ max-width: 100%;
+ right: -20em;
+ position: fixed;
+ transition: right 0.2s cubic-bezier(0.16, 0.7, 0.53, 1.18);
+}
+
+.isNavOpen .Menu {
+ right: 0;
+}
+
+.Menu-Closer {
+ z-index: 8;
+ position: fixed;
+ top: 0;
+ left: 0;
+ width: 0;
+ height: 100vh;
+}
+
+.isNavOpen .Menu-Closer {
+ width: 100vw;
+}
+
+.Menu-Button {
+ z-index: 10;
+ position: fixed;
+ top: 2em;
+ right: 2em;
+ padding: 0.75em;
+ box-shadow: 0 0 0 0.5em rgba(0, 0, 0, 0.5) inset;
+ border-radius: 100%;
+}
+
+.Menu-Body {
+ z-index: 9;
+ position: fixed;
+ width: 100%;
+ height: 100%;
+ box-sizing: border-box;
+ border-radius: 1em 0 0 1em;
+ padding: 2em;
+ background-color: #fff;
+}
+
+.Menu h3 {
+ font-size: 1.5em;
+ margin: 0;
+ padding-bottom: 1em;
+ line-height: 2.25rem;
+}
+
+.Menu ul {
+ list-style-type: none;
+}
+
+.Menu ul li {
+ margin: 1em 0;
+}
+
+@media (max-width: 25em) {
+ .Menu {
+ width: 100%;
+ right: -100%;
+ transition: right 0.2s;
+ }
+ .Menu-Body {
+ border-radius: 0;
+ }
+}
const React = require('react');
const ReactDom = require('react-dom');
-const Hero = require('./Hero');
-const Menu = require('./Menu');
+const Hero = require('./components/Hero');
+const Menu = require('./components/Menu');
ReactDom.render(
<>
<Menu
links={[
{
- url: 'https://github.com/ben-larson',
+ url: 'https://github.com/ben-larson/',
text: 'Check out my GitHub \u2197',
},
+ {
+ url: 'https://www.linkedin.com/in/ben-larson-dev/',
+ text: 'Connect on LinkedIn \u2197',
+ },
]}
/>
<Hero
@import url('https://fonts.larson.zone/inter/index.css');
+@import url('./components/hero.css');
+@import url('./components/menu.css');
* {
- font-family: inter;
+ font-family: inherit;
margin: 0;
padding: 0;
}
body {
- font-family: lingua-franca-bold;
+ font-family: inter, -apple-system, Roboto, 'Helvetica Neue', sans-serif;
font-weight: bold;
font-size: 1.5em;
background: #ddd;
color: #333;
}
-nav {
- box-sizing: border-box;
- border-radius: 1em 0 0 1em;
- padding: 2em;
- width: 30em;
- height: 100vh;
- background-color: rgba(255, 255, 255, 0.9);
- position: fixed;
- right: -30em;
- transition: right 0.2s cubic-bezier(0.16, 0.7, 0.53, 1.18);
-}
-
-nav:hover {
- right: -10em;
-}
-
-nav .menuButton {
- position: fixed;
- top: 2em;
- right: 2em;
- padding: 0.75em;
- box-shadow: 0 0 0 0.5em rgba(0, 0, 0, 0.5) inset;
- border-radius: 100%;
-}
-
-nav h3 {
- font-size: 1.5em;
- margin: 0;
- padding-bottom: 1em;
- line-height: 2.25rem;
-}
-
-nav ul {
- list-style-type: none;
-}
-
-header {
- height: 100vh;
- box-sizing: border-box;
- color: rgba(0, 0, 0, 0.6);
-}
-
-h1 {
- font-size: 4em;
- padding: 1em 1em;
-}
-
-header p {
- padding: 0 4em;
- width: 20em;
- line-height: 2em;
-}
-
a {
text-decoration: none;
color: #46f;
a:hover {
box-shadow: 0 3px;
}
+
+@media (max-width: 45em) {
+ body {
+ font-size: 1em;
+ }
+}
+++ /dev/null
-const repos = ['Event Creator', 'JS Playground'];
-
-const element = (tagName, attrs = {}, ...children) => {
- const result = document.createElement(tagName);
- Object.keys(attrs).forEach(key => result.setAttribute(key, attrs[key]));
- children.forEach(child => {
- if (typeof child === 'object') result.appendChild(child);
- else result.innerHTML += child;
- });
- return result;
-};
-
-repos.forEach(title => {
- const name = title.toLowerCase().replace(' ', '-');
- const url = `https://benlarson.xyz/${name}/`;
-
- const iframe = element('iframe', { src: url });
- const githubLink = element(
- 'a',
- { href: `https://github.com/ben-larson/${name}/`, class: 'github' },
- 'View on GitHub ↗'
- );
- const content = element('div', { class: 'sizer' }, githubLink, iframe);
- const section = element('section', {}, content);
- document.body.appendChild(section);
-});