questionnaire/assets/js/components/buttons.js

80 lines
2.1 KiB
JavaScript
Vendored

import m from "mithril"
import { Button} from "polythene-mithril"
import { ButtonCSS } from "polythene-css"
ButtonCSS.addStyle(".bordered-button", {
color_light_text: "#03a9f4",
color_light_border: "#03a9f4",
color_dark_text: "#03a9f4",
color_dark_border: "#03a9f4",
})
const buttonTextStyle = {
padding: ".6em .8em",
fontSize: "14px",
lineHeight: "14px",
fontWeight: "500",
textTransform: "uppercase",
whiteSpace: "pre"
}
export const editButton = {
view: function(vnode) {
return m(Button, {
id: "editBtn",
style: buttonTextStyle,
element: "div",
className: "bordered-button absolute-button",
borders: true,
label: [m("i.fa.fa-edit.fa-fw"), m.trust(" "), m("span", "Ubah")],
events: {
onclick: function() {
m.route.set(vnode.attrs.redirectURL)
}
}
})
}
}
export const seeButton = {
view: function(vnode) {
return m(Button, {
style: buttonTextStyle,
label: [m("i.fa.fa-eye.fa-fw"), m.trust(" "), m("span", "Lihat")],
borders: true,
className: "bordered-button",
events: {
onclick: function() {
/* Request ke section model */
// sModel.fetch(s.url)
/* Route */
m.route.set(vnode.attrs.redirectURL)
}
}
})
}
}
export const backButton = {
view: function() {
return m("span", {
style: {
fontSize: "14px",
textTransform: "uppercase",
whiteSpace: "pre"
}
}, m("i.fa.fa-arrow-left.fa-fw"), m.trust(" "), m("span", "Kembali"))
}
}
export const logoutButton = {
view: function() {
return m("span", {
style: {
fontSize: "14px",
textTransform: "uppercase"
}
}, m("i.fa.fa-sign-out.fa-fw"), m.trust(" "), m("span", "Keluar"))
}
}