Merge branch 'develop' into chore-error-messages
This commit is contained in:
20 files changed
+199
-63
No files matched your search
@@ -1,14 +1,26 @@
|
||||
import Component from '@ember/component';
|
||||
import LinkComponent from '@ember/routing/link-component';
|
||||
import layout from '../../templates/components/rose/link-button';
|
||||
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 Component.extend({
|
||||
export default LinkComponent.extend({
|
||||
layout,
|
||||
tagName: '',
|
||||
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}` : '';
|
||||
}),
|
||||
});
|
||||
@@ -12,7 +12,7 @@ Styles supported: primary, secondary, warning, and ghost.
|
||||
Disabling link button is not supported as it is an action on form components only.
|
||||
|
||||
```html
|
||||
<Rose::LinkButton @style="primary" @iconRight="chevron-right">
|
||||
<Rose::LinkButton @route="index" @style="primary" @iconRight="chevron-right">
|
||||
Content
|
||||
</Rose::LinkButton>
|
||||
```
|
||||
@@ -21,6 +21,7 @@ Disabling link button is not supported as it is an action on form components onl
|
||||
<Story name="Advanced">{{
|
||||
template: hbs`
|
||||
<Rose::LinkButton
|
||||
@route="index"
|
||||
@style={{style}}
|
||||
@iconLeft={{iconLeft}}
|
||||
@iconRight={{iconRight}}
|
||||
@@ -67,13 +68,13 @@ Disabling link button is not supported as it is an action on form components onl
|
||||
Similar to `Rose::Button`, icon only link button is supported.
|
||||
|
||||
```html
|
||||
<Rose::LinkButton @style="primary" @iconOnly="help-circle-outline" />
|
||||
<Rose::LinkButton @route="index" @style="primary" @iconOnly="help-circle-outline" />
|
||||
```
|
||||
|
||||
<Preview>
|
||||
<Story name="Icon Only">{{
|
||||
template: hbs`
|
||||
<Rose::LinkButton @style={{style}} @iconOnly={{iconOnly}} />
|
||||
<Rose::LinkButton @route="" @style={{style}} @iconOnly={{iconOnly}} />
|
||||
`,
|
||||
context: {
|
||||
style: select(
|
||||
|
||||
@@ -1,34 +1,26 @@
|
||||
<LinkTo
|
||||
...attributes
|
||||
@route={{@route}}
|
||||
@model={{@model}}
|
||||
class="rose-link-button {{if @style (concat "rose-button-" @style)}} {{if @iconLeft "has-icon-left"}} {{if @iconRight "has-icon-right"}} {{if @iconOnly "has-icon-only"}}"
|
||||
>
|
||||
<span class="rose-button-wrapper">
|
||||
{{#if @iconLeft}}
|
||||
<Rose::Icon
|
||||
@name={{@iconLeft}}
|
||||
@size="medium"
|
||||
/>
|
||||
{{/if}}
|
||||
|
||||
<span class="rose-button-wrapper">
|
||||
{{#if @iconLeft}}
|
||||
<Rose::Icon
|
||||
@name={{@iconLeft}}
|
||||
@size="medium"
|
||||
/>
|
||||
{{/if}}
|
||||
|
||||
<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 class="rose-button-body">
|
||||
{{yield}}
|
||||
</span>
|
||||
</LinkTo>
|
||||
|
||||
{{#if @iconOnly}}
|
||||
<Rose::Icon
|
||||
@name={{@iconOnly}}
|
||||
@size="medium"
|
||||
/>
|
||||
{{/if}}
|
||||
|
||||
{{#if @iconRight}}
|
||||
<Rose::Icon
|
||||
@name={{@iconRight}}
|
||||
@size="medium"
|
||||
/>
|
||||
{{/if}}
|
||||
</span>
|
||||
Reference in new issue
Block a user