Skip to content
Snippets Groups Projects
Commit e78f4832 authored by Eugen Ciur's avatar Eugen Ciur
Browse files

awesome components!

parent 965ec865
No related branches found
No related tags found
No related merge requests found
{{#if @route}}
<LinkTo
@route={{@route}}
class="btn btn-success">
<i class="bi bi-plus-lg mx-1"></i>
{{this.text}}
</LinkTo>
{{else}}
<button
class="btn btn-success"
type="button"
{{on "click" @onClick}}>
<i class="bi bi-plus-lg mx-1"></i>
{{this.text}}
</button>
{{/if}}
import Component from '@glimmer/component';
class ButtonNewComponent extends Component {
/*
"New Button" component. Renders a button as either
html <a> tag or as <button>.
Arguments:
@route - if `route` argument is provided, button will
be rendered as <a>.
@onClick - if `onClick` argument is provided - button
will be rendered as <button>.
@text - button's text. Default value is "New".
Examples:
Render component as <button> with `onClick` handler:
<Button::New @onClick={{this.onToggleNew}} />
Render componet as <a> with given route:
<Button::New @route="automates.add" />
*/
get text() {
return this.args.text || "New";
}
}
export default ButtonNewComponent;
\ No newline at end of file
<button class="btn btn-success" type="button" {{on "click" this.onToggleNew}}>
<i class="bi bi-plus-lg mx-1"></i>New
</button>
<Button::New @onClick={{this.onToggleNew}} />
{{#if this.form_visible}}
<form>
......
<LinkTo
@route="automates.add"
class="btn btn-success">
<i class="bi bi-plus-lg mx-1"></i>New
</LinkTo>
<Button::New @route="automates.add" />
<div class="tags">
<table class="table table-striped align-middle">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment