Skip to content
Snippets Groups Projects
Commit 8a547dfd authored by Paolo.Brasolin's avatar Paolo.Brasolin
Browse files

feat: #fe restyle keyboard

parent 7cc89c18
No related branches found
No related tags found
No related merge requests found
$kbd-gutter: 3px; $kbd-gutter: 0.5vw;
$key-width: 8vw; $key-width: 8vw; // 100/12 ~ 8.3
.hg-theme-default { .hg-theme-default {
width: 100%; /* keyboard placement */
user-select: none;
box-sizing: border-box;
overflow: hidden;
touch-action: manipulation;
// font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-family: "Courier New", Courier, monospace;
// background-color: #ececec; position: absolute;
background-color: #aaaa; bottom: 0;
// padding: 5px;
padding: $kbd-gutter;
// border-radius: 5px;
font-weight: bold; /* keyboard sizing */
// font-size: 20px;
.hg-button span { box-sizing: border-box;
pointer-events: none; overflow: hidden;
} width: 100%;
height: 100%;
max-height: 30vh;
button.hg-button { /* rows layout */
border-width: 0;
outline: 0;
font-size: inherit;
}
.hg-button { .hg-rows {
display: inline-block; height: 100%;
flex-grow: 1; display: grid;
cursor: pointer; grid-auto-rows: 1fr;
// grid-row-gap: $kbd-gutter;
} }
.hg-row { /* keys layout */
display: flex;
&:not(:last-child) { .hg-row {
// margin-bottom: 5px; display: grid;
margin-bottom: $kbd-gutter; grid-auto-flow: column;
// grid-column-gap: $kbd-gutter;
&:nth-child(1) {
grid-auto-columns: 8vw 8vw 8vw 8vw 8vw 8vw 8vw 8vw 8vw 8vw 8vw 1fr;
} }
&:nth-child(2) {
.hg-button:not(:last-child) { padding-left: 0.5 * $key-width;
// margin-right: 5px; grid-auto-columns: 8vw 8vw 8vw 8vw 8vw 8vw 8vw 8vw 8vw 8vw 8vw;
margin-right: $kbd-gutter;
} }
&:nth-child(3) {
.hg-button-container { grid-auto-columns: 1fr 8vw 8vw 8vw 8vw 8vw 8vw 8vw 8vw 1fr;
// margin-right: 5px;
margin-right: $kbd-gutter;
display: flex;
} }
}
> div:last-child { /* gutters */
margin-right: 0;
}
&:nth-child(2) { padding: 0.5 * $kbd-gutter;
margin-left: 0.5 * $key-width; .hg-button {
} margin: 0.5 * $kbd-gutter;
} }
/* keycaps */
.hg-button { .hg-button {
// box-shadow: 0px 0px 3px -1px rgba(0, 0, 0, 0.3); font-family: "Courier New", Courier, monospace;
height: 40px; color: white;
border-radius: 5px; font-weight: bold;
box-sizing: border-box; text-shadow: 0 0 8px black;
// padding: 5px; font-size: max(4vw, 20px);
background: white;
// border-bottom: 1px solid #b5b5b5; border-radius: 0.125 * $key-width;
cursor: pointer; background: #fff4;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
&.hg-standardBtn { -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
// width: 20px;
// width: $key-width;
max-width: 8vw; // 100/12 ~ 8.3
}
&.hg-activeButton { &.hg-activeButton {
background: #ff0; background: lightyellow;
&[data-skbtn="{backspace}"] {
background-color: lightcoral;
}
&[data-skbtn="{space}"] {
background-color: lightblue;
}
&[data-skbtn="{enter}"] {
background-color: lightgreen;
}
} }
} }
// .hg-button { /* interaction */
// &.hg-functionBtn {
// &[data-skbtn="{bksp}"] {
// background-color: lightcoral;
// }
// &[data-skbtn="{space}"] {
// background-color: lightblue;
// }
// &[data-skbtn="{enter}"] {
// background-color: lightgreen;
// }
// }
// }
}
.simple-keyboard { user-select: none;
position: absolute; touch-action: manipulation;
bottom: 0;
.hg-button {
cursor: pointer;
span {
pointer-events: none;
}
}
} }
...@@ -78,8 +78,8 @@ class Typewriter { ...@@ -78,8 +78,8 @@ class Typewriter {
}, },
display: { display: {
[Key.Backspace]: "", // "⌫⟵", [Key.Backspace]: "", // "⌫⟵",
[Key.Enter]: "", // "⏎↩↵⏎", [Key.Enter]: "", // "⏎↩↵⏎",
[Key.Space]: "", // "␣", [Key.Space]: " ", // "␣",
}, },
onChange: this.keyboardOnChangeHandler.bind(this), onChange: this.keyboardOnChangeHandler.bind(this),
} as KeyboardOptions); } as KeyboardOptions);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment