html {
line-height: 1;
}
body {
align-items: center;
background-color: #111;
display: flex;
font-family: Helvetica Neue, sans-serif;
height: 100vh;
justify-content: center;
margin: 0;
padding: 0;
text-align: center;
}
h1 {
color: #00caff;
font-weight: 100;
font-size: 8em;
margin: 0;
padding-bottom: 15px;
}
button {
background: #111;
border-radius: 0px;
border: 1px solid #00caff;
color: #00caff;
font-size: 2em;
font-weight: 100;
margin: 0;
outline: none;
padding: 5px 15px;
transition: background .2s;
&:hover, &:active, &:disabled {
background: #00caff;
color: #111;
}
&:active {
outline: 2px solid #00caff;
}
&:focus {
border: 1px solid #00caff;
}
}
button + button {
margin-left: 3px;
}
View Compiled
// place code into IIFE so Cypress can load
// it before each test and the local variables
// would not clash with previous evaluations
(function() {
const { h, app } = hyperapp;
/** @jsx h */
// save the reference so we can dispatch
// actions on the web app
// window._app is the actions object {down, up}
// window._app.down()
// window._app.up()
window._app = app({
state: {
count: 0
},
view: (state, actions) => (
<main>
<h1>{state.count}</h1>
<button onclick={actions.down} disabled={state.count <= 0}>
ー
</button>
<button onclick={actions.up}>+</button>
</main>
),
actions: {
down: state => ({ count: state.count - 1 }),
up: state => ({ count: state.count + 1 })
}
});
})();
View Compiled
This Pen doesn't use any external CSS resources.