Skip to content

Instantly share code, notes, and snippets.

@evgeniy-vashchuk
Created February 13, 2020 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evgeniy-vashchuk/e66e67325d05c105bd2af19c4d579763 to your computer and use it in GitHub Desktop.
Save evgeniy-vashchuk/e66e67325d05c105bd2af19c4d579763 to your computer and use it in GitHub Desktop.
Pug button mixin
//- +roundBtn({
//- href: "#",
//- size: "lg",
//- color: "outline-yellow",
//- alignment: "right",
//- text: "Explore",
//- modalTarget: "#orderInspectionFormModal",
//- buttonSubmit: false
//- })
mixin roundBtn(obj)
- var DEFAULT_OPTIONS = { href: "#", size: "lg", color: "outline-yellow", alignment: "right-alignment", text: "Some text", modalTarget: false, buttonSubmit: false };
- obj = Object.assign({}, DEFAULT_OPTIONS, obj || {});
if (obj.buttonSubmit)
button(type="submit" class="btn-round " + obj.size + " " + obj.color + (obj.alignment ? " " + obj.alignment + "-alignment" : ""))&attributes(attributes)
span.text= obj.text
else
a(href= obj.href class="btn-round " + obj.size + " " + obj.color + (obj.alignment ? " " + obj.alignment + "-alignment" : "") data-toggle=(obj.modalTarget ? 'modal' : false) data-target=(obj.modalTarget ? obj.modalTarget : false) data-dismiss=(obj.modalClose ? 'modal' : false) aria-label=(obj.modalClose ? 'Close' : false))&attributes(attributes)
span.text= obj.text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment