Skip to content

Commit

Permalink
feat(Modal): use separate components for modal header and close butto…
Browse files Browse the repository at this point in the history
…n to allow for better customization
  • Loading branch information
simonihmig committed Feb 14, 2017
1 parent 647e725 commit 7ba6bc1
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 2 deletions.
28 changes: 28 additions & 0 deletions addon/components/bs-modal/header/close.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import Ember from 'ember';
import layout from '../../../templates/components/bs-modal/header/close';

/**
@class ModalHeaderClose
@namespace Components
@extends Ember.Component
@private
*/
export default Ember.Component.extend({
layout,
tagName: 'button',
classNames: ['close'],
attributeBindings: ['type', 'aria-label'],
'aria-label': 'Close',
type: 'button',

/**
* @event onClick
* @public
*/
onChange() {},

click() {
this.get('onClick')();
}
});
15 changes: 15 additions & 0 deletions addon/components/bs-modal/header/title.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Ember from 'ember';
import layout from '../../../templates/components/bs-modal/header/title';

/**
@class ModalHeaderTitle
@namespace Components
@extends Ember.Component
@private
*/
export default Ember.Component.extend({
layout,
tagName: 'h4',
classNames: ['modal-title']
});
4 changes: 2 additions & 2 deletions addon/templates/components/bs-modal/header.hbs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{{#if closeButton}}
<button type="button" class="close" aria-label="Close" onclick={{onClose}}><span aria-hidden="true">&times;</span></button>
{{bs-modal/header/close onClick=(action onClose)}}
{{/if}}
{{#if hasBlock}}
{{yield}}
{{else}}
<h4 class="modal-title">{{title}}</h4>
{{#bs-modal/header/title}}{{title}}{{/bs-modal/header/title}}
{{/if}}
1 change: 1 addition & 0 deletions addon/templates/components/bs-modal/header/close.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<span aria-hidden="true">&times;</span>
1 change: 1 addition & 0 deletions addon/templates/components/bs-modal/header/title.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{yield}}
1 change: 1 addition & 0 deletions app/components/bs-modal/header/close.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from 'ember-bootstrap/components/bs-modal/header/close';
1 change: 1 addition & 0 deletions app/components/bs-modal/header/title.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from 'ember-bootstrap/components/bs-modal/header/title';

0 comments on commit 7ba6bc1

Please sign in to comment.