Skip to content

Commit

Permalink
Merge pull request #14 from BrightspaceUI/dbatiste/hybrid-cleanup
Browse files Browse the repository at this point in the history
Dbatiste/hybrid cleanup
  • Loading branch information
dbatiste authored Jan 17, 2018
2 parents 914782d + a61b23e commit bc6b1ca
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 68 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ insert_final_newline = true
indent_style = tab
indent_size = 4

[{package.json,bower.json,.travis.yml,.eslintrc.json}]
[{*.json,*.yml}]
indent_style = space
indent_size = 2
52 changes: 26 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,27 @@

[Polymer](https://www.polymer-project.org)-based web component for D2L alerts.

For further information on this and other Brightspace UI components, see the docs at [ui.developers.brightspace.com](http://ui.developers.brightspace.com/).

## Installation

`d2l-alert` can be installed from [Bower][bower-url]:

```shell
bower install d2l-alert
```

## Usage

Include the [webcomponents.js](http://webcomponents.org/polyfills/) "lite" polyfill (for browsers who don't natively support web components), then import `d2l-alert.html`:

```html
<head>
<script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../d2l-alert/d2l-alert.html">
</head>
```

<!---
```
<custom-element-demo>
Expand Down Expand Up @@ -35,31 +56,10 @@
-->
```html
<d2l-alert type="warning">
A warning message.
A warning message.
</d2l-alert>
```

For further information on this and other Brightspace UI components, see the docs at [ui.developers.brightspace.com](http://ui.developers.brightspace.com/).

## Installation

`d2l-alert` can be installed from [Bower][bower-url]:

```shell
bower install d2l-alert
```

## Usage

Include the [webcomponents.js](http://webcomponents.org/polyfills/) "lite" polyfill (for browsers who don't natively support web components), then import `d2l-alert.html`:

```html
<head>
<script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="bower_components/d2l-alert/d2l-alert.html">
</head>
```

A `<d2l-alert>` custom element can now be used in your application by specifying one of the following types: `call-to-action`, `success`, `error`, or `warning`.

```html
Expand All @@ -70,27 +70,27 @@ A close button can optionally be rendered by specifying the `has-close-button` a

```html
<d2l-alert type="call-to-action" has-close-button>
A call-to-action message.
A call-to-action message.
</d2l-alert>
```

```javascript
alert.addEventListener('d2l-alert-closed', function() {
console.log('alert dismissed/closed');
console.log('alert dismissed/closed');
});
```

A custom action button can also be rendered if text is provided for the button.

```html
<d2l-alert type="call-to-action" button-text="Do it!">
A call-to-action message.
A call-to-action message.
</d2l-alert>
```

```javascript
alert.addEventListener('d2l-alert-button-pressed', function() {
console.log('alert custom action!');
console.log('alert custom action!');
});
```

Expand Down
25 changes: 9 additions & 16 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,29 @@
".eslintrc.json",
".gitignore",
".travis.yml",
"alert.gif",
"index.html",
"package.json",
"polymer.json",
"wct.config.json"
],
"dependencies": {
"polymer": "Polymer/polymer#1 - 2",
"d2l-colors": "^2.4.0 || ^3.1.0",
"d2l-icons": "^3.6.0 || ^4.4.0",
"d2l-colors": "^3.1.2",
"d2l-icons": "^4.5.1",
"d2l-localize-behavior": "^1.0.0",
"d2l-typography": "^5.3.0 || ^6.0.0"
"d2l-typography": "^6.0.0",
"polymer": "1.9.1 - 2"
},
"devDependencies": {
"iron-component-page": "PolymerElements/iron-component-page#1 - 2",
"iron-demo-helpers": "PolymerElements/iron-demo-helpers#1 - 2",
"web-component-tester": "^6.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^1.0.0"
"iron-component-page": "^2.0.0",
"iron-demo-helpers": "^2.0.0",
"web-component-tester": "^6.0.0"
},
"variants": {
"1.x": {
"dependencies": {
"d2l-colors": "^2.4.0",
"d2l-icons": "^3.6.0",
"polymer": "^1.9.1"
},
"devDependencies": {
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
"iron-demo-helpers": "PolymerElements/iron-demo-helpers#^1.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0",
"web-component-tester": "^5.0.0"
},
"resolutions": {
"webcomponentsjs": "^0.7"
}
Expand Down
25 changes: 13 additions & 12 deletions d2l-alert.html
Original file line number Diff line number Diff line change
Expand Up @@ -175,21 +175,22 @@
is: 'd2l-alert',

behaviors: [
window.D2L.PolymerBehaviors.Alert.LocalizeBehavior
D2L.PolymerBehaviors.Alert.LocalizeBehavior
],

properties: {
/**
* Fired when the custom action button is pressed.
*
* @event d2l-alert-button-pressed
*/
/**
* Fired when the custom action button is pressed.
*
* @event d2l-alert-button-pressed
*/

/**
* Fired when the alert is closed/hidden.
*
* @event d2l-alert-closed
*/
/**
* Fired when the alert is closed/hidden.
*
* @event d2l-alert-closed
*/

properties: {

/**
* Type of alert to display. Valid values are 'call-to-action', 'success', 'error', and 'warning'.
Expand Down
18 changes: 9 additions & 9 deletions localize-behavior.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
(function() {
'use strict';

/** @polymerBehavior */
var AlertLocalizeBehavior = {
window.D2L = window.D2L || {};
window.D2L.PolymerBehaviors = window.D2L.PolymerBehaviors || {};
window.D2L.PolymerBehaviors.Alert = window.D2L.PolymerBehaviors.Alert || {};

/** @polymerBehavior D2L.PolymerBehaviors.Alert.LocalizeBehavior */
D2L.PolymerBehaviors.Alert.LocalizeBehaviorImpl = {
properties: {
/**
* Localization resources.
Expand Down Expand Up @@ -57,14 +61,10 @@
}
};

window.D2L = window.D2L || {};
window.D2L.PolymerBehaviors = window.D2L.PolymerBehaviors || {};
window.D2L.PolymerBehaviors.Alert = window.D2L.PolymerBehaviors.Alert || {};

/** @polymerBehavior */
window.D2L.PolymerBehaviors.Alert.LocalizeBehavior = [
/** @polymerBehavior D2L.PolymerBehaviors.Alert.LocalizeBehavior */
D2L.PolymerBehaviors.Alert.LocalizeBehavior = [
D2L.PolymerBehaviors.LocalizeBehavior,
AlertLocalizeBehavior
D2L.PolymerBehaviors.Alert.LocalizeBehaviorImpl
];

})();
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
"author": "D2L Corporation",
"license": "Apache-2.0",
"devDependencies": {
"eslint": "^3.14.0",
"eslint-config-brightspace": "^0.2.4",
"eslint-plugin-html": "^1.7.0",
"eslint": "^4.15.0",
"eslint-config-brightspace": "^0.4.0",
"eslint-plugin-html": "^4.0.1",
"polymer-cli": "^1.5.7"
}
}
2 changes: 1 addition & 1 deletion wct.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
{
"browserName": "safari",
"platform": "OS X 10.12",
"version": "10.0"
"version": ""
},
{
"browserName": "microsoftedge",
Expand Down

0 comments on commit bc6b1ca

Please sign in to comment.