Skip to content

Commit d30a4ee

Browse files
committed
Update UI
1 parent d0ceb4f commit d30a4ee

3 files changed

Lines changed: 49 additions & 11 deletions

File tree

index.html

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,22 @@
2323
--></div>
2424
<div class="footerControls"><!--
2525
--><span><!--
26-
--><input tabindex="0" type="checkbox" id="UseFontSerif" name="UseFontSerif"><!--
27-
--><label for="UseFontSerif"> Use Serif Font</label><!--
26+
--><select id="fontSelector"><!--
27+
--><optgroup label="Serif"><!--
28+
--><option value="'Courier Prime', serif">Courier Prime</option><!--
29+
--><option value="'Merriweather', serif">Merriweather</option><!--
30+
--></optgroup><!--
31+
--><optgroup label="Sans Serif"><!--
32+
--><option value="'Atkinson Hyperlegible', sans-serif">Atkinson Hyperlegible</option><!--
33+
--><option value="'Geologica', sans-serif">Geologica</option><!--
34+
--></optgroup><!--
35+
--><optgroup label="Monospace"><!--
36+
--><option value="'Cousine', monospace" selected>Cousine</option><!--
37+
--><option value="'Ubuntu Mono', monospace">Ubuntu Mono</option><!--
38+
--></optgroup><!--
39+
--></select><!--
40+
--><input type="number" id="fontSize" name="fontSize" min="12" max="100" value="20"><!--
41+
--><label for="fontSelector"> Font</label><!--
2842
--></span><!--
2943
--><span class="separator">·</span><!--
3044
--><span><!--

main.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,17 @@ window.onload = function() {
4444
// Attach Word Count & Character Count Hook
4545
textArea.onkeyup = OnTextAreaChange;
4646

47-
document.getElementById("UseFontSerif").onchange = function(e) {
48-
if (e.target.checked == true) {
49-
document.querySelector(':root').style.setProperty("--mainFont", "'Courier Prime', serif");
50-
} else {
51-
document.querySelector(':root').style.setProperty("--mainFont", "'Cousine', monospace");
52-
}
47+
document.getElementById("fontSelector").onchange = function(e) {
48+
document.querySelector(':root').style.setProperty("--mainFont", e.target.value);
5349
textArea.focus();
5450
}
51+
52+
document.getElementById("fontSize").onchange = function(e) {
53+
if (e.target.value > 100) e.target.value = 100;
54+
document.querySelector(':root').style.setProperty("--mainFontSize", `${e.target.value}px`);
55+
textArea.focus();
56+
}
57+
5558
document.getElementById("EnableSpellCheck").onchange = function(e) {
5659
if (e.target.checked == true) {
5760
textArea.setAttribute("spellcheck", "true");

styles.css

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
1-
@import url('https://fonts.googleapis.com/css2?family=Courier+Prime&family=Cousine&display=swap');
1+
/* https://fonts.google.com/share?selection.family=Atkinson+Hyperlegible|Courier+Prime|Cousine|Geologica|Merriweather|Ubuntu+Mono */
2+
@import url('https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible&family=Courier+Prime&family=Cousine&family=Geologica&family=Merriweather&family=Ubuntu+Mono&display=swap');
23

34
* {
45
box-sizing: border-box;
56
}
67

78
/*
9+
font-family: 'Atkinson Hyperlegible', sans-serif;
10+
font-family: 'Courier Prime', monospace;
811
font-family: 'Cousine', monospace;
9-
font-family: 'Courier Prime', serif;
12+
font-family: 'Geologica', sans-serif;
13+
font-family: 'Merriweather', serif;
14+
font-family: 'Ubuntu Mono', monospace;
1015
*/
16+
1117
:root {
1218
font-size: 16px;
1319
--mainFont: 'Cousine', monospace;
20+
--mainFontSize: 20px;
1421
}
1522

1623
@media (max-width: 750px) {
@@ -50,7 +57,7 @@ textarea {
5057

5158
color: #333;
5259
tab-size: 4;
53-
font-size: 1.9rem;
60+
font-size: var(--mainFontSize);
5461
font-family: var(--mainFont), monospace;
5562

5663
word-break: normal;
@@ -96,3 +103,17 @@ footer span.separator {
96103
padding: 0 0.5rem;
97104
}
98105

106+
select#fontSelector {
107+
font-family: 'Cousine', monospace;
108+
padding: 0.1rem 0.2rem;
109+
border: 1px solid #CCC;
110+
max-width: 8rem;
111+
border-right: none;
112+
}
113+
114+
input#fontSize {
115+
font-family: 'Cousine', monospace;
116+
padding: 0.1rem 0 0.1rem 0.3rem;
117+
border: 1px solid #CCC;
118+
max-width: 4rem;
119+
}

0 commit comments

Comments
 (0)