Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Everything except for the TS declarations since I think Dylan ought to weigh in

Co-authored-by: Michael Rawlings <[email protected]>
Co-authored-by: Luke LaValva <[email protected]>
  • Loading branch information
3 people authored Jan 18, 2023
1 parent 05e7213 commit a245195
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
7 changes: 2 additions & 5 deletions content/2-templating/6-conditional/marko/TrafficLight.marko
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
static const TRAFFIC_LIGHTS = ["red", "orange", "green"];
<let/lightIndex = 0/>
<let/light = TRAFFIC_LIGHTS[lightIndex]/>
<const/light = TRAFFIC_LIGHTS[lightIndex]/>

<button onClick () {
lightIndex++;
if (lightIndex >= TRAFFIC_LIGHTS.length) {
lightIndex = 0;
}
lightIndex = (lightIndex + 1) % TRAFFIC_LIGHTS.length;
}>Next light</button>
<p>Light is: ${light}</p>
<p>
Expand Down
6 changes: 3 additions & 3 deletions content/3-lifecycle/2-on-unmount/marko/Time.marko
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<let/time = new Date()/>
<lifecycle() {
onMount () { this.timer = setInterval(_ => time = new Date()), 1000) }
<lifecycle
onMount () { this.timer = setInterval(_ => time = new Date(), 1000) }
onDestroy () { clearInterval(this.timer) }
}/>
/>
<p>Current time: ${time.toLocaleTimeString()}</p>
2 changes: 1 addition & 1 deletion content/6-form-input/2-checkbox/marko/IsAvailable.marko
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<input#is-available
type="checkbox"
checked:=isAvailable
checked:=input.isAvailable
/>
<label for="is-available">Is available</label>
7 changes: 3 additions & 4 deletions content/6-form-input/3-radio/marko/PickPill.marko
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
function handleChange (event) {
picked = event.target.value;
}

<let/picked = "red"/>
<const/handleChange(event) {
picked = event.target.value;
}/>

<div>Picked: ${picked}</div>
<input#blue-pill
Expand Down

0 comments on commit a245195

Please sign in to comment.