Skip to content

Instantly share code, notes, and snippets.

@MichaelSp
Created December 30, 2018 13:43
Show Gist options
  • Save MichaelSp/f15d42c6e53cc0b4f13ce2653d287d6e to your computer and use it in GitHub Desktop.
Save MichaelSp/f15d42c6e53cc0b4f13ce2653d287d6e to your computer and use it in GitHub Desktop.
hyperstack && materialize
class Login
include Hyperstack::Component
render do
Mat::Card() {login_page}
end
def action
DIV(class_name: "card-action") {A {"Login"}.on(:click) {submit}}
end
def login_page
DIV(class_name: "valign-wrapper login-page") do
DIV(class_name: "center-align row") do
Mat::Card(className: "col s12 hoverable", title: "Login", actions: [action.as_node] ) do ##<<< actions doesn't work
H4(class_name: "red-text") {@error}
FORM(class_name: 'material-form') {
DIV(class_name: 'input-field') do
INPUT(id: "email", name: "email", defaultValue: @email, autoComplete: 'off', data: {error: @error})
LABEL(htmlFor: "email", class_name: "#{"active" unless @email.blank?}") {'Email'}
end
DIV(class_name: 'input-field') do
INPUT(name: "password", autoComplete: 'off', type: "password")
LABEL(htmlFor: "password", class_name: "#{"active" unless @password.blank?}") {'Password'}
end
}.on(:submit) do |evt|
evt.prevent_default
submit
end
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment