Skip to content

Commit

Permalink
Fix #729: Simplify and fix Vite Code Start
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Jul 23, 2024
1 parent 7f1d49f commit e2669f3
Show file tree
Hide file tree
Showing 11 changed files with 896 additions and 941 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
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)
}
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>
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'))
Loading

0 comments on commit e2669f3

Please sign in to comment.