forked from quarkiverse/quarkus-quinoa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix quarkiverse#729: Simplify and fix Vite Code Start
- Loading branch information
Showing
10 changed files
with
872 additions
and
941 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
runtime/src/main/codestarts/quarkus/quinoa-codestart/base/src/main/webui/counter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export function setupCounter(element) { | ||
let counter = 0 | ||
const setCounter = (count) => { | ||
counter = count | ||
element.innerHTML = `count is ${counter}` | ||
} | ||
element.addEventListener('click', () => setCounter(counter + 1)) | ||
setCounter(0) | ||
} |
13 changes: 13 additions & 0 deletions
13
runtime/src/main/codestarts/quarkus/quinoa-codestart/base/src/main/webui/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Quinoa App</title> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="/main.js"></script> | ||
</body> | ||
</html> |
42 changes: 22 additions & 20 deletions
42
runtime/src/main/codestarts/quarkus/quinoa-codestart/base/src/main/webui/main.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
import theaterJS from 'theaterjs'; | ||
import './style.css' | ||
import javascriptLogo from '/javascript.svg' | ||
import viteLogo from '/vite.svg' | ||
import { setupCounter } from './counter.js' | ||
|
||
const theater = theaterJS(); | ||
document.querySelector('#app').innerHTML = ` | ||
<div> | ||
<a href="https://vitejs.dev" target="_blank"> | ||
<img src="${viteLogo}" class="logo" alt="Vite logo" /> | ||
</a> | ||
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript" target="_blank"> | ||
<img src="${javascriptLogo}" class="logo vanilla" alt="JavaScript logo" /> | ||
</a> | ||
<h1>Hello Quinoa!</h1> | ||
<div class="card"> | ||
<button id="counter" type="button"></button> | ||
</div> | ||
<p class="read-the-docs"> | ||
Click on the Vite logo to learn more | ||
</p> | ||
</div> | ||
` | ||
|
||
theater | ||
.on('type:start, erase:start', function() { theater.getCurrentActor().$element.classList.add('actor-content--typing');}) | ||
.on('type:end, erase:end', function() {theater.getCurrentActor().$element.classList.remove('actor-content--typing');}); | ||
|
||
theater | ||
.addActor('Quarkus', { speed: 1, accuracy: 0.7 }) | ||
.addActor('Me', { speed: 0.9, accuracy: 0.8 }) | ||
.addScene('Quarkus:Toc toc.', 1000) | ||
.addScene('Me:What?', 500) | ||
.addScene('Quarkus:You will eat Quinoa today!', 200) | ||
.addScene('Me:Nooo...', -3, '!!! ', 150, 'No! ', 150) | ||
.addScene('Me:Yuk! That\'s impossible!', 100) | ||
.addScene('Quarkus:It is time!', 100) | ||
.addScene('Quarkus:With your training and this power,', 100) | ||
.addScene('Quarkus:You will create awesome web apps.', 100) | ||
.addScene('Quarkus:It is your destiny!', 200) | ||
.addScene('Quarkus:Meet Quarkus UI with NO hAssle!', 200) | ||
.addScene('Me:Neat!', 200) | ||
setupCounter(document.querySelector('#counter')) |
Oops, something went wrong.