diff --git a/package.json b/package.json index 3f9cdaf..6c6a273 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,8 @@ "template" ], "dependencies": { + "axios": "^0.4.2", + "virtual-dom": "^1.1.0" }, "devDependencies": { "coffee-script": "~1.8.0", diff --git a/src/assets/images/1000px-Ruby_logo.svg.png b/src/assets/images/1000px-Ruby_logo.svg.png new file mode 100644 index 0000000..7ef5f56 Binary files /dev/null and b/src/assets/images/1000px-Ruby_logo.svg.png differ diff --git a/src/assets/images/jumbo.jpg b/src/assets/images/jumbo.jpg new file mode 100644 index 0000000..8bc8f44 Binary files /dev/null and b/src/assets/images/jumbo.jpg differ diff --git a/src/assets/images/logo-js.png b/src/assets/images/logo-js.png new file mode 100644 index 0000000..b6b089e Binary files /dev/null and b/src/assets/images/logo-js.png differ diff --git a/src/assets/images/logo.png b/src/assets/images/logo.png new file mode 100644 index 0000000..0b77939 Binary files /dev/null and b/src/assets/images/logo.png differ diff --git a/src/jade/index.jade b/src/jade/index.jade index 7ac5011..b5e06e1 100644 --- a/src/jade/index.jade +++ b/src/jade/index.jade @@ -1,8 +1,16 @@ doctype html html head - title Koodiklinikka.fi + title koodiklinikka link(rel='stylesheet', href='css/style.css') body - h1 Hello world! + .jumbo + .form-container + p. + Lorem ipsum dolor sit amet, consectetuer adipiscing elit. + Sed posuere interdum sem. Sed augue orci, lacinia eu tincidunt. + Mauris varius diam vitae arcu.
Sed arcu lectus auctor vitae, consectetuer et venenatis eget velit. Sed augue orci, lacinia eu tincidunt. + form#invite.invite-form + input.input(type='text', name='email', placeholder='Email') + button.btn.btn__submit(type='submit', title='Lähetä') ⏎ script(src='js/bundle.js') diff --git a/src/js/main.js b/src/js/main.js index 2124b39..0d64fc3 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -1 +1,18 @@ -console.log('foobar'); +'use strict'; + +var request = require('axios'); +var form = document.getElementById('invite'); + +form.addEventListener('submit', function(event) { + event.preventDefault(); + form.classList.remove('has-success', 'has-error'); + var email = event.target.elements.email.value; + + request.post('/api/invites', { + email: email + }).then(function() { + form.classList.add('has-success'); + }).catch(function() { + form.classList.add('has-error'); + }); +}); diff --git a/src/stylus/style.styl b/src/stylus/style.styl index e09ddc3..8c17e0d 100644 --- a/src/stylus/style.styl +++ b/src/stylus/style.styl @@ -1,2 +1,81 @@ +@import url('http://fonts.googleapis.com/css?family=Open+Sans:400,300,700') + body, html margin 0 + font 14px 'Open Sans', sans-serif + height 100% + width 100% + font-weight 300 + +.jumbo + width 100% + height 100% + background url('../images/jumbo.jpg') + background-size cover + +.input + width 100% + height 45px + padding 1em + box-sizing border-box + font-size inherit + border 2px solid rgba(0, 0, 0, 0.3) + border-radius 5px + background transparent + color rgba(0, 0, 0, 0.5) + outline 0 + +.input::-webkit-input-placeholder + color rgba(0, 0, 0, 0.3) + +.input:-moz-placeholder + color rgba(0, 0, 0, 0.3) + opacity 1 + +.input::-moz-placeholder + color rgba(0, 0, 0, 0.3) + opacity 1 + +.input:-ms-input-placeholder + color rgba(0, 0, 0, 0.3) + + +.input.has-error, +.invite-form.has-error .input + border-color rgba(226, 33, 112, 0.6) + color rgba(226, 33, 112, 0.6) + +.btn + border-radius 3px + border 0 + padding 1em + font-size 14px + outline 0 + cursor pointer + +.invite-form + margin auto + position relative + + .btn + width 40px + height 32px + background #1a99aa + padding 0 + position absolute + right 8px + top 50% + margin-top -15px + border-bottom 2px solid #117280 + color rgba(255, 255, 255, 0.5) + + p + text-align center + margin-bottom 2em + +.form-container + max-width 500px + position absolute + top 50% + left 50% + transform translateY(-50%) translateX(-50%)