Skip to content
This repository was archived by the owner on Aug 7, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions packages/oui-back-button/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
### Default

```html:preview
<oui-back-button href="#" heading="Title">
</oui-back-button>
<oui-back-button href="#">Title</oui-back-button>
```

### Aria label
Expand All @@ -27,11 +26,13 @@

## API

| Attribute | Type | Binding | One-time binding | Values | Default | Description |
| ---- | ---- | ---- | ---- | ---- | ---- | ---- |
| id | string | @? | true | | | id attribute of the input |
| name | string | @? | true | | | name attribute of the input |
| aria-label | string | @? | true | | | accessibility label |
| heading | string | @? | true | | | text of the header |
| on-click | function | &? | | | | callback on component click |
| href | string | @? | true | | | link url |
| Attribute | Type | Binding | One-time binding | Values | Default | Description
| ---- | ---- | ---- | ---- | ---- | ---- | ----
| `id` | string | @? | true | | | id attribute of the input
| `name` | string | @? | true | | | name attribute of the input
| `aria-label` | string | @? | true | | | accessibility label
| `heading` | string | @? | true | | | text of the header
| `on-click` | function | &? | | | | callback on component click
| `href` | string | @? | true | | | url of the return link
| `state` | string | @? | yes | | | state of the return link
| `stateParams` | object | <? | | | | state params of the return link
7 changes: 5 additions & 2 deletions packages/oui-back-button/src/back-button.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ export default {
heading: "@?",
title: "@?", // Deprecated: Replaced by 'heading'
onClick: "&?",
href: "@?"
}
href: "@?",
state: "@?",
stateParams: "<?"
},
transclude: true
};
5 changes: 5 additions & 0 deletions packages/oui-back-button/src/back-button.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,9 @@ export default class {
}
}

// Return value of "ui-sref"
getFullSref () {
return `${this.state}(${JSON.stringify(this.stateParams)})`;
}

}
11 changes: 9 additions & 2 deletions packages/oui-back-button/src/back-button.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<button ng-if="::!$ctrl.href"
<button ng-if="::!$ctrl.href && !$ctrl.state"
type="button"
class="oui-button oui-button_icon-alone"
ng-attr-aria-label="{{:: $ctrl.ariaLabel }}"
Expand All @@ -9,7 +9,14 @@
</button>
<a ng-if="::!!$ctrl.href"
class="oui-button oui-button_icon-alone"
ng-click="$ctrl.onBtnClick()"
ng-href="{{:: $ctrl.href }}">
<i class="oui-icon oui-icon-chevron-left" aria-hidden="true"></i>
</a>
<h2 class="oui-back-button_title oui-header_2" ng-bind="::$ctrl.heading"></h2>
<a ng-if="::!!$ctrl.state"
class="oui-button oui-button_icon-alone"
ng-click="$ctrl.onBtnClick()"
ui-sref="{{::$ctrl.getFullSref()}}">
<i class="oui-icon oui-icon-chevron-left" aria-hidden="true"></i>
</a>
<h2 class="oui-back-button_title oui-header_2" ng-transclude>{{::$ctrl.heading}}</h2>
18 changes: 9 additions & 9 deletions packages/oui-button/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,37 @@
### Default

```html:preview
<oui-button text="Default button" on-click="onClick()"></oui-button>
<oui-button on-click="onClick()">Default button</oui-button>
```

### Action buttons

```html:preview
<div>
<p>
<oui-button variant="primary" text="Primary"></oui-button>
<oui-button variant="secondary" text="Secondary"></oui-button>
<oui-button variant="link" text="Link"></oui-button>
</div>
</p>

<div>
<p>
<oui-button variant="primary" text="Primary" disabled></oui-button>
<oui-button variant="secondary" text="Secondary" disabled></oui-button>
<oui-button variant="link" text="Link" disabled></oui-button>
</div>
</p>
```

### Steps buttons

```html:preview
<div>
<p>
<oui-button variant-nav="previous" text="Previous" on-click="previous()"></oui-button>
<oui-button variant="primary" variant-nav="next" text="Next" on-click="next()"></oui-button>
</div>
</p>

<div>
<p>
<oui-button variant-nav="previous" text="Previous" on-click="previous()" disabled></oui-button>
<oui-button variant="primary" variant-nav="next" text="Next" on-click="next()" disabled></oui-button>
</div>
</p>
```

### Accessibility
Expand Down
3 changes: 2 additions & 1 deletion packages/oui-button/src/button.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ export default {
onClick: "&?"
},
controller,
template
template,
transclude: true
};
2 changes: 1 addition & 1 deletion packages/oui-button/src/button.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
>
<span aria-hidden="true" class="oui-icon oui-icon_circle oui-icon-chevron-left"
ng-if="::$ctrl.variantNav === 'previous'"></span>
<span ng-bind="::$ctrl.text"></span>
<span ng-transclude>{{::$ctrl.text}}</span>
<span aria-hidden="true" class="oui-icon oui-icon_circle oui-icon-chevron-right"
ng-if="::$ctrl.variantNav === 'next'"></span>
</button>