Skip to content

Commit

Permalink
Change modal to form
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinkace committed Mar 7, 2018
1 parent 1a52bed commit c6f90ec
Showing 1 changed file with 33 additions and 33 deletions.
66 changes: 33 additions & 33 deletions src/modal/title.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,44 @@ import state from "../state";
import css from "./title.css";

export default {
view : (vnode) => [
m("input", {
value : vnode.state.value,
placeholder : state.song.title,
class : css.input,
onkeydown : (e) => {
if(e.keyCode === 13 && vnode.state.value) {
view : (vnode) =>
m("form", {
onsubmit : (e) => {
e.preventDefault();

if(!vnode.state.value) {
return;
}

state.action("ADD TITLE", vnode.state.value);
}
},
oninput : m.withAttr("value", (v) => {
vnode.state.value = v;
m("input", {
value : vnode.state.value,
placeholder : state.song.title,
class : css.input,
oninput : m.withAttr("value", (v) => {
vnode.state.value = v;
}),
oncreate : (inputVnode) => {
inputVnode.dom.focus();
}
}),
oncreate : (inputVnode) => {
inputVnode.dom.focus();
}
}),
m("div", { class : css.buttons },
m("button", {
class : css.add,
onclick : () => {
if(!vnode.state.value) {
return;
m("div", { class : css.buttons },
m("button", {
type : "submit",
class : css.add
},
"add title"
),
m("button", {
class : css.cancel,
onclick : () => {
state.action("CLOSE MODAL");
}

state.action("ADD TITLE", vnode.state.value);
}
},
"add title"
),
m("button", {
class : css.cancel,
onclick : () => {
state.action("CLOSE MODAL");
}
},
"cancel"
},
"cancel"
)
)
)
]
};

0 comments on commit c6f90ec

Please sign in to comment.