chore: convert LinkButton to template-only

This commit is contained in:
Randall Morey committed 2021-11-03 13:12:04 -04:00
1 parent fa50bb425a
commit fcfcc4e42a
3 files changed
+35 -50

No files matched your search

@@ -1,26 +1,33 @@
<span class="rose-button-wrapper">
{{#if @iconLeft}}
<Rose::Icon
@name={{@iconLeft}}
@size="medium"
/>
{{/if}}
<LinkTo
class="rose-link-button {{if @style (concat "rose-button-" @style)}} {{if @iconOnly 'has-icon-only'}} {{if @iconLeft 'has-icon-left'}} {{if @iconRight 'has-icon-right'}}"
@route={{if @route @route}}
@query={{if @query @query}}
@model={{if @model @model}}
...attributes>
<span class="rose-button-wrapper">
{{#if @iconLeft}}
<Rose::Icon
@name={{@iconLeft}}
@size="medium"
/>
{{/if}}
<span class="rose-button-body">
{{yield}}
<span class="rose-button-body">
{{yield}}
</span>
{{#if @iconOnly}}
<Rose::Icon
@name={{@iconOnly}}
@size="medium"
/>
{{/if}}
{{#if @iconRight}}
<Rose::Icon
@name={{@iconRight}}
@size="medium"
/>
{{/if}}
</span>
{{#if @iconOnly}}
<Rose::Icon
@name={{@iconOnly}}
@size="medium"
/>
{{/if}}
{{#if @iconRight}}
<Rose::Icon
@name={{@iconRight}}
@size="medium"
/>
{{/if}}
</span>
</LinkTo>
@@ -1,26 +0,0 @@
import LinkComponent from '@ember/routing/link-component';
import layout from './index';
import { computed } from '@ember/object';
/**
* An achor element based on `rose-button` component styles
* An empty model cannot be passed in to `link-to` component when a route
* is defined. Thus, `link-to` component is used to generate this component.
*
* @example
* <Rose::LinkButton @submit={{true}} @style="primary">Save</Rose::LinkButton>
* <Rose::LinkButton @disabled={{true}} @style="secondary">Disabled</Rose::LinkButton>
*/
export default LinkComponent.extend({
layout,
classNames: ['rose-link-button'],
classNameBindings: [
'linkButtonStyle',
'iconOnly:has-icon-only',
'iconLeft:has-icon-left',
'iconRight:has-icon-right',
],
linkButtonStyle: computed(function () {
return this.style ? `rose-button-${this.style}` : '';
}),
});
@@ -1,3 +1,7 @@
<Rose::LinkButton @route="index" @style="primary" @iconRight="flight-icons/svg/entry-point-16">
Content
</Rose::LinkButton>
<h2>Checkbox Group</h2>
<Rose::Form::Checkbox::Group
@items={{this.items}}