add some styling via bulma
All checks were successful
Build access-web-migration / Build-And-Push (push) Successful in 15s

This commit is contained in:
2024-04-22 15:06:49 -05:00
parent 680ee11e04
commit 93a9b6eca8
2 changed files with 37 additions and 20 deletions

View File

@@ -1,23 +1,36 @@
<h1>{{title}}</h1> <div class="content">
<p>Welcome to {{title}}</p> <h1 class="title">{{title}}</h1>
<button id="btn-pun">Pun Me!</button> <p class="subtitle">Welcome to {{title}}</p>
<p id="pun"></p> <button id="btn-pun" class="button">Pun Me!</button></div><br/>
<input type="text" id="rhyme-word" /> <div class="box" id="pun"></div><br/>
<button id="btn-rhyme">Rhyme It!</button> <input class="field input is-primary" type="text" placeholder="Word to Rhyme" id="rhyme-word" /><br/>
<p id="rhymes"></p> <button id="btn-rhyme" class="button">Rhyme It!</button><br/><br/>
<script> <div class="box" id="rhymes"></div>
document.querySelector('#btn-pun').addEventListener('click', () => { <script>
fetch('/pun').then(response => response.text()).then(text => { document.querySelector('#btn-pun').addEventListener('click', () => {
let textTag = document.querySelector('#pun'); fetch('/pun').then(response => response.text()).then(text => {
textTag.innerHTML = text; let textTag = document.querySelector('#pun');
textTag.innerHTML = text;
});
}); });
});
document.querySelector('#btn-rhyme').addEventListener('click', () => { document.querySelector('#btn-rhyme').addEventListener('click', () => {
let word = document.querySelector('#rhyme-word').value; let word = document.querySelector('#rhyme-word').value;
fetch('/pun/query?word=' + encodeURIComponent(word)).then(response => response.json()).then(json => { if (!word) {
let textTag = document.querySelector('#rhymes'); alert('Please enter a word to rhyme.');
textTag.innerHTML = json.join('</br>'); return;
}
fetch('/pun/query?word=' + encodeURIComponent(word)).then(response => response.json()).then(json => {
let textTag = document.querySelector('#rhymes');
textTag.innerHTML = json.join('<br/>');
});
}); });
});
</script> document.querySelector('#rhyme-word').addEventListener('keypress', (event) => {
if (event.key === 'Enter') {
event.preventDefault();
document.querySelector('#btn-rhyme').click();
}
})
</script>
</div>

View File

@@ -2,9 +2,13 @@
<html> <html>
<head> <head>
<title>{{title}}</title> <title>{{title}}</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@1.0.0/css/bulma.min.css">
<link rel='stylesheet' href='/stylesheets/style.css' /> <link rel='stylesheet' href='/stylesheets/style.css' />
<meta name="viewport" content="width=device-width, initial-scale=1">
</head> </head>
<body> <body>
<section class="section">
{{{body}}} {{{body}}}
</section>
</body> </body>
</html> </html>