Skip to content
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.

on _posts/2015-01026-model-view-intent.md all range input declaration… #79

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions _posts/2015-01-26-model-view-intent.md
Expand Up @@ -41,11 +41,11 @@ function main(sources) {
div([
div([
'Weight ' + weight + 'kg',
input('.weight', {type: 'range', min: 40, max: 140, value: weight})
input('.weight', {attrs: {type: 'range', min: 40, max: 140, value: weight}})
]),
div([
'Height ' + height + 'cm',
input('.height', {type: 'range', min: 140, max: 210, value: height})
input('.height', {attrs: {type: 'range', min: 140, max: 210, value: height}})
]),
h2('BMI is ' + bmi)
])
Expand All @@ -71,14 +71,14 @@ We have plenty of anonymous functions which could be refactored away from `main`
+function renderWeightSlider(weight) {
+ return div([
+ 'Weight ' + weight + 'kg',
+ input('.weight', {type: 'range', min: 40, max: 140, value: weight})
+ input('.weight', {attrs: {type: 'range', min: 40, max: 140, value: weight}})
+ ]);
+}

+function renderHeightSlider(height) {
+ return div([
+ 'Height ' + height + 'cm',
+ input('.height', {type: 'range', min: 140, max: 210, value: height})
+ input('.height', {attrs: {type: 'range', min: 140, max: 210, value: height}})
+ ]);
+}

Expand Down Expand Up @@ -111,11 +111,11 @@ We have plenty of anonymous functions which could be refactored away from `main`
div([
- div([
- 'Weight ' + weight + 'kg',
- input('.weight', {type: 'range', min: 40, max: 140, value: weight})
- input('.weight', {attrs: {type: 'range', min: 40, max: 140, value: weight}})
- ]),
- div([
- 'Height ' + height + 'cm',
- input('.height', {type: 'range', min: 140, max: 210, value: height})
- input('.height', {attrs: }{type: 'range', min: 140, max: 210, value: height}})
- ]),
+ renderWeightSlider(weight),
+ renderHeightSlider(height),
Expand Down