Skip to content

Commit

Permalink
update element to address touch interactions
Browse files Browse the repository at this point in the history
  • Loading branch information
blackfalcon committed Mar 1, 2019
1 parent f08b54f commit 89a81bb
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 11 deletions.
8 changes: 4 additions & 4 deletions ods-button/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ods-button/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"devDependencies": {
"@alaskaair/orion-design-tokens": "^0.4.1419434",
"@alaskaair/orion-web-core-style-sheets": "^0.3.1419101",
"@alaskaair/orion-web-core-style-sheets": "^0.3.1422151",
"@polymer/iron-demo-helpers": "^3.0.0-pre.19",
"@polymer/test-fixture": "^4.0.2",
"@webcomponents/webcomponentsjs": "^2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion ods-button/src/ods-button-css.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion ods-button/src/ods-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import buttonProperties from './generated/_buttonProperties-css.js';
import dotsProperties from './generated/_dotsProperties-css.js';
import odsButtonCss from "./ods-button-css.js";


class OdsButton extends LitElement {
constructor() {
super();
Expand All @@ -15,6 +14,11 @@ class OdsButton extends LitElement {
this.getButtonType = this.getButtonType.bind(this);
this.getButtonState = this.getButtonState.bind(this);
this.getButtonContext = this.getButtonContext.bind(this);

// adds event based on activelly being touched
this.addEventListener('touchstart', function() {
this.classList.add('is-touching');
});
}

static get properties() {
Expand Down
12 changes: 8 additions & 4 deletions ods-button/src/ods-button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,15 @@ span {
white-space: var(--ods-button-white-space);
cursor: var(--ods-button-cursor);

&:hover {
background-color: var(--ods-button-hover-background-color); // atlas hacked color
box-shadow: 0 0 16px var(--ods-button-hover-shadow-color); // midnight hacked color
// refeerence :host selector for .is-touching state selector
// only use hover UI if non-touch scenario
:host(:not(.is-touching)) & {
&:hover {
background-color: var(--ods-button-hover-background-color);
box-shadow: 0 0 16px var(--ods-button-hover-shadow-color);
}
}

&:active {
background-color: var(--ods-button-active-background-color);
}
Expand Down

0 comments on commit 89a81bb

Please sign in to comment.