From 668ab2980d4ed4c3545574bd557429ed7e331da5 Mon Sep 17 00:00:00 2001
From: Melanie Sumner
Date: Mon, 1 Jul 2019 13:23:46 -0500
Subject: [PATCH 01/24] worked on the navbar to resolve some a11y issues
---
addon/components/es-header/es-brand.js | 6 +
addon/components/es-header/es-search.js | 6 +
addon/components/es-navbar.js | 2 +-
addon/components/es-navbar/link/component.js | 14 +--
addon/components/es-navbar/link/template.hbs | 21 ++--
addon/components/es-search.js | 8 --
addon/styles/components/es-navbar.css | 105 +++++++++++-------
.../components/es-header/es-brand.hbs | 6 +
.../components/es-header/es-search.hbs | 13 +++
addon/templates/components/es-navbar.hbs | 45 +-------
addon/templates/components/es-search.hbs | 1 -
app/components/es-header/es-brand.js | 1 +
app/components/es-header/es-search.js | 1 +
app/components/es-search.js | 1 -
docs/concepts/accessibility.md | 5 +-
jsconfig.json | 1 +
.../es-brand-test.js} | 17 ++-
.../components/es-header/es-search-test.js | 26 +++++
18 files changed, 154 insertions(+), 125 deletions(-)
create mode 100644 addon/components/es-header/es-brand.js
create mode 100644 addon/components/es-header/es-search.js
delete mode 100644 addon/components/es-search.js
create mode 100644 addon/templates/components/es-header/es-brand.hbs
create mode 100644 addon/templates/components/es-header/es-search.hbs
delete mode 100644 addon/templates/components/es-search.hbs
create mode 100644 app/components/es-header/es-brand.js
create mode 100644 app/components/es-header/es-search.js
delete mode 100644 app/components/es-search.js
create mode 100644 jsconfig.json
rename tests/integration/components/{es-search-test.js => es-header/es-brand-test.js} (52%)
create mode 100644 tests/integration/components/es-header/es-search-test.js
diff --git a/addon/components/es-header/es-brand.js b/addon/components/es-header/es-brand.js
new file mode 100644
index 00000000..47bb421b
--- /dev/null
+++ b/addon/components/es-header/es-brand.js
@@ -0,0 +1,6 @@
+import Component from '@ember/component';
+import layout from '../../templates/components/es-header/es-brand';
+
+export default Component.extend({
+ layout
+});
diff --git a/addon/components/es-header/es-search.js b/addon/components/es-header/es-search.js
new file mode 100644
index 00000000..3239c15a
--- /dev/null
+++ b/addon/components/es-header/es-search.js
@@ -0,0 +1,6 @@
+import Component from '@ember/component';
+import layout from '../../templates/components/es-header/es-search';
+
+export default Component.extend({
+ layout
+});
diff --git a/addon/components/es-navbar.js b/addon/components/es-navbar.js
index d7d591cf..a2ffbe51 100644
--- a/addon/components/es-navbar.js
+++ b/addon/components/es-navbar.js
@@ -20,7 +20,7 @@ export default class EsNavbar extends Component {
}
toggleMenu() {
- let menu = this.element.querySelector('ul[role="menubar"]');
+ let menu = this.element.querySelector('.navbar-list');
menu.setAttribute('aria-expanded', menu.getAttribute('aria-expanded') !== 'true');
}
diff --git a/addon/components/es-navbar/link/component.js b/addon/components/es-navbar/link/component.js
index 57c4abfb..e4909b8e 100644
--- a/addon/components/es-navbar/link/component.js
+++ b/addon/components/es-navbar/link/component.js
@@ -8,11 +8,7 @@ import { next } from '@ember/runloop';
export default Component.extend({
layout,
tagName: 'li',
- tabIndex: 0,
-
- role: 'menuitem',
-
- attributeBindings: ['role'],
+ classNames: ['navbar-list-item'],
classNameBindings: ['isDropdown:dropdown'],
isDropdown: equal('link.type', 'dropdown'),
@@ -34,7 +30,7 @@ export default Component.extend({
navbar: service(),
didInsertElement() {
- this.element.tabIndex = -1;
+ // this.element.tabIndex = -1;
this.get('navbar').register(this);
this.domNode = this.element.querySelector('ul[role="menu"]');
@@ -51,8 +47,8 @@ export default Component.extend({
handleBlur() {
next(this, function() {
- let subItems = Array.from(this.element.querySelectorAll('ul[role="menu"] li'));
- let focused = subItems.find(item => document.activeElement === item.querySelector('a'));
+ let subItems = Array.from(this.element.querySelectorAll('.navbar-dropdown-list-item'));
+ let focused = subItems.find(item => document.activeElement === item.querySelector('button'));
// debugger
if(!focused) {
@@ -103,7 +99,7 @@ export default Component.extend({
}).volatile(),
setFocusToFirstItem() {
- let element = this.element.querySelector('ul[role="menu"] li a')
+ let element = this.element.querySelector('.navbar-dropdown-list-item-link')
if (element) {
element.focus();
}
diff --git a/addon/components/es-navbar/link/template.hbs b/addon/components/es-navbar/link/template.hbs
index fb7f6f1e..46cfc2d4 100644
--- a/addon/components/es-navbar/link/template.hbs
+++ b/addon/components/es-navbar/link/template.hbs
@@ -1,30 +1,25 @@
{{#if (eq link.type "link")}}
{{link.name}}
{{/if}}
{{#if (eq link.type "dropdown")}}
-
{{link.name}}
-
-
+
+
{{#each link.items as |item|}}
{{#if (eq item.type "link")}}
-
+
@@ -33,7 +28,7 @@
{{/if}}
{{#if (eq item.type "divider")}}
-
+
{{/if}}
{{/each}}
diff --git a/addon/components/es-search.js b/addon/components/es-search.js
deleted file mode 100644
index 38dabc68..00000000
--- a/addon/components/es-search.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import Component from '@ember/component';
-import layout from '../templates/components/es-search';
-
-export default Component.extend({
- layout,
- classNames: ['es-search'],
- ariaRole: 'search'
-});
diff --git a/addon/styles/components/es-navbar.css b/addon/styles/components/es-navbar.css
index 8a186529..fd9b14a8 100644
--- a/addon/styles/components/es-navbar.css
+++ b/addon/styles/components/es-navbar.css
@@ -1,23 +1,27 @@
-nav.es-navbar {
- width: 100%;
- max-width: var(--container-width-large);
- padding: 1rem;
- font-size: var(--text-preset-2);
+.es-navbar {
+ background-color: #1C1E23;
+ color: white;
display: flex;
flex-direction: column;
+ font-size: var(--text-preset-2);
+ max-width: var(--container-width-large);
+ padding: 0.5rem;
+ width: 100%;
}
.navbar-brand {
display: block;
- padding: 0 2rem;
- height: 6rem;
+ padding: 0 1rem;
+ height: 3rem;
+ /* TODO using order is not ideal for accessibility */
order: 2;
}
-.navbar-nav {
+.navbar-list {
padding: 0;
width: 100%;
- margin: 1rem 0 0 0;
+ margin: 0.5rem 0 0 0;
+ /* TODO using order is not ideal for accessibility */
order: 3;
}
@@ -27,9 +31,10 @@ nav.es-navbar {
border-radius: 4px;
border-color: var(--color-light);
margin-left: auto;
+ /* TODO using order is not ideal for accessibility */
order: 1;
- margin-bottom: -6rem;
- height: 6rem;
+ margin-bottom: -3rem;
+ height: 3rem;
}
.navbar-toggler .navbar-toggler-icon {
@@ -38,107 +43,125 @@ nav.es-navbar {
.navbar-toggler-icon {
display: block;
- width: 5rem;
- height: 3rem;
- vertical-align: middle;
+ width: 2.5rem;
+ height: 1.5rem;
content: "";
background: center center no-repeat;
background-size: 100% 100%;
}
-.navbar-nav >li {
+.navbar-list-item {
list-style: none;
position: relative;
}
-.navbar-link__dropdown {
- display: block;
- padding: 2rem;
- line-height: 2rem;
+.navbar-list-item-link {
+ padding: 1rem;
+ color: inherit;
text-decoration: none;
+}
+
+.navbar-list-item-dropdown-toggle {
+ background-color: transparent;
+ border-color: transparent;
color: #FFF;
- white-space: nowrap;
+ display: block;
font-weight: 600;
+ line-height: 1rem;
+ padding: 1rem;
+ text-decoration: none;
+ white-space: nowrap;
}
-.dropdown .navbar-link__dropdown::after {
+.navbar-list-item-dropdown-toggle::after {
content: '';
display: inline-block;
width: 0;
height: 0;
vertical-align: middle;
- margin-left: 1rem;
+ margin-left: 0.5rem;
border-top: 5px dashed;
- border-top: 5px solid var(--color-orange);
+ border-top: 5px solid var(--color-ember-orange);
border-right: 5px solid transparent;
border-left: 5px solid transparent;
}
-li[aria-expanded=true] .navbar-link__dropdown {
+.navbar-list-item-dropdown-toggle[aria-expanded="true"] {
background: #FFFFFF;
- color: var(--color-orange);
+ color: var(--color-ember-orange);
}
-ul[role="menu"] {
+.navbar-dropdown-list {
display: none;
padding: 0;
background: #FFFFFF;
- box-shadow: 5px 5px 5px 0 rgba(50,50,50,0.2);
+ box-shadow: 5px 5px 5px 0 rgba(50, 50, 50, 0.2);
}
-ul[role="menu"] hr {
+li.separator {
margin: 0;
+ /* TODO fix this */
+ border-bottom: 1px solid black;
}
-ul[role="menu"] li {
+.navbar-dropdown-list-item {
list-style: none;
display: block;
white-space: nowrap;
background: #FFF;
}
-ul[role="menu"] li> a {
- padding: 2rem;
+.navbar-dropdown-list-item-link {
+ padding: 1rem;
font-weight: 600;
display: block;
text-decoration: none;
- color: var(--color-orange);
+ color: var(--color-ember-orange);
}
-ul[role="menu"] li> a:hover, ul[role="menu"] li> a:focus {
- background: var(--color-orange);
+.navbar-dropdown-list-item-link:hover,
+.navbar-dropdown-list-item-link:focus {
+ background: var(--color-ember-orange);
color: var(--color-light);
}
-ul[role="menubar"][aria-expanded="true"] li{
+/* TODO This rule doesn't make sense so I'm commenting it out for now
+ul[role="menubar"][aria-expanded="true"] li {
background: blue;
-}
+} */
@media (min-width: 992px) {
nav.es-navbar {
display: flex;
flex-direction: row;
}
+
.navbar-brand {
padding: 0;
+ /* TODO using order is not ideal for accessibility */
order: 1;
}
- .navbar-nav {
+
+ .navbar-list {
+ /* TODO using order is not ideal for accessibility */
order: 2;
- margin: 0 2rem;
+ margin: 0 1rem;
padding: 0;
display: flex;
align-items: center;
}
+
.navbar-toggler {
+ /* TODO using order is not ideal for accessibility */
order: 3;
}
- ul[role="menu"] {
+
+ .navbar-dropdown-list {
display: none;
position: absolute;
padding: 0;
background: #FFFFFF;
- box-shadow: 5px 5px 5px 0 rgba(50,50,50,0.2);
+ box-shadow: 5px 5px 5px 0 rgba(50, 50, 50, 0.2);
}
-}
\ No newline at end of file
+}
diff --git a/addon/templates/components/es-header/es-brand.hbs b/addon/templates/components/es-header/es-brand.hbs
new file mode 100644
index 00000000..62dc441d
--- /dev/null
+++ b/addon/templates/components/es-header/es-brand.hbs
@@ -0,0 +1,6 @@
+
\ No newline at end of file
diff --git a/addon/templates/components/es-header/es-search.hbs b/addon/templates/components/es-header/es-search.hbs
new file mode 100644
index 00000000..befd3edc
--- /dev/null
+++ b/addon/templates/components/es-header/es-search.hbs
@@ -0,0 +1,13 @@
+{{#if hasBlock}}
+ {{yield}}
+{{else}}
+
+{{/if}}
\ No newline at end of file
diff --git a/addon/templates/components/es-navbar.hbs b/addon/templates/components/es-navbar.hbs
index 223158b5..c752a6e0 100644
--- a/addon/templates/components/es-navbar.hbs
+++ b/addon/templates/components/es-navbar.hbs
@@ -1,47 +1,12 @@
-
-
-
-
-
+
+
+
+
-
+
{{#each navLinks as |link index|}}
{{es-navbar/link link=link index=index}}
{{/each}}
-
- {{#if hasBlock}}
- {{yield}}
- {{else}}
-
- {{/if}}
-
-
-
-
diff --git a/addon/templates/components/es-search.hbs b/addon/templates/components/es-search.hbs
deleted file mode 100644
index 889d9eea..00000000
--- a/addon/templates/components/es-search.hbs
+++ /dev/null
@@ -1 +0,0 @@
-{{yield}}
diff --git a/app/components/es-header/es-brand.js b/app/components/es-header/es-brand.js
new file mode 100644
index 00000000..ceb875f4
--- /dev/null
+++ b/app/components/es-header/es-brand.js
@@ -0,0 +1 @@
+export { default } from 'ember-styleguide/components/es-header/es-brand';
\ No newline at end of file
diff --git a/app/components/es-header/es-search.js b/app/components/es-header/es-search.js
new file mode 100644
index 00000000..37289d06
--- /dev/null
+++ b/app/components/es-header/es-search.js
@@ -0,0 +1 @@
+export { default } from 'ember-styleguide/components/es-header/es-search';
\ No newline at end of file
diff --git a/app/components/es-search.js b/app/components/es-search.js
deleted file mode 100644
index be7e9220..00000000
--- a/app/components/es-search.js
+++ /dev/null
@@ -1 +0,0 @@
-export { default } from 'ember-styleguide/components/es-search';
\ No newline at end of file
diff --git a/docs/concepts/accessibility.md b/docs/concepts/accessibility.md
index bb50249d..2d69557f 100644
--- a/docs/concepts/accessibility.md
+++ b/docs/concepts/accessibility.md
@@ -2,5 +2,6 @@
## Code Guide
-- It is okay to ship code that can iterate to being a more inclusive experience, but can still be used by people with assistive technology.
-- it is not acceptable to ship code that actively breaks the experience for users with assistive technology.
+### Iterative Improvements
+- It is 100% okay to ship code that can iterate to being a more inclusive experience- as long as it can still be used by people with assistive technology.
+- It is not okay to ship code that actively breaks the experience for users with assistive technology.
diff --git a/jsconfig.json b/jsconfig.json
new file mode 100644
index 00000000..f408cac8
--- /dev/null
+++ b/jsconfig.json
@@ -0,0 +1 @@
+{"compilerOptions":{"target":"es6","experimentalDecorators":true},"exclude":["node_modules","bower_components","tmp","vendor",".git","dist"]}
\ No newline at end of file
diff --git a/tests/integration/components/es-search-test.js b/tests/integration/components/es-header/es-brand-test.js
similarity index 52%
rename from tests/integration/components/es-search-test.js
rename to tests/integration/components/es-header/es-brand-test.js
index 33882658..04d86ab3 100644
--- a/tests/integration/components/es-search-test.js
+++ b/tests/integration/components/es-header/es-brand-test.js
@@ -1,27 +1,26 @@
-import { render } from '@ember/test-helpers';
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
+import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
-module('Integration | Component | es search', function(hooks){
+module('Integration | Component | es-header/es-brand', function(hooks) {
setupRenderingTest(hooks);
test('it renders', async function(assert) {
-
// Set any properties with this.set('myProperty', 'value');
- // Handle any actions with this.on('myAction', function(val) { ... });
+ // Handle any actions with this.set('myAction', function(val) { ... });
- await render(hbs`{{es-search}}`);
+ await render(hbs`{{es-header/es-brand}}`);
- assert.dom('*').hasText('');
+ assert.equal(this.element.textContent.trim(), '');
// Template block usage:
await render(hbs`
- {{#es-search}}
+ {{#es-header/es-brand}}
template block text
- {{/es-search}}
+ {{/es-header/es-brand}}
`);
- assert.dom(this.element).hasText('template block text');
+ assert.equal(this.element.textContent.trim(), 'template block text');
});
});
diff --git a/tests/integration/components/es-header/es-search-test.js b/tests/integration/components/es-header/es-search-test.js
new file mode 100644
index 00000000..39b968b2
--- /dev/null
+++ b/tests/integration/components/es-header/es-search-test.js
@@ -0,0 +1,26 @@
+import { module, test } from 'qunit';
+import { setupRenderingTest } from 'ember-qunit';
+import { render } from '@ember/test-helpers';
+import hbs from 'htmlbars-inline-precompile';
+
+module('Integration | Component | es-header/es-search', function(hooks) {
+ setupRenderingTest(hooks);
+
+ test('it renders', async function(assert) {
+ // Set any properties with this.set('myProperty', 'value');
+ // Handle any actions with this.set('myAction', function(val) { ... });
+
+ await render(hbs`{{es-header/es-search}}`);
+
+ assert.equal(this.element.textContent.trim(), '');
+
+ // Template block usage:
+ await render(hbs`
+ {{#es-header/es-search}}
+ template block text
+ {{/es-header/es-search}}
+ `);
+
+ assert.equal(this.element.textContent.trim(), 'template block text');
+ });
+});
From 5b434d726925865572899bdd400a1788e9aafcc8 Mon Sep 17 00:00:00 2001
From: Melanie Sumner
Date: Mon, 1 Jul 2019 15:09:30 -0500
Subject: [PATCH 02/24] alpha sort properties, unitless line-heights
---
addon/styles/components/es-navbar.css | 177 +++++++++++++-------------
addon/styles/global.css | 11 +-
2 files changed, 96 insertions(+), 92 deletions(-)
diff --git a/addon/styles/components/es-navbar.css b/addon/styles/components/es-navbar.css
index fd9b14a8..cfc1cfbc 100644
--- a/addon/styles/components/es-navbar.css
+++ b/addon/styles/components/es-navbar.css
@@ -3,7 +3,9 @@
color: white;
display: flex;
flex-direction: column;
- font-size: var(--text-preset-2);
+ /* font-size: var(--text-preset-2); */
+ font-size: 1.2em;
+ font-weight: 500;
max-width: var(--container-width-large);
padding: 0.5rem;
width: 100%;
@@ -42,12 +44,12 @@
}
.navbar-toggler-icon {
+ background-size: 100% 100%;
+ background: center center no-repeat;
+ content: "";
display: block;
- width: 2.5rem;
height: 1.5rem;
- content: "";
- background: center center no-repeat;
- background-size: 100% 100%;
+ width: 2.5rem;
}
.navbar-list-item {
@@ -56,8 +58,8 @@
}
.navbar-list-item-link {
- padding: 1rem;
color: inherit;
+ padding: 1rem;
text-decoration: none;
}
@@ -66,102 +68,103 @@
border-color: transparent;
color: #FFF;
display: block;
- font-weight: 600;
- line-height: 1rem;
padding: 1rem;
text-decoration: none;
white-space: nowrap;
}
-.navbar-list-item-dropdown-toggle::after {
- content: '';
- display: inline-block;
- width: 0;
- height: 0;
- vertical-align: middle;
- margin-left: 0.5rem;
- border-top: 5px dashed;
- border-top: 5px solid var(--color-ember-orange);
- border-right: 5px solid transparent;
- border-left: 5px solid transparent;
-}
-
-.navbar-list-item-dropdown-toggle[aria-expanded="true"] {
- background: #FFFFFF;
- color: var(--color-ember-orange);
-}
-
-.navbar-dropdown-list {
- display: none;
- padding: 0;
- background: #FFFFFF;
- box-shadow: 5px 5px 5px 0 rgba(50, 50, 50, 0.2);
-}
-
-li.separator {
- margin: 0;
- /* TODO fix this */
- border-bottom: 1px solid black;
-}
-
-.navbar-dropdown-list-item {
- list-style: none;
- display: block;
- white-space: nowrap;
- background: #FFF;
-}
-
-.navbar-dropdown-list-item-link {
- padding: 1rem;
- font-weight: 600;
- display: block;
- text-decoration: none;
- color: var(--color-ember-orange);
-}
-
-.navbar-dropdown-list-item-link:hover,
-.navbar-dropdown-list-item-link:focus {
- background: var(--color-ember-orange);
- color: var(--color-light);
+.navbar-list-item-dropdown-toggle:hover {
+ cursor: pointer;
}
+ .navbar-list-item-dropdown-toggle::after {
+ border-left: 5px solid transparent;
+ border-right: 5px solid transparent;
+ border-top: 5px dashed;
+ border-top: 5px solid white;
+ content: '';
+ display: inline-block;
+ height: 0;
+ margin-left: 0.5rem;
+ vertical-align: middle;
+ width: 0;
+ }
-/* TODO This rule doesn't make sense so I'm commenting it out for now
-ul[role="menubar"][aria-expanded="true"] li {
- background: blue;
-} */
-
-@media (min-width: 992px) {
- nav.es-navbar {
- display: flex;
- flex-direction: row;
+ .navbar-list-item-dropdown-toggle[aria-expanded="true"] {
+ background: #FFFFFF;
+ color: var(--color-ember-orange);
}
- .navbar-brand {
+ .navbar-dropdown-list {
+ background: #FFFFFF;
+ box-shadow: 5px 5px 5px 0 rgba(50, 50, 50, 0.2);
+ display: none;
padding: 0;
- /* TODO using order is not ideal for accessibility */
- order: 1;
}
- .navbar-list {
- /* TODO using order is not ideal for accessibility */
- order: 2;
- margin: 0 1rem;
- padding: 0;
- display: flex;
- align-items: center;
+ li.separator {
+ margin: 0;
+ /* TODO fix this */
+ border-bottom: 1px solid black;
}
- .navbar-toggler {
- /* TODO using order is not ideal for accessibility */
- order: 3;
+ .navbar-dropdown-list-item {
+ background: #FFF;
+ display: block;
+ list-style: none;
+ white-space: nowrap;
}
- .navbar-dropdown-list {
- display: none;
- position: absolute;
- padding: 0;
- background: #FFFFFF;
- box-shadow: 5px 5px 5px 0 rgba(50, 50, 50, 0.2);
+ .navbar-dropdown-list-item-link {
+ color: var(--color-ember-orange);
+ display: block;
+ padding: 1rem;
+ text-decoration: none;
}
-}
+
+ .navbar-dropdown-list-item-link:hover,
+ .navbar-dropdown-list-item-link:focus {
+ background: var(--color-ember-orange);
+ color: var(--color-light);
+ }
+
+
+ /* TODO This rule doesn't make sense so I'm commenting it out for now
+ul[role="menubar"][aria-expanded="true"] li {
+ background: blue;
+} */
+
+ @media (min-width: 992px) {
+ nav.es-navbar {
+ display: flex;
+ flex-direction: row;
+ }
+
+ .navbar-brand {
+ padding: 0;
+ /* TODO using order is not ideal for accessibility */
+ order: 1;
+ }
+
+ .navbar-list {
+ /* TODO using order is not ideal for accessibility */
+ order: 2;
+ align-items: center;
+ display: flex;
+ margin: 0 1rem;
+ padding: 0;
+ }
+
+ .navbar-toggler {
+ /* TODO using order is not ideal for accessibility */
+ order: 3;
+ }
+
+ .navbar-dropdown-list {
+ background: #FFFFFF;
+ box-shadow: 5px 5px 5px 0 rgba(50, 50, 50, 0.2);
+ display: none;
+ padding: 0;
+ position: absolute;
+ }
+ }
\ No newline at end of file
diff --git a/addon/styles/global.css b/addon/styles/global.css
index 5f132708..4bca387e 100644
--- a/addon/styles/global.css
+++ b/addon/styles/global.css
@@ -17,7 +17,7 @@
--text-preset-5: 12rem;
--font-weight-1: 300;
--font-weight-2: 400;
- --font-weight-3: 600;
+ --font-weight-3: 600;
--spacing-1: 2rem;
--spacing-2: 4rem;
--spacing-3: 8rem;
@@ -29,7 +29,8 @@ body, html {
margin: 0;
padding: 0;
font-family: "Source Sans Pro", sans-serif;
- font-size: 2rem;
+ font-size: 16px;
+ line-height: 1.5;
}
@@ -53,14 +54,14 @@ h6 {
@media (max-width: 1280px) and (min-width: 421px) {
body,
html {
-
+
}
}
@media (max-width: 520px) {
body,
html {
-
+
}
}
@@ -78,4 +79,4 @@ h6 {
padding-top: 8rem;
padding-bottom: 8rem;
border: 1px solid #CCC;
-}
\ No newline at end of file
+}
From ceec3a23695b934ff69da0ec35b6c41bc754008b Mon Sep 17 00:00:00 2001
From: Chris Manson
Date: Mon, 1 Jul 2019 20:35:44 +0100
Subject: [PATCH 03/24] fixing expanding the navbar
---
addon/components/es-navbar/link/component.js | 4 ++--
docs/components/navbar.md | 14 +++++++++++---
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/addon/components/es-navbar/link/component.js b/addon/components/es-navbar/link/component.js
index e4909b8e..58eb9ff1 100644
--- a/addon/components/es-navbar/link/component.js
+++ b/addon/components/es-navbar/link/component.js
@@ -33,10 +33,10 @@ export default Component.extend({
// this.element.tabIndex = -1;
this.get('navbar').register(this);
- this.domNode = this.element.querySelector('ul[role="menu"]');
+ this.domNode = this.element.querySelector('ul.navbar-dropdown-list');
if(this.domNode) {
- this.element.querySelector('a').onmousedown = () => this.expand();
+ this.element.querySelector('button').onmousedown = () => this.expand();
let links = Array.from(this.domNode.querySelectorAll('a'))
links.forEach((ancor) => {
diff --git a/docs/components/navbar.md b/docs/components/navbar.md
index 88a92721..a00c6001 100644
--- a/docs/components/navbar.md
+++ b/docs/components/navbar.md
@@ -1,11 +1,19 @@
# Navbar
-The navbar comes with the default Ember links, if you would like to override the default links you can pass a json object to update the links in the navbar.
+The EsNavbar component is designed to be the same component used in all Ember websites that use the styleguide. It comes with the default links that are common to all sites. In most cases you will want to make sure the Navbar is inside an EsHeader which will make sure that it is properly centred.
```handlebars
-{{es-navbar}}
+
+
+
```
+## Custom Links
+
+If you would like to override the default links you can pass a json object to update the links in the navbar.
+
```handlebars
-{{es-navbar links=customLinks}}
+
+
+
```
From d19eeee58f29a120d006d4d2b33ff75b5bcb5f4d Mon Sep 17 00:00:00 2001
From: Melanie Sumner
Date: Mon, 1 Jul 2019 15:17:50 -0500
Subject: [PATCH 04/24] fixed the spelling of anchor
---
addon/components/es-navbar.js | 1 -
addon/components/es-navbar/link/component.js | 4 ++--
addon/components/es-navbar/link/template.hbs | 1 -
3 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/addon/components/es-navbar.js b/addon/components/es-navbar.js
index a2ffbe51..cf7cf312 100644
--- a/addon/components/es-navbar.js
+++ b/addon/components/es-navbar.js
@@ -21,7 +21,6 @@ export default class EsNavbar extends Component {
toggleMenu() {
let menu = this.element.querySelector('.navbar-list');
-
menu.setAttribute('aria-expanded', menu.getAttribute('aria-expanded') !== 'true');
}
}
diff --git a/addon/components/es-navbar/link/component.js b/addon/components/es-navbar/link/component.js
index 58eb9ff1..eb63b6e7 100644
--- a/addon/components/es-navbar/link/component.js
+++ b/addon/components/es-navbar/link/component.js
@@ -39,8 +39,8 @@ export default Component.extend({
this.element.querySelector('button').onmousedown = () => this.expand();
let links = Array.from(this.domNode.querySelectorAll('a'))
- links.forEach((ancor) => {
- ancor.addEventListener('blur', () => this.handleBlur());
+ links.forEach((anchor) => {
+ anchor.addEventListener('blur', () => this.handleBlur());
});
}
},
diff --git a/addon/components/es-navbar/link/template.hbs b/addon/components/es-navbar/link/template.hbs
index 46cfc2d4..9ab66fb4 100644
--- a/addon/components/es-navbar/link/template.hbs
+++ b/addon/components/es-navbar/link/template.hbs
@@ -10,7 +10,6 @@
{{link.name}}
From bf713eed235b2af9faa2026dd9e173ed4ed77170 Mon Sep 17 00:00:00 2001
From: Melanie Sumner
Date: Mon, 1 Jul 2019 15:18:32 -0500
Subject: [PATCH 05/24] no one needs z-index 1000
---
addon/components/es-navbar/link/component.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addon/components/es-navbar/link/component.js b/addon/components/es-navbar/link/component.js
index eb63b6e7..12bc6db3 100644
--- a/addon/components/es-navbar/link/component.js
+++ b/addon/components/es-navbar/link/component.js
@@ -65,7 +65,7 @@ export default Component.extend({
if(this.domNode) {
this.domNode.style.display = 'block';
this.domNode.style.top = rect.height + 'px';
- this.domNode.style.zIndex = 1000;
+ this.domNode.style.zIndex = 10;
}
this.set('expanded', true);
From b1af6fd703db00c3abcf848cb59ee80ad3fe414f Mon Sep 17 00:00:00 2001
From: Melanie Sumner
Date: Mon, 1 Jul 2019 15:23:20 -0500
Subject: [PATCH 06/24] added some todos
---
addon/components/es-navbar/link/component.js | 132 +++++++++++--------
1 file changed, 74 insertions(+), 58 deletions(-)
diff --git a/addon/components/es-navbar/link/component.js b/addon/components/es-navbar/link/component.js
index 12bc6db3..5cf8a684 100644
--- a/addon/components/es-navbar/link/component.js
+++ b/addon/components/es-navbar/link/component.js
@@ -7,24 +7,24 @@ import { next } from '@ember/runloop';
export default Component.extend({
layout,
- tagName: 'li',
- classNames: ['navbar-list-item'],
- classNameBindings: ['isDropdown:dropdown'],
- isDropdown: equal('link.type', 'dropdown'),
+ tagName: "li",
+ classNames: ["navbar-list-item"],
+ classNameBindings: ["isDropdown:dropdown"],
+ isDropdown: equal("link.type", "dropdown"),
keyCode: Object.freeze({
- 'TAB': 9,
- 'RETURN': 13,
- 'ESC': 27,
- 'SPACE': 32,
- 'PAGEUP': 33,
- 'PAGEDOWN': 34,
- 'END': 35,
- 'HOME': 36,
- 'LEFT': 37,
- 'UP': 38,
- 'RIGHT': 39,
- 'DOWN': 40
+ TAB: 9,
+ RETURN: 13,
+ ESC: 27,
+ SPACE: 32,
+ PAGEUP: 33,
+ PAGEDOWN: 34,
+ END: 35,
+ HOME: 36,
+ LEFT: 37,
+ UP: 38,
+ RIGHT: 39,
+ DOWN: 40
}),
navbar: service(),
@@ -32,29 +32,33 @@ export default Component.extend({
didInsertElement() {
// this.element.tabIndex = -1;
- this.get('navbar').register(this);
- this.domNode = this.element.querySelector('ul.navbar-dropdown-list');
+ this.get("navbar").register(this);
+ this.domNode = this.element.querySelector("ul.navbar-dropdown-list");
- if(this.domNode) {
- this.element.querySelector('button').onmousedown = () => this.expand();
- let links = Array.from(this.domNode.querySelectorAll('a'))
+ if (this.domNode) {
+ this.element.querySelector("button").onmousedown = () => this.expand();
+ let links = Array.from(this.domNode.querySelectorAll("a"));
- links.forEach((anchor) => {
- anchor.addEventListener('blur', () => this.handleBlur());
+ links.forEach(anchor => {
+ anchor.addEventListener("blur", () => this.handleBlur());
});
}
},
handleBlur() {
next(this, function() {
- let subItems = Array.from(this.element.querySelectorAll('.navbar-dropdown-list-item'));
- let focused = subItems.find(item => document.activeElement === item.querySelector('button'));
+ let subItems = Array.from(
+ this.element.querySelectorAll(".navbar-dropdown-list-item")
+ );
+ let focused = subItems.find(
+ item => document.activeElement === item.querySelector("button")
+ );
// debugger
- if(!focused) {
+ if (!focused) {
this.closePopupMenu();
}
- })
+ });
},
openPopupMenu() {
@@ -62,13 +66,14 @@ export default Component.extend({
var rect = this.element.getBoundingClientRect();
// Set CSS properties
- if(this.domNode) {
- this.domNode.style.display = 'block';
- this.domNode.style.top = rect.height + 'px';
+ // TODO add a CSS class instead and attach these properties in the stylesheet.
+ if (this.domNode) {
+ this.domNode.style.display = "block";
+ this.domNode.style.top = rect.height + "px";
this.domNode.style.zIndex = 10;
}
- this.set('expanded', true);
+ this.set("expanded", true);
},
closePopupMenu(force) {
@@ -81,38 +86,45 @@ export default Component.extend({
}
if (force || (!hasFocus && !this.hasHover && !controllerHasHover)) {
- if(this.domNode) {
- this.domNode.style.display = 'none';
+ if (this.domNode) {
+ this.domNode.style.display = "none";
this.domNode.style.zIndex = 0;
}
- this.set('expanded', false);
+ this.set("expanded", false);
}
},
expanded: computed({
+ //TODO fix this per https://deprecations.emberjs.com/v3.x/#toc_computed-property-volatile
get() {
- return this.element.getAttribute('aria-expanded') === 'true';
+ return this.element.getAttribute("aria-expanded") === "true";
},
set(key, value) {
- this.element.setAttribute('aria-expanded', value);
+ this.element.setAttribute("aria-expanded", value);
}
}).volatile(),
setFocusToFirstItem() {
- let element = this.element.querySelector('.navbar-dropdown-list-item-link')
+ let element = this.element.querySelector(".navbar-dropdown-list-item-link");
if (element) {
element.focus();
}
},
setFocusToLastItem() {
- this.element.querySelector('ul[role="menu"] li a:last-of-type').focus();
+ this.element
+ .querySelector(".navbar-dropdown-list-item-link:last-of-type")
+ .focus();
},
setFocusToNextItem() {
- let subItems = Array.from(this.element.querySelectorAll('ul[role="menu"] li'));
+ let subItems = Array.from(
+ this.element.querySelectorAll(".navbar-dropdown-list-item")
+ );
- let focused = subItems.find(item => document.activeElement === item.querySelector('a'));
+ let focused = subItems.find(
+ item => document.activeElement === item.querySelector("a")
+ );
let focusedIndex = subItems.indexOf(focused);
let nextItem = subItems[(focusedIndex + 1) % subItems.length];
@@ -121,13 +133,17 @@ export default Component.extend({
return;
}
- nextItem.querySelector('a').focus();
+ nextItem.querySelector("a").focus();
},
setFocusToPreviousItem() {
- let subItems = Array.from(this.element.querySelectorAll('ul[role="menu"] li'));
+ let subItems = Array.from(
+ this.element.querySelectorAll(".navbar-dropdown-list-item")
+ );
- let focused = subItems.find(item => document.activeElement === item.querySelector('a'));
+ let focused = subItems.find(
+ item => document.activeElement === item.querySelector("a")
+ );
let focusedIndex = subItems.indexOf(focused);
let nextIndex = focusedIndex - 1;
@@ -142,7 +158,7 @@ export default Component.extend({
return;
}
- nextItem.querySelector('a').focus();
+ nextItem.querySelector("a").focus();
},
keyDown(event) {
@@ -155,15 +171,15 @@ export default Component.extend({
case this.keyCode.SPACE:
// Create simulated mouse event to mimic the behavior of ATs
// and let the event handler handleClick do the housekeeping.
- mousedownEvent = new MouseEvent('mousedown', {
- 'view': window,
- 'bubbles': true,
- 'cancelable': true
+ mousedownEvent = new MouseEvent("mousedown", {
+ view: window,
+ bubbles: true,
+ cancelable: true
});
- clickEvent = new MouseEvent('click', {
- 'view': window,
- 'bubbles': true,
- 'cancelable': true
+ clickEvent = new MouseEvent("click", {
+ view: window,
+ bubbles: true,
+ cancelable: true
});
document.activeElement.dispatchEvent(mousedownEvent);
@@ -172,7 +188,7 @@ export default Component.extend({
flag = true;
break;
case this.keyCode.DOWN:
- if(this.get('expanded')) {
+ if (this.get("expanded")) {
this.setFocusToNextItem();
} else {
this.openPopupMenu();
@@ -182,17 +198,17 @@ export default Component.extend({
break;
case this.keyCode.LEFT:
- this.get('navbar').setFocusToPreviousItem(this);
+ this.get("navbar").setFocusToPreviousItem(this);
flag = true;
break;
case this.keyCode.RIGHT:
- this.get('navbar').setFocusToNextItem(this);
+ this.get("navbar").setFocusToNextItem(this);
flag = true;
break;
case this.keyCode.UP:
- if(this.get('expanded')) {
+ if (this.get("expanded")) {
this.setFocusToPreviousItem();
} else {
this.openPopupMenu();
@@ -229,12 +245,12 @@ export default Component.extend({
expand() {
next(this, () => {
- if(this.get('expanded')) {
+ if (this.get("expanded")) {
this.closePopupMenu();
} else {
this.openPopupMenu();
this.setFocusToFirstItem();
}
- })
+ });
}
});
From 41c52770e25e8098d153de08e198f2586ebc8e20 Mon Sep 17 00:00:00 2001
From: Melanie Sumner
Date: Mon, 1 Jul 2019 17:23:08 -0500
Subject: [PATCH 07/24] added TODOs for how the keyboard navigation should work
---
addon/components/es-navbar.js | 2 +-
addon/components/es-navbar/link/component.js | 253 ++-----------------
2 files changed, 24 insertions(+), 231 deletions(-)
diff --git a/addon/components/es-navbar.js b/addon/components/es-navbar.js
index cf7cf312..e6ad5fea 100644
--- a/addon/components/es-navbar.js
+++ b/addon/components/es-navbar.js
@@ -20,7 +20,7 @@ export default class EsNavbar extends Component {
}
toggleMenu() {
- let menu = this.element.querySelector('.navbar-list');
+ let menu = this.element.querySelector('.navbar-toggler');
menu.setAttribute('aria-expanded', menu.getAttribute('aria-expanded') !== 'true');
}
}
diff --git a/addon/components/es-navbar/link/component.js b/addon/components/es-navbar/link/component.js
index 5cf8a684..de0efeeb 100644
--- a/addon/components/es-navbar/link/component.js
+++ b/addon/components/es-navbar/link/component.js
@@ -12,245 +12,38 @@ export default Component.extend({
classNameBindings: ["isDropdown:dropdown"],
isDropdown: equal("link.type", "dropdown"),
+ // we need a few keys to respond when we use them
+ // the ESC key should close the dropdown menu we are currently on
+ // the TAB key should close the dropdown menu we are currently on and move focus to the next item in the top-level of the navbar
+ // the ENTER or SPACE key should toggle the dropdown menu. It will already visit whatever link is focused because we used semantic HTML
+ // the UP and DOWN key should move us up and down inside of the list we are already in
+
keyCode: Object.freeze({
TAB: 9,
RETURN: 13,
ESC: 27,
SPACE: 32,
- PAGEUP: 33,
- PAGEDOWN: 34,
- END: 35,
- HOME: 36,
- LEFT: 37,
UP: 38,
- RIGHT: 39,
DOWN: 40
}),
navbar: service(),
- didInsertElement() {
- // this.element.tabIndex = -1;
-
- this.get("navbar").register(this);
- this.domNode = this.element.querySelector("ul.navbar-dropdown-list");
-
- if (this.domNode) {
- this.element.querySelector("button").onmousedown = () => this.expand();
- let links = Array.from(this.domNode.querySelectorAll("a"));
-
- links.forEach(anchor => {
- anchor.addEventListener("blur", () => this.handleBlur());
- });
- }
- },
-
- handleBlur() {
- next(this, function() {
- let subItems = Array.from(
- this.element.querySelectorAll(".navbar-dropdown-list-item")
- );
- let focused = subItems.find(
- item => document.activeElement === item.querySelector("button")
- );
-
- // debugger
- if (!focused) {
- this.closePopupMenu();
- }
- });
- },
-
- openPopupMenu() {
- // Get position and bounding rectangle of controller object's DOM node
- var rect = this.element.getBoundingClientRect();
-
- // Set CSS properties
- // TODO add a CSS class instead and attach these properties in the stylesheet.
- if (this.domNode) {
- this.domNode.style.display = "block";
- this.domNode.style.top = rect.height + "px";
- this.domNode.style.zIndex = 10;
- }
-
- this.set("expanded", true);
- },
-
- closePopupMenu(force) {
- var controllerHasHover = this.hasHover;
-
- var hasFocus = this.hasFocus;
-
- if (!this.isMenubarItem) {
- controllerHasHover = false;
- }
-
- if (force || (!hasFocus && !this.hasHover && !controllerHasHover)) {
- if (this.domNode) {
- this.domNode.style.display = "none";
- this.domNode.style.zIndex = 0;
- }
- this.set("expanded", false);
- }
- },
-
- expanded: computed({
- //TODO fix this per https://deprecations.emberjs.com/v3.x/#toc_computed-property-volatile
- get() {
- return this.element.getAttribute("aria-expanded") === "true";
- },
- set(key, value) {
- this.element.setAttribute("aria-expanded", value);
- }
- }).volatile(),
-
- setFocusToFirstItem() {
- let element = this.element.querySelector(".navbar-dropdown-list-item-link");
- if (element) {
- element.focus();
- }
- },
-
- setFocusToLastItem() {
- this.element
- .querySelector(".navbar-dropdown-list-item-link:last-of-type")
- .focus();
- },
-
- setFocusToNextItem() {
- let subItems = Array.from(
- this.element.querySelectorAll(".navbar-dropdown-list-item")
- );
-
- let focused = subItems.find(
- item => document.activeElement === item.querySelector("a")
- );
- let focusedIndex = subItems.indexOf(focused);
-
- let nextItem = subItems[(focusedIndex + 1) % subItems.length];
-
- if (!nextItem) {
- return;
- }
-
- nextItem.querySelector("a").focus();
- },
-
- setFocusToPreviousItem() {
- let subItems = Array.from(
- this.element.querySelectorAll(".navbar-dropdown-list-item")
- );
-
- let focused = subItems.find(
- item => document.activeElement === item.querySelector("a")
- );
- let focusedIndex = subItems.indexOf(focused);
-
- let nextIndex = focusedIndex - 1;
-
- if (nextIndex < 0) {
- nextIndex = subItems.length - 1;
- }
-
- let nextItem = subItems[nextIndex];
-
- if (!nextItem) {
- return;
- }
-
- nextItem.querySelector("a").focus();
- },
-
- keyDown(event) {
- let flag = false;
- let clickEvent;
- let mousedownEvent;
-
- switch (event.keyCode) {
- case this.keyCode.RETURN:
- case this.keyCode.SPACE:
- // Create simulated mouse event to mimic the behavior of ATs
- // and let the event handler handleClick do the housekeeping.
- mousedownEvent = new MouseEvent("mousedown", {
- view: window,
- bubbles: true,
- cancelable: true
- });
- clickEvent = new MouseEvent("click", {
- view: window,
- bubbles: true,
- cancelable: true
- });
-
- document.activeElement.dispatchEvent(mousedownEvent);
- document.activeElement.dispatchEvent(clickEvent);
-
- flag = true;
- break;
- case this.keyCode.DOWN:
- if (this.get("expanded")) {
- this.setFocusToNextItem();
- } else {
- this.openPopupMenu();
- this.setFocusToFirstItem();
- }
- flag = true;
- break;
-
- case this.keyCode.LEFT:
- this.get("navbar").setFocusToPreviousItem(this);
- flag = true;
- break;
-
- case this.keyCode.RIGHT:
- this.get("navbar").setFocusToNextItem(this);
- flag = true;
- break;
-
- case this.keyCode.UP:
- if (this.get("expanded")) {
- this.setFocusToPreviousItem();
- } else {
- this.openPopupMenu();
- this.setFocusToLastItem();
- }
- break;
-
- case this.keyCode.HOME:
- case this.keyCode.PAGEUP:
- this.setFocusToFirstItem();
- flag = true;
- break;
-
- case this.keyCode.END:
- case this.keyCode.PAGEDOWN:
- this.setFocusToLastItem();
- flag = true;
- break;
-
- case this.keyCode.TAB:
- this.closePopupMenu(true);
- break;
-
- case this.keyCode.ESC:
- this.closePopupMenu(true);
- break;
- }
-
- if (flag) {
- event.stopPropagation();
- event.preventDefault();
- }
- },
-
- expand() {
- next(this, () => {
- if (this.get("expanded")) {
- this.closePopupMenu();
- } else {
- this.openPopupMenu();
- this.setFocusToFirstItem();
- }
- });
- }
+ // TODO open dropdown menu
+ // - set aria-expanded on the dropdown button to true
+ // - show the dropdown-list
+ // - remove tabindex=-1 from links in the dropdown-list
+
+ // TODO close dropdown menu
+ // - set aria-expanded on the dropdown button to false
+ // - hide the dropdown-list
+ // - add tabindex=-1 to the links in the dropdown-list
+
+ // TODO down arrow key navigation
+ // - moves focus to the next link in the list
+ // - if it's at the last item, close the dropdown menu (3 steps) then move focus to the next top-level item in the navbar
+
+ // TODO up arrow key navigation
+ // - moves focus to the previous item in the list.
+ // - if it's at the first item, close the dropdown menu (3 steps) then move focus to the previous top-level item in the navbar
});
From 3382b2c71e9ed76c6e78eb80128eb995e0d419b1 Mon Sep 17 00:00:00 2001
From: Melanie Sumner
Date: Mon, 1 Jul 2019 17:46:13 -0500
Subject: [PATCH 08/24] added more TODOs
---
addon/components/es-navbar/link/component.js | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/addon/components/es-navbar/link/component.js b/addon/components/es-navbar/link/component.js
index de0efeeb..7c9a7ade 100644
--- a/addon/components/es-navbar/link/component.js
+++ b/addon/components/es-navbar/link/component.js
@@ -29,21 +29,29 @@ export default Component.extend({
navbar: service(),
- // TODO open dropdown menu
+ // TODO open the dropdown menu
// - set aria-expanded on the dropdown button to true
// - show the dropdown-list
// - remove tabindex=-1 from links in the dropdown-list
- // TODO close dropdown menu
+ // TODO close the dropdown menu
// - set aria-expanded on the dropdown button to false
// - hide the dropdown-list
// - add tabindex=-1 to the links in the dropdown-list
// TODO down arrow key navigation
// - moves focus to the next link in the list
- // - if it's at the last item, close the dropdown menu (3 steps) then move focus to the next top-level item in the navbar
+ // - if it's at the last item, either: don't do anything, or go to the first item in the dropdown-list
// TODO up arrow key navigation
// - moves focus to the previous item in the list.
- // - if it's at the first item, close the dropdown menu (3 steps) then move focus to the previous top-level item in the navbar
+ // - if it's at the first item, either: don't do anything, or go to the last item in the dropdown-list
+
+ // TODO questions to answer:
+ // - if I'm in a dropdown list, should I be able to TAB key through that list?
+ // - if yes, what should happen when I am on the last item in the list and press the TAB key again?
+ // - also remember that SHIFT + TAB will need to work too (if TAB does)
+
+
+
});
From 61ed66436ca7b1d5cf6b305263dcaa45231b8d49 Mon Sep 17 00:00:00 2001
From: Melanie Sumner
Date: Mon, 1 Jul 2019 17:47:10 -0500
Subject: [PATCH 09/24] added more TODOs
---
addon/components/es-navbar/link/component.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/addon/components/es-navbar/link/component.js b/addon/components/es-navbar/link/component.js
index 7c9a7ade..96c6489f 100644
--- a/addon/components/es-navbar/link/component.js
+++ b/addon/components/es-navbar/link/component.js
@@ -51,6 +51,7 @@ export default Component.extend({
// - if I'm in a dropdown list, should I be able to TAB key through that list?
// - if yes, what should happen when I am on the last item in the list and press the TAB key again?
// - also remember that SHIFT + TAB will need to work too (if TAB does)
+ // - how much of this should go into es-navbar.js instead of here in the es-navbar/link component?
From eae226d1baa443cc40db75badc5b3e58822c1ec7 Mon Sep 17 00:00:00 2001
From: Melanie Sumner
Date: Wed, 3 Jul 2019 12:36:17 -0500
Subject: [PATCH 10/24] added functionality to navbar
---
addon/components/es-navbar/link/component.js | 101 ++++++++++++-------
addon/components/es-navbar/link/template.hbs | 40 ++++----
addon/styles/components/es-navbar.css | 9 +-
3 files changed, 92 insertions(+), 58 deletions(-)
diff --git a/addon/components/es-navbar/link/component.js b/addon/components/es-navbar/link/component.js
index 96c6489f..d64e6ee2 100644
--- a/addon/components/es-navbar/link/component.js
+++ b/addon/components/es-navbar/link/component.js
@@ -3,21 +3,23 @@ import layout from './template';
import { computed } from '@ember/object';
import { equal } from '@ember/object/computed';
import { inject as service } from '@ember/service';
-import { next } from '@ember/runloop';
+import { schedule, next } from '@ember/runloop';
export default Component.extend({
layout,
- tagName: "li",
- classNames: ["navbar-list-item"],
- classNameBindings: ["isDropdown:dropdown"],
- isDropdown: equal("link.type", "dropdown"),
+ tagName: 'li',
+ classNames: ['navbar-list-item'],
+ classNameBindings: ['isDropdown:dropdown'],
+ isDropdown: equal('link.type', 'dropdown'),
- // we need a few keys to respond when we use them
- // the ESC key should close the dropdown menu we are currently on
- // the TAB key should close the dropdown menu we are currently on and move focus to the next item in the top-level of the navbar
- // the ENTER or SPACE key should toggle the dropdown menu. It will already visit whatever link is focused because we used semantic HTML
- // the UP and DOWN key should move us up and down inside of the list we are already in
+ isDropdownOpen: false,
+ // because aria-expanded requires a string value instead of a boolean
+ isExpanded: computed('isDropdownOpen', function() {
+ return this.isDropdownOpen ? 'true' : 'false';
+ }),
+
+ // TODO do we need this?
keyCode: Object.freeze({
TAB: 9,
RETURN: 13,
@@ -27,32 +29,59 @@ export default Component.extend({
DOWN: 40
}),
- navbar: service(),
-
- // TODO open the dropdown menu
- // - set aria-expanded on the dropdown button to true
- // - show the dropdown-list
- // - remove tabindex=-1 from links in the dropdown-list
-
- // TODO close the dropdown menu
- // - set aria-expanded on the dropdown button to false
- // - hide the dropdown-list
- // - add tabindex=-1 to the links in the dropdown-list
-
- // TODO down arrow key navigation
- // - moves focus to the next link in the list
- // - if it's at the last item, either: don't do anything, or go to the first item in the dropdown-list
-
- // TODO up arrow key navigation
- // - moves focus to the previous item in the list.
- // - if it's at the first item, either: don't do anything, or go to the last item in the dropdown-list
-
- // TODO questions to answer:
- // - if I'm in a dropdown list, should I be able to TAB key through that list?
- // - if yes, what should happen when I am on the last item in the list and press the TAB key again?
- // - also remember that SHIFT + TAB will need to work too (if TAB does)
- // - how much of this should go into es-navbar.js instead of here in the es-navbar/link component?
-
+ navbar: service(), //TODO also do we need this too?
+
+ actions: {
+ triggerDropdown() {
+ this.toggleProperty('isDropdownOpen');
+
+ if (this.isDropdownOpen) {
+ // once it's open, let's make sure it can do some things
+ schedule('afterRender', this, function() {
+ // Define startup states
+ // Dropdown list
+ let dropdownList = this.element.querySelector('.navbar-dropdown-list');
+
+ // Identify / set focus on the first item in the dropdown list automatically
+ let firstFocusable = this.element.querySelector('.navbar-dropdown-list li:first-of-type a');
+ firstFocusable.focus();
+
+ // Need some event listeners for keyboard events
+ dropdownList.addEventListener('keydown', event => {
+
+ // Listen for ESC key to exit
+ if (event.keyCode === 27 && this.isDropdownOpen) {
+ this.closeDropdown();
+ } else if (this.isDropdownOpen) {
+ // if focus leaves the open dropdown, close it (without trying to otherwise control focus)
+ this.handleBlur();
+ } else {
+ return;
+ }
+ });
+ });
+ }
+ }
+ },
+ closeDropdown() {
+ // set the isDropdownOpen to false, which will make the dropdown go away
+ this.set('isDropdownOpen', false);
+ // after that rendering bit happens, we need to return the focus to the trigger
+ schedule('afterRender', this, function() {
+ let dropdownTrigger = this.element.querySelector('.navbar-list-item-dropdown-toggle');
+ dropdownTrigger.focus();
+ });
+ },
+
+ handleBlur() {
+ next(this, function() {
+ let subItems = Array.from(this.element.querySelectorAll('.navbar-dropdown-list li'));
+ let focused = subItems.find(item => document.activeElement === item.querySelector('a'));
+ if (!focused) {
+ this.set('isDropdownOpen', false);
+ }
+ });
+ }
});
diff --git a/addon/components/es-navbar/link/template.hbs b/addon/components/es-navbar/link/template.hbs
index 9ab66fb4..5b4f8935 100644
--- a/addon/components/es-navbar/link/template.hbs
+++ b/addon/components/es-navbar/link/template.hbs
@@ -8,27 +8,29 @@
{{/if}}
{{#if (eq link.type "dropdown")}}
{{link.name}}
-
- {{#each link.items as |item|}}
- {{#if (eq item.type "link")}}
-
-
- {{item.name}}
-
-
- {{/if}}
- {{#if (eq item.type "divider")}}
-
- {{/if}}
- {{/each}}
-
+ {{#if isDropdownOpen}}
+
+ {{#each link.items as |item|}}
+ {{#if (eq item.type "link")}}
+
+
+ {{item.name}}
+
+
+ {{/if}}
+ {{#if (eq item.type "divider")}}
+
+ {{/if}}
+ {{/each}}
+
+ {{/if}}
{{/if}}
diff --git a/addon/styles/components/es-navbar.css b/addon/styles/components/es-navbar.css
index cfc1cfbc..7c71965a 100644
--- a/addon/styles/components/es-navbar.css
+++ b/addon/styles/components/es-navbar.css
@@ -91,14 +91,16 @@
}
.navbar-list-item-dropdown-toggle[aria-expanded="true"] {
- background: #FFFFFF;
color: var(--color-ember-orange);
}
+ .navbar-list-item-dropdown-toggle[aria-expanded="true"]:after {
+ border-top-color: var(--color-ember-orange);
+ }
+
.navbar-dropdown-list {
background: #FFFFFF;
box-shadow: 5px 5px 5px 0 rgba(50, 50, 50, 0.2);
- display: none;
padding: 0;
}
@@ -138,6 +140,7 @@ ul[role="menubar"][aria-expanded="true"] li {
nav.es-navbar {
display: flex;
flex-direction: row;
+ padding: 0;
}
.navbar-brand {
@@ -163,8 +166,8 @@ ul[role="menubar"][aria-expanded="true"] li {
.navbar-dropdown-list {
background: #FFFFFF;
box-shadow: 5px 5px 5px 0 rgba(50, 50, 50, 0.2);
- display: none;
padding: 0;
position: absolute;
+ z-index: 100;
}
}
\ No newline at end of file
From acc1589dbc559fe5948097e2b8b96aa7ef70251d Mon Sep 17 00:00:00 2001
From: Melanie Sumner
Date: Wed, 3 Jul 2019 12:38:32 -0500
Subject: [PATCH 11/24] hid the toggle for desktop viewports
---
addon/styles/components/es-navbar.css | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/addon/styles/components/es-navbar.css b/addon/styles/components/es-navbar.css
index 7c71965a..1b887f64 100644
--- a/addon/styles/components/es-navbar.css
+++ b/addon/styles/components/es-navbar.css
@@ -159,8 +159,7 @@ ul[role="menubar"][aria-expanded="true"] li {
}
.navbar-toggler {
- /* TODO using order is not ideal for accessibility */
- order: 3;
+ display: none; /* TODO remove this properly or else screen readers will still pick up on it */
}
.navbar-dropdown-list {
From aabd3e0b24cb531e86885b58825c9ff799fb701b Mon Sep 17 00:00:00 2001
From: Melanie Sumner
Date: Fri, 5 Jul 2019 11:31:26 -0500
Subject: [PATCH 12/24] trying to reset the jsconfig.json file, not sure why it
committed
---
addon/components/es-navbar/link/component.js | 10 ----------
jsconfig.json | 15 ++++++++++++++-
2 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/addon/components/es-navbar/link/component.js b/addon/components/es-navbar/link/component.js
index d64e6ee2..1c733361 100644
--- a/addon/components/es-navbar/link/component.js
+++ b/addon/components/es-navbar/link/component.js
@@ -19,16 +19,6 @@ export default Component.extend({
return this.isDropdownOpen ? 'true' : 'false';
}),
- // TODO do we need this?
- keyCode: Object.freeze({
- TAB: 9,
- RETURN: 13,
- ESC: 27,
- SPACE: 32,
- UP: 38,
- DOWN: 40
- }),
-
navbar: service(), //TODO also do we need this too?
actions: {
diff --git a/jsconfig.json b/jsconfig.json
index f408cac8..7e14a498 100644
--- a/jsconfig.json
+++ b/jsconfig.json
@@ -1 +1,14 @@
-{"compilerOptions":{"target":"es6","experimentalDecorators":true},"exclude":["node_modules","bower_components","tmp","vendor",".git","dist"]}
\ No newline at end of file
+{
+ "compilerOptions": {
+ "target": "es6",
+ "experimentalDecorators": true
+ },
+ "exclude": [
+ "node_modules",
+ "bower_components",
+ "tmp",
+ "vendor",
+ ".git",
+ "dist"
+ ]
+}
\ No newline at end of file
From b2f75dda0b3636f96dd792b0bca000e3b19691b9 Mon Sep 17 00:00:00 2001
From: Melanie Sumner
Date: Fri, 5 Jul 2019 13:14:43 -0500
Subject: [PATCH 13/24] added removeEventListener
---
addon/components/es-navbar/link/component.js | 37 ++++++++++++++------
1 file changed, 26 insertions(+), 11 deletions(-)
diff --git a/addon/components/es-navbar/link/component.js b/addon/components/es-navbar/link/component.js
index 1c733361..6c926dcb 100644
--- a/addon/components/es-navbar/link/component.js
+++ b/addon/components/es-navbar/link/component.js
@@ -28,23 +28,24 @@ export default Component.extend({
if (this.isDropdownOpen) {
// once it's open, let's make sure it can do some things
schedule('afterRender', this, function() {
- // Define startup states
- // Dropdown list
+
+
+ // move focus to the first item in the dropdown
let dropdownList = this.element.querySelector('.navbar-dropdown-list');
+ this.handleFirstElementFocus();
- // Identify / set focus on the first item in the dropdown list automatically
- let firstFocusable = this.element.querySelector('.navbar-dropdown-list li:first-of-type a');
- firstFocusable.focus();
-
- // Need some event listeners for keyboard events
+ // add event listeners for keyboard events
dropdownList.addEventListener('keydown', event => {
-
- // Listen for ESC key to exit
+
+ // ESC key should close the dropdown and return focus to the toggle
if (event.keyCode === 27 && this.isDropdownOpen) {
this.closeDropdown();
+ this.returnFocus();
+
+ // if focus leaves the open dropdown, close it (without trying to otherwise control focus)
} else if (this.isDropdownOpen) {
- // if focus leaves the open dropdown, close it (without trying to otherwise control focus)
this.handleBlur();
+
} else {
return;
}
@@ -53,14 +54,24 @@ export default Component.extend({
}
}
},
+
closeDropdown() {
// set the isDropdownOpen to false, which will make the dropdown go away
this.set('isDropdownOpen', false);
+ },
+
+ handleFirstElementFocus() {
+ // Identify / set focus on the first item in the dropdown list automatically
+ let firstFocusable = this.element.querySelector('.navbar-dropdown-list li:first-of-type a');
+ firstFocusable.focus();
+ },
+
+ returnFocus() {
// after that rendering bit happens, we need to return the focus to the trigger
schedule('afterRender', this, function() {
let dropdownTrigger = this.element.querySelector('.navbar-list-item-dropdown-toggle');
dropdownTrigger.focus();
- });
+ });
},
handleBlur() {
@@ -72,6 +83,10 @@ export default Component.extend({
this.set('isDropdownOpen', false);
}
});
+ },
+
+ willDestroyElement() {
+ document.removeEventListener('keydown', this.triggerDropdown);
}
});
From a6d9f680ac4b00a97f8428ff5c76f93e40d9077b Mon Sep 17 00:00:00 2001
From: Melanie Sumner
Date: Fri, 5 Jul 2019 14:05:07 -0500
Subject: [PATCH 14/24] added a click event listener
---
addon/components/es-navbar/link/component.js | 43 ++++++++++++--------
1 file changed, 25 insertions(+), 18 deletions(-)
diff --git a/addon/components/es-navbar/link/component.js b/addon/components/es-navbar/link/component.js
index 6c926dcb..31244515 100644
--- a/addon/components/es-navbar/link/component.js
+++ b/addon/components/es-navbar/link/component.js
@@ -19,7 +19,7 @@ export default Component.extend({
return this.isDropdownOpen ? 'true' : 'false';
}),
- navbar: service(), //TODO also do we need this too?
+ navbar: service(),
actions: {
triggerDropdown() {
@@ -29,11 +29,16 @@ export default Component.extend({
// once it's open, let's make sure it can do some things
schedule('afterRender', this, function() {
-
// move focus to the first item in the dropdown
let dropdownList = this.element.querySelector('.navbar-dropdown-list');
this.handleFirstElementFocus();
+ dropdownList.addEventListener('click', event =>{
+ if (this.isDropdownOpen) {
+ this.handleBlur();
+ }
+ });
+
// add event listeners for keyboard events
dropdownList.addEventListener('keydown', event => {
@@ -42,10 +47,10 @@ export default Component.extend({
this.closeDropdown();
this.returnFocus();
- // if focus leaves the open dropdown, close it (without trying to otherwise control focus)
+ // if focus leaves the open dropdown via keypress, close it (without trying to otherwise control focus)
} else if (this.isDropdownOpen) {
this.handleBlur();
-
+
} else {
return;
}
@@ -60,8 +65,21 @@ export default Component.extend({
this.set('isDropdownOpen', false);
},
+ handleBlur() {
+ next(this, function() {
+ let subItems = Array.from(this.element.querySelectorAll('.navbar-dropdown-list li'));
+ let focused = subItems.find(item => document.activeElement === item.querySelector('a'));
+ console.log(focused);
+
+ //if the dropdown isn't focused, close it
+ if (!focused) {
+ this.closeDropdown();
+ }
+ });
+ },
+
handleFirstElementFocus() {
- // Identify / set focus on the first item in the dropdown list automatically
+ // Identify the first item in the dropdown list & set focus on it
let firstFocusable = this.element.querySelector('.navbar-dropdown-list li:first-of-type a');
firstFocusable.focus();
},
@@ -74,19 +92,8 @@ export default Component.extend({
});
},
- handleBlur() {
- next(this, function() {
- let subItems = Array.from(this.element.querySelectorAll('.navbar-dropdown-list li'));
- let focused = subItems.find(item => document.activeElement === item.querySelector('a'));
-
- if (!focused) {
- this.set('isDropdownOpen', false);
- }
- });
- },
-
- willDestroyElement() {
+ willDestroy() {
document.removeEventListener('keydown', this.triggerDropdown);
+ document.removeEventListener('click', this.triggerDropdown);
}
-
});
From ce3c37aae799d7990af200d3651cf5408c65c324 Mon Sep 17 00:00:00 2001
From: Melanie Sumner
Date: Fri, 5 Jul 2019 14:05:41 -0500
Subject: [PATCH 15/24] added a TODO for handleBlur
---
addon/components/es-navbar/link/component.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addon/components/es-navbar/link/component.js b/addon/components/es-navbar/link/component.js
index 31244515..1fc3f0f1 100644
--- a/addon/components/es-navbar/link/component.js
+++ b/addon/components/es-navbar/link/component.js
@@ -65,7 +65,7 @@ export default Component.extend({
this.set('isDropdownOpen', false);
},
- handleBlur() {
+ handleBlur() { //TODO this isn't working, figure out why
next(this, function() {
let subItems = Array.from(this.element.querySelectorAll('.navbar-dropdown-list li'));
let focused = subItems.find(item => document.activeElement === item.querySelector('a'));
From 1a8d0e2a3f66132b68e588fdd36d9e3e09a9310c Mon Sep 17 00:00:00 2001
From: Melanie Sumner
Date: Sat, 6 Jul 2019 10:06:56 -0500
Subject: [PATCH 16/24] a little refactor
---
addon/components/es-navbar/link/component.js | 30 +++++++++++---------
addon/components/es-navbar/link/template.hbs | 2 +-
2 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/addon/components/es-navbar/link/component.js b/addon/components/es-navbar/link/component.js
index 1fc3f0f1..eec7ce26 100644
--- a/addon/components/es-navbar/link/component.js
+++ b/addon/components/es-navbar/link/component.js
@@ -11,7 +11,6 @@ export default Component.extend({
classNames: ['navbar-list-item'],
classNameBindings: ['isDropdown:dropdown'],
isDropdown: equal('link.type', 'dropdown'),
-
isDropdownOpen: false,
// because aria-expanded requires a string value instead of a boolean
@@ -22,24 +21,22 @@ export default Component.extend({
navbar: service(),
actions: {
- triggerDropdown() {
+ toggleDropdown() {
this.toggleProperty('isDropdownOpen');
-
+
if (this.isDropdownOpen) {
- // once it's open, let's make sure it can do some things
+ // if it's open, let's make sure it can do some things
schedule('afterRender', this, function() {
// move focus to the first item in the dropdown
- let dropdownList = this.element.querySelector('.navbar-dropdown-list');
this.handleFirstElementFocus();
- dropdownList.addEventListener('click', event =>{
- if (this.isDropdownOpen) {
- this.handleBlur();
- }
- });
+ // add event listeners
+ let dropdownList = this.element.querySelector('.navbar-dropdown-list');
+
+ //TODO ...for click events outside this dropdown
- // add event listeners for keyboard events
+ //...for certain keypress events
dropdownList.addEventListener('keydown', event => {
// ESC key should close the dropdown and return focus to the toggle
@@ -65,11 +62,16 @@ export default Component.extend({
this.set('isDropdownOpen', false);
},
- handleBlur() { //TODO this isn't working, figure out why
+ openDropdown() { //might not need this
+ // open the dropdown and set the focus to the first item inside
+ this.set('isDropdownOpen', true);
+ this.handleFirstElementFocus();
+ },
+
+ handleBlur() { //TODO is this working?
next(this, function() {
let subItems = Array.from(this.element.querySelectorAll('.navbar-dropdown-list li'));
let focused = subItems.find(item => document.activeElement === item.querySelector('a'));
- console.log(focused);
//if the dropdown isn't focused, close it
if (!focused) {
@@ -92,7 +94,7 @@ export default Component.extend({
});
},
- willDestroy() {
+ willDestroyElement() {
document.removeEventListener('keydown', this.triggerDropdown);
document.removeEventListener('click', this.triggerDropdown);
}
diff --git a/addon/components/es-navbar/link/template.hbs b/addon/components/es-navbar/link/template.hbs
index 5b4f8935..66f39823 100644
--- a/addon/components/es-navbar/link/template.hbs
+++ b/addon/components/es-navbar/link/template.hbs
@@ -8,7 +8,7 @@
{{/if}}
{{#if (eq link.type "dropdown")}}
From c80976575b6b5be1d5bbe46f3873f123b42412dd Mon Sep 17 00:00:00 2001
From: Melanie Sumner
Date: Sat, 6 Jul 2019 10:14:44 -0500
Subject: [PATCH 17/24] extracted keypress to its own function
---
addon/components/es-navbar/link/component.js | 57 +++++++++++---------
1 file changed, 32 insertions(+), 25 deletions(-)
diff --git a/addon/components/es-navbar/link/component.js b/addon/components/es-navbar/link/component.js
index eec7ce26..e88c69e0 100644
--- a/addon/components/es-navbar/link/component.js
+++ b/addon/components/es-navbar/link/component.js
@@ -29,29 +29,10 @@ export default Component.extend({
schedule('afterRender', this, function() {
// move focus to the first item in the dropdown
- this.handleFirstElementFocus();
+ this.processFirstElementFocus();
+ this.processKeyPress();
- // add event listeners
- let dropdownList = this.element.querySelector('.navbar-dropdown-list');
-
- //TODO ...for click events outside this dropdown
-
- //...for certain keypress events
- dropdownList.addEventListener('keydown', event => {
-
- // ESC key should close the dropdown and return focus to the toggle
- if (event.keyCode === 27 && this.isDropdownOpen) {
- this.closeDropdown();
- this.returnFocus();
-
- // if focus leaves the open dropdown via keypress, close it (without trying to otherwise control focus)
- } else if (this.isDropdownOpen) {
- this.handleBlur();
-
- } else {
- return;
- }
- });
+
});
}
}
@@ -65,10 +46,10 @@ export default Component.extend({
openDropdown() { //might not need this
// open the dropdown and set the focus to the first item inside
this.set('isDropdownOpen', true);
- this.handleFirstElementFocus();
+ this.processFirstElementFocus();
},
- handleBlur() { //TODO is this working?
+ processBlur() { //TODO is this working?
next(this, function() {
let subItems = Array.from(this.element.querySelectorAll('.navbar-dropdown-list li'));
let focused = subItems.find(item => document.activeElement === item.querySelector('a'));
@@ -80,12 +61,38 @@ export default Component.extend({
});
},
- handleFirstElementFocus() {
+ processClick() {
+
+ },
+
+ processFirstElementFocus() {
// Identify the first item in the dropdown list & set focus on it
let firstFocusable = this.element.querySelector('.navbar-dropdown-list li:first-of-type a');
firstFocusable.focus();
},
+ processKeyPress() {
+ // add event listeners
+ let dropdownList = this.element.querySelector('.navbar-dropdown-list');
+
+ //...for certain keypress events
+ dropdownList.addEventListener('keydown', event => {
+
+ // ESC key should close the dropdown and return focus to the toggle
+ if (event.keyCode === 27 && this.isDropdownOpen) {
+ this.closeDropdown();
+ this.returnFocus();
+
+ // if focus leaves the open dropdown via keypress, close it (without trying to otherwise control focus)
+ } else if (this.isDropdownOpen) {
+ this.processBlur();
+
+ } else {
+ return;
+ }
+ });
+ },
+
returnFocus() {
// after that rendering bit happens, we need to return the focus to the trigger
schedule('afterRender', this, function() {
From b4645c60ca860fdfa14b5e97640302971dd3b011 Mon Sep 17 00:00:00 2001
From: Melanie Sumner
Date: Sat, 6 Jul 2019 12:30:22 -0500
Subject: [PATCH 18/24] added an active class for the toggle button currently
in use
---
addon/components/es-navbar/link/component.js | 10 ++++------
addon/components/es-navbar/link/template.hbs | 2 +-
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/addon/components/es-navbar/link/component.js b/addon/components/es-navbar/link/component.js
index e88c69e0..4dfdcd33 100644
--- a/addon/components/es-navbar/link/component.js
+++ b/addon/components/es-navbar/link/component.js
@@ -30,9 +30,7 @@ export default Component.extend({
// move focus to the first item in the dropdown
this.processFirstElementFocus();
- this.processKeyPress();
-
-
+ this.processKeyPress();
});
}
}
@@ -49,7 +47,7 @@ export default Component.extend({
this.processFirstElementFocus();
},
- processBlur() { //TODO is this working?
+ processBlur() {
next(this, function() {
let subItems = Array.from(this.element.querySelectorAll('.navbar-dropdown-list li'));
let focused = subItems.find(item => document.activeElement === item.querySelector('a'));
@@ -62,7 +60,7 @@ export default Component.extend({
},
processClick() {
-
+ // TODO handle mouseclick outside the current dropdown
},
processFirstElementFocus() {
@@ -103,6 +101,6 @@ export default Component.extend({
willDestroyElement() {
document.removeEventListener('keydown', this.triggerDropdown);
- document.removeEventListener('click', this.triggerDropdown);
+ // document.removeEventListener('click', this.triggerDropdown);
}
});
diff --git a/addon/components/es-navbar/link/template.hbs b/addon/components/es-navbar/link/template.hbs
index 66f39823..ad5bcb7e 100644
--- a/addon/components/es-navbar/link/template.hbs
+++ b/addon/components/es-navbar/link/template.hbs
@@ -9,7 +9,7 @@
{{#if (eq link.type "dropdown")}}
{{link.name}}
From 6b9035a0ed5c080a496046e10954e87b74036eb1 Mon Sep 17 00:00:00 2001
From: Melanie Sumner
Date: Sat, 6 Jul 2019 14:27:19 -0500
Subject: [PATCH 19/24] updating styles while working on the website
---
addon/styles/addon.css | 7 ++--
addon/styles/colors.css | 2 +-
addon/styles/components/es-button.css | 17 ++++++----
addon/styles/components/es-footer.css | 32 +++++++++++++++++++
addon/styles/global.css | 2 +-
addon/styles/typography.css | 1 +
addon/templates/components/es-button.hbs | 2 +-
.../components/es-footer/es-statement.hbs | 6 ++--
docs/components/button.md | 2 +-
docs/concepts/{colours.md => colors.md} | 10 +++---
package-lock.json | 28 ++++++++--------
package.json | 1 +
12 files changed, 75 insertions(+), 35 deletions(-)
create mode 100644 addon/styles/components/es-footer.css
rename docs/concepts/{colours.md => colors.md} (85%)
diff --git a/addon/styles/addon.css b/addon/styles/addon.css
index cfeeb818..aee1f5bc 100644
--- a/addon/styles/addon.css
+++ b/addon/styles/addon.css
@@ -6,9 +6,10 @@
@import "helpers.css";
@import "layout.css";
-@import "components/es-navbar.css";
+@import "components/es-button.css";
+@import "components/es-card.css";
+@import "components/es-footer.css";
@import "components/es-header.css";
+@import "components/es-navbar.css";
@import "components/es-page-header.css";
-@import "components/es-button.css";
@import "components/es-tabs.css";
-@import "components/es-card.css";
diff --git a/addon/styles/colors.css b/addon/styles/colors.css
index 505b0388..fea25731 100644
--- a/addon/styles/colors.css
+++ b/addon/styles/colors.css
@@ -21,4 +21,4 @@
.bg-info {
background: var(--color-info);
-}
\ No newline at end of file
+}
diff --git a/addon/styles/components/es-button.css b/addon/styles/components/es-button.css
index 7a6408a0..683e9124 100644
--- a/addon/styles/components/es-button.css
+++ b/addon/styles/components/es-button.css
@@ -2,14 +2,17 @@
background-color: var(--color-orange);
color: var(--color-light);
font-size: var(--text-preset-2);
- padding-left: 8rem;
- padding-right: 8rem;
- padding-top: 2rem;
- padding-bottom: 2rem;
+ padding-left: 1.5rem;
+ padding-right: 1.5rem;
+ padding-top: 0.5rem;
+ padding-bottom: 0.5rem;
border-radius: 4px;
}
-
-a.es-button {
- display: inline-block;
+.link-as-button {
text-decoration: none;
}
+
+.es-button-icon {
+ background-color: transparent;
+ border-color: transparent;
+}
diff --git a/addon/styles/components/es-footer.css b/addon/styles/components/es-footer.css
new file mode 100644
index 00000000..b683b414
--- /dev/null
+++ b/addon/styles/components/es-footer.css
@@ -0,0 +1,32 @@
+footer {
+ display: flex;
+ flex-flow: row wrap;
+ justify-content: space-evenly;
+ margin: 0;
+ max-width: 100%;
+ padding: 0;
+}
+.footer-info, .footer-statement, .footer-contributions {
+ display: flex;
+}
+.footer-info {}
+.footer-statement {
+ .footer-social {
+ display: flex;
+ list-style: none;
+ li {
+ padding: 0;
+ margin: 0;
+ display: inline-flex;
+ a {
+ display: flex;
+ justify-content: center;
+ max-width: 25px;
+ svg {
+ width: 25px;
+ display: block;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/addon/styles/global.css b/addon/styles/global.css
index 4bca387e..48beed1f 100644
--- a/addon/styles/global.css
+++ b/addon/styles/global.css
@@ -29,7 +29,7 @@ body, html {
margin: 0;
padding: 0;
font-family: "Source Sans Pro", sans-serif;
- font-size: 16px;
+ font-size: 18px;
line-height: 1.5;
}
diff --git a/addon/styles/typography.css b/addon/styles/typography.css
index ba92c21a..c57ccf2d 100644
--- a/addon/styles/typography.css
+++ b/addon/styles/typography.css
@@ -69,6 +69,7 @@
.xlarge, h1 {
font-size: var(--text-preset-5);
+ line-height: 1;
}
.light {
diff --git a/addon/templates/components/es-button.hbs b/addon/templates/components/es-button.hbs
index 57e7d515..8c254f77 100644
--- a/addon/templates/components/es-button.hbs
+++ b/addon/templates/components/es-button.hbs
@@ -1,5 +1,5 @@
{{tagline}}
-
+
{{/if}}
diff --git a/docs/components/button.md b/docs/components/button.md
index 2827392a..5ba11455 100644
--- a/docs/components/button.md
+++ b/docs/components/button.md
@@ -73,7 +73,7 @@ Since we're using the native HTML button element and requiring a label value to
If you are going to put an icon in the button, then you will need to set an aria-label property on the button:
```handlebars
-{{#es-button ariaLabel="Hamster Secrets" title="Hamster Secrets"}}
+{{#es-button ariaLabel="Hamster Secrets" title="Hamster Secrets" isIcon=true}}
🐹
{{/es-button}}
```
diff --git a/docs/concepts/colours.md b/docs/concepts/colors.md
similarity index 85%
rename from docs/concepts/colours.md
rename to docs/concepts/colors.md
index c653889b..a9ddcdcd 100644
--- a/docs/concepts/colours.md
+++ b/docs/concepts/colors.md
@@ -1,11 +1,11 @@
-# Colours
+# Colors
### Here we talk about the color scheme
-## Primary Colours
-The primary palette is applied across every page of the website and contains the brand, accent and neutral colours. The purpose of the primary palette is to keep uniformity across all pages while encouraging accessibility best practices.
+## Primary Colors
+The primary palette is applied across every page of the website and contains the brand, accent and neutral colors. The purpose of the primary palette is to keep uniformity across all pages while encouraging accessibility best practices.
-The following swatches contain a sample of each of the primary palette colours, along with recommendations for its usage and the acceptable contrast guidelines when coupled with text.
+The following swatches contain a sample of each of the primary palette colors, along with recommendations for its usage and the acceptable contrast guidelines when coupled with text.
@@ -26,7 +26,7 @@ The following swatches contain a sample of each of the primary palette colours,
-## Secondary Colours
+## Secondary colors
The secondary palette is applied to UI elements and it's not part of the base colors. The purpose of the secondary palette is to ensure the readability, usability, and accessibility of all UI elements and enhance the communication of actions, changes in state, or errors.
diff --git a/package-lock.json b/package-lock.json
index 8ffca4bc..103cbb81 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -831,9 +831,9 @@
}
},
"semver": {
- "version": "6.1.2",
- "resolved": "https://registry.npmjs.org/semver/-/semver-6.1.2.tgz",
- "integrity": "sha512-z4PqiCpomGtWj8633oeAdXm1Kn1W++3T8epkZYnwiVgIYIJ0QHszhInYSJTYxebByQH7KVCEAn8R9duzZW2PhQ=="
+ "version": "6.2.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.2.0.tgz",
+ "integrity": "sha512-jdFC1VdUGT/2Scgbimf7FSx9iJLXoqfglSF+gJeuNWVpiE37OIbc1jywR/GJyFdz3mnkz2/id0L0J/cr0izR5A=="
}
}
},
@@ -6697,12 +6697,12 @@
}
},
"ember-cli-typescript": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/ember-cli-typescript/-/ember-cli-typescript-2.0.1.tgz",
- "integrity": "sha512-xwSEQOUNM621Wt+XJWpbLhBIeqC/dM1lDS+oZQ2nSjxp4MLZkpKuiVBqdbBWcURbvv8ghoVQPfy8wYU4JIFkLA==",
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/ember-cli-typescript/-/ember-cli-typescript-2.0.2.tgz",
+ "integrity": "sha512-7I5azCTxOgRDN8aSSnJZIKSqr+MGnT+jLTUbBYqF8wu6ojs2DUnTePxUcQMcvNh3Q3B1ySv7Q/uZFSjdU9gSjA==",
"requires": {
"@babel/plugin-proposal-class-properties": "^7.1.0",
- "@babel/plugin-transform-typescript": "^7.1.0",
+ "@babel/plugin-transform-typescript": "~7.4.0",
"ansi-to-html": "^0.6.6",
"debug": "^4.0.0",
"ember-cli-babel-plugin-helpers": "^1.0.0",
@@ -6726,14 +6726,14 @@
}
},
"semver": {
- "version": "6.1.2",
- "resolved": "https://registry.npmjs.org/semver/-/semver-6.1.2.tgz",
- "integrity": "sha512-z4PqiCpomGtWj8633oeAdXm1Kn1W++3T8epkZYnwiVgIYIJ0QHszhInYSJTYxebByQH7KVCEAn8R9duzZW2PhQ=="
+ "version": "6.2.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.2.0.tgz",
+ "integrity": "sha512-jdFC1VdUGT/2Scgbimf7FSx9iJLXoqfglSF+gJeuNWVpiE37OIbc1jywR/GJyFdz3mnkz2/id0L0J/cr0izR5A=="
},
"walk-sync": {
- "version": "1.1.3",
- "resolved": "https://registry.npmjs.org/walk-sync/-/walk-sync-1.1.3.tgz",
- "integrity": "sha512-23ivbET0Q/389y3EHpiIgxx881AS2mwdXA7iBqUDNSymoTPYb2jWlF3gkuuAP1iLgdNXmiHw/kZ/wZwrELU6Ag==",
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/walk-sync/-/walk-sync-1.1.4.tgz",
+ "integrity": "sha512-nowc9thB/Jg0KW4TgxoRjLLYRPvl3DB/98S89r4ZcJqq2B0alNcKDh6pzLkBSkPMzRSMsJghJHQi79qw0YWEkA==",
"requires": {
"@types/minimatch": "^3.0.3",
"ensure-posix-path": "^1.1.0",
@@ -16204,7 +16204,7 @@
}
},
"sparkles-component": {
- "version": "github:rwjblue/sparkles-component#56be780f7931166364b2da74eae7bcb2a143e6d9",
+ "version": "github:rwjblue/sparkles-component#0fa522041f7624d936933606f322e504e3e23251",
"from": "github:rwjblue/sparkles-component",
"requires": {
"@ember-decorators/utils": "^5.1.3",
diff --git a/package.json b/package.json
index fc09525a..a0f11dda 100644
--- a/package.json
+++ b/package.json
@@ -37,6 +37,7 @@
"normalize.css": "^8.0.1",
"postcss-import": "^12.0.1",
"postcss-preset-env": "^6.6.0",
+ "rsvp": "^4.8.5",
"sparkles-component": "github:rwjblue/sparkles-component"
},
"devDependencies": {
From abb938e8335d9b92c51e396c0fffcbde7d9051b2 Mon Sep 17 00:00:00 2001
From: Melanie Sumner
Date: Sat, 6 Jul 2019 16:06:58 -0500
Subject: [PATCH 20/24] more style updates
---
addon/styles/components/es-button.css | 35 ++++++++++++++++++++--
addon/styles/components/es-page-header.css | 2 +-
addon/styles/global.css | 7 ++++-
addon/styles/helpers.css | 4 +++
addon/styles/layout.css | 16 ++++++++--
addon/styles/typography.css | 7 ++++-
6 files changed, 63 insertions(+), 8 deletions(-)
diff --git a/addon/styles/components/es-button.css b/addon/styles/components/es-button.css
index 683e9124..0628fe11 100644
--- a/addon/styles/components/es-button.css
+++ b/addon/styles/components/es-button.css
@@ -1,18 +1,47 @@
.es-button {
background-color: var(--color-orange);
+ border-radius: 4px;
color: var(--color-light);
- font-size: var(--text-preset-2);
+ font-size: 24px; /* buttons have to have this size if they are on the orange background */
+ padding-bottom: 0.5rem;
padding-left: 1.5rem;
padding-right: 1.5rem;
padding-top: 0.5rem;
- padding-bottom: 0.5rem;
- border-radius: 4px;
+ text-decoration: none;
+}
+.es-button-secondary {
+ font-size: 24px; /* should match the primary button, we can abstract a base button class later */
+ background-color: transparent;
}
+
.link-as-button {
+ color: inherit;
+ position: relative;
text-decoration: none;
+ z-index: 0;
+}
+.link-as-button:after {
+ background-color: #E04E39;
+ bottom: 8%;
+ content: " ";
+ display: inline-block;
+ height: 24%;
+ left: 0;
+ position: absolute;
+ top: auto;
+ transform: scaleY(1);
+ width: 100%;
+ z-index: -1;
}
.es-button-icon {
background-color: transparent;
border-color: transparent;
}
+
+.es-button + .es-button-secondary {
+ @media screen and (min-width: 992px){
+ margin-left: 20px;
+ }
+
+}
diff --git a/addon/styles/components/es-page-header.css b/addon/styles/components/es-page-header.css
index 894272b8..20a5dec7 100644
--- a/addon/styles/components/es-page-header.css
+++ b/addon/styles/components/es-page-header.css
@@ -1,5 +1,5 @@
.es-page-header {
- padding-top: 4.5rem;
+ padding-top: 1.5rem;
padding-bottom: 4.5rem;
background-image: url('/images/pattern-1.svg');
background-repeat: no-repeat;
diff --git a/addon/styles/global.css b/addon/styles/global.css
index 48beed1f..d54759bd 100644
--- a/addon/styles/global.css
+++ b/addon/styles/global.css
@@ -51,7 +51,12 @@ h6 {
margin: 0 0 2rem 0;
}
-@media (max-width: 1280px) and (min-width: 421px) {
+h1, h2 {
+ min-width: 100%;
+}
+
+@media (max-width: 1280px) and (min-width: 421px) {
+ /* TODO this media query is incorrect - CSS should be mobile-first */
body,
html {
diff --git a/addon/styles/helpers.css b/addon/styles/helpers.css
index 4236d3dc..b890dd39 100644
--- a/addon/styles/helpers.css
+++ b/addon/styles/helpers.css
@@ -321,3 +321,7 @@
.padding-right-xlarge {
padding-right: var(--spacing-5);
}
+
+.margin-bottom-small, .margin-bottom-2rem {
+ margin-bottom: 2rem;
+}
diff --git a/addon/styles/layout.css b/addon/styles/layout.css
index 5b5b6715..e1fd4add 100644
--- a/addon/styles/layout.css
+++ b/addon/styles/layout.css
@@ -1,5 +1,5 @@
.container {
- padding: var(--spacing-4) 0;
+ padding: var(--spacing-3) 0;
margin: 0 auto;
width: var(--max-width);
}
@@ -30,7 +30,12 @@
width: 50%;
margin: 0 2rem;
}
-
+.half {
+ width: 50%;
+}
+.center-block {
+ margin: 0 auto;
+}
.col-one-third {
width: 30.3%;
margin: 0 2rem;
@@ -45,3 +50,10 @@
}
}
+section {
+ display: flex;
+ flex-flow: row wrap;
+ & .full {
+ min-width: 100%;
+ }
+}
diff --git a/addon/styles/typography.css b/addon/styles/typography.css
index c57ccf2d..a3e546e9 100644
--- a/addon/styles/typography.css
+++ b/addon/styles/typography.css
@@ -55,7 +55,7 @@
font-size: var(--text-preset-1);
}
-.small, p {
+.small, p { /* TODO this isn't going to work for A11y */
font-size: var(--text-preset-2);
}
@@ -99,3 +99,8 @@
.text-light {
color: var(--color-light);
}
+
+.text-intro {
+ font-size: 1.5em;
+ margin-bottom: 6vh;
+}
From 9894fad8648d878872dcd75f409d6f41e872fb33 Mon Sep 17 00:00:00 2001
From: Melanie Sumner
Date: Sat, 6 Jul 2019 16:47:29 -0500
Subject: [PATCH 21/24] updated some typography and added more styles
---
addon/styles/addon.css | 2 ++
addon/styles/components/es-list.css | 18 ++++++++++++++++++
addon/styles/global.css | 8 ++++++--
addon/styles/helpers.css | 24 ++++++++++++++++++++++++
addon/styles/layout.css | 13 ++++++++-----
addon/styles/typography.css | 6 +-----
6 files changed, 59 insertions(+), 12 deletions(-)
create mode 100644 addon/styles/components/es-list.css
diff --git a/addon/styles/addon.css b/addon/styles/addon.css
index aee1f5bc..9c64f4f2 100644
--- a/addon/styles/addon.css
+++ b/addon/styles/addon.css
@@ -10,6 +10,8 @@
@import "components/es-card.css";
@import "components/es-footer.css";
@import "components/es-header.css";
+@import "components/es-list.css";
@import "components/es-navbar.css";
@import "components/es-page-header.css";
@import "components/es-tabs.css";
+
diff --git a/addon/styles/components/es-list.css b/addon/styles/components/es-list.css
new file mode 100644
index 00000000..7cfd7595
--- /dev/null
+++ b/addon/styles/components/es-list.css
@@ -0,0 +1,18 @@
+.es-list {
+ list-style: none;
+ display: flex;
+ flex-flow: row wrap;
+ justify-content: space-around;
+}
+
+/* TODO not sure how to write this in the style this project is now using */
+
+/* .es-list-images {
+ & img {
+ max-width: 50%;
+ & @media screen and (min-width: 992px) {
+ max-width: 125px;
+ height: auto;
+ }
+ }
+} */
\ No newline at end of file
diff --git a/addon/styles/global.css b/addon/styles/global.css
index d54759bd..7dfcaa95 100644
--- a/addon/styles/global.css
+++ b/addon/styles/global.css
@@ -24,12 +24,15 @@
--spacing-4: 16rem;
--spacing-5: 24rem;
}
+*, *:after {
+ box-sizing: border-box;
+}
body, html {
margin: 0;
padding: 0;
font-family: "Source Sans Pro", sans-serif;
- font-size: 18px;
+ font-size: 18px;
line-height: 1.5;
}
@@ -53,9 +56,10 @@ h6 {
h1, h2 {
min-width: 100%;
+ line-height: 1;
}
-@media (max-width: 1280px) and (min-width: 421px) {
+@media (max-width: 1280px) and (min-width: 421px) {
/* TODO this media query is incorrect - CSS should be mobile-first */
body,
html {
diff --git a/addon/styles/helpers.css b/addon/styles/helpers.css
index b890dd39..e9907048 100644
--- a/addon/styles/helpers.css
+++ b/addon/styles/helpers.css
@@ -325,3 +325,27 @@
.margin-bottom-small, .margin-bottom-2rem {
margin-bottom: 2rem;
}
+
+.margin-bottom-small, .margin-bottom-narrow {
+ margin-bottom: 2rem;
+}
+
+.margin-left-small, .margin-left-narrow {
+ margin-left: 2rem;
+}
+
+
+/* if we name the modifiers the same as a word or google doc would use for page layout, it's more intuitive */
+/* TODO we can adjust these, I'm more putting these here because I need them in general */
+.padding-sides-normal {
+ padding-left: 0.5em;
+ padding-right: 0.5em;
+}
+.padding-sides-narrow {
+ padding-left: 0.25em;
+ padding-right: 0.25em;
+}
+.padding-sides-wide {
+ padding-left: 1em;
+ padding-right: 1em;
+}
diff --git a/addon/styles/layout.css b/addon/styles/layout.css
index e1fd4add..9f3642b4 100644
--- a/addon/styles/layout.css
+++ b/addon/styles/layout.css
@@ -6,10 +6,8 @@
.row {
display: flex;
- margin-left: -2rem;
- margin-right: -2rem;
- flex-wrap: wrap;
- margin-bottom: 4rem;
+ flex-flow: row wrap;
+ margin-bottom: 2rem;
}
.row >.col {
@@ -40,7 +38,9 @@
width: 30.3%;
margin: 0 2rem;
}
-
+.one-third {
+ width: 33.3333%;
+}
@media (max-width: 576px) {
.row {
flex-direction: column;
@@ -53,6 +53,9 @@
section {
display: flex;
flex-flow: row wrap;
+ @media screen and (min-width: 992px) {
+ padding-top: 4em;
+ }
& .full {
min-width: 100%;
}
diff --git a/addon/styles/typography.css b/addon/styles/typography.css
index a3e546e9..a4c955d3 100644
--- a/addon/styles/typography.css
+++ b/addon/styles/typography.css
@@ -51,14 +51,10 @@
font-style: italic;
}
-.xsmall, small {
+.xsmall, small, .small {
font-size: var(--text-preset-1);
}
-.small, p { /* TODO this isn't going to work for A11y */
- font-size: var(--text-preset-2);
-}
-
.medium, h3 {
font-size: var(--text-preset-3);
}
From 5adca2461a6de8563e9944b6b4473cb4efa0097a Mon Sep 17 00:00:00 2001
From: Melanie Sumner
Date: Sat, 6 Jul 2019 18:03:00 -0500
Subject: [PATCH 22/24] added section background shape
---
addon/styles/global.css | 29 ++++++++++++++++++++++++-----
addon/styles/helpers.css | 9 +++++++--
addon/styles/layout.css | 6 ++++++
3 files changed, 37 insertions(+), 7 deletions(-)
diff --git a/addon/styles/global.css b/addon/styles/global.css
index 7dfcaa95..431aaef4 100644
--- a/addon/styles/global.css
+++ b/addon/styles/global.css
@@ -36,12 +36,10 @@ body, html {
line-height: 1.5;
}
-
p {
- font-size: var(--text-preset-2);
- line-height: 1.6;
- margin: 0 0 1rem 0;
- font-weight: 300;
+ font-size: 1em;
+ font-weight: normal;
+ margin: 0.25em 0.5em;
}
h1,
@@ -89,3 +87,24 @@ h1, h2 {
padding-bottom: 8rem;
border: 1px solid #CCC;
}
+
+/* the weird shit for the backgrounds */
+.section-bg-wrapper {
+ position: relative;
+ height: 750px;
+ width: 100%;
+ margin-bottom: -650px;
+}
+.section-bg {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ right: 0;
+ width: 30%;
+ height: 100%;
+ background-image: linear-gradient(#e04e39, #e04e39);
+ transform: skewY(-15deg);
+ transform-origin: bottom right;
+ z-index:-1;
+ border-top-left-radius: 7px;
+}
diff --git a/addon/styles/helpers.css b/addon/styles/helpers.css
index e9907048..854d3d6e 100644
--- a/addon/styles/helpers.css
+++ b/addon/styles/helpers.css
@@ -330,6 +330,10 @@
margin-bottom: 2rem;
}
+.margin-bottom-wide {
+ margin-bottom: 5vh;
+}
+
.margin-left-small, .margin-left-narrow {
margin-left: 2rem;
}
@@ -346,6 +350,7 @@
padding-right: 0.25em;
}
.padding-sides-wide {
- padding-left: 1em;
- padding-right: 1em;
+ /* TODO ADD MEDIA QUERIES */
+ padding-left: 15%;
+ padding-right: 15%;
}
diff --git a/addon/styles/layout.css b/addon/styles/layout.css
index 9f3642b4..46234cd2 100644
--- a/addon/styles/layout.css
+++ b/addon/styles/layout.css
@@ -41,6 +41,12 @@
.one-third {
width: 33.3333%;
}
+.two-thirds {
+ width: 66.6666%;
+}
+.three-fourths {
+ width: 75%;
+}
@media (max-width: 576px) {
.row {
flex-direction: column;
From 02b793ab65de2d67e9e26402db283a9faae8ea9a Mon Sep 17 00:00:00 2001
From: Melanie Sumner
Date: Sat, 6 Jul 2019 18:17:53 -0500
Subject: [PATCH 23/24] updated the background shape
---
addon/styles/global.css | 17 +++++++++--------
addon/styles/typography.css | 2 ++
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/addon/styles/global.css b/addon/styles/global.css
index 431aaef4..91d601c9 100644
--- a/addon/styles/global.css
+++ b/addon/styles/global.css
@@ -90,21 +90,22 @@ h1, h2 {
/* the weird shit for the backgrounds */
.section-bg-wrapper {
+ height: 725px;
+ margin-bottom: -690px;
position: relative;
- height: 750px;
width: 100%;
- margin-bottom: -650px;
}
.section-bg {
- position: absolute;
- top: 0;
+ background-image: linear-gradient(#e04e39, #e04e39);
+ border-top-left-radius: 7px;
bottom: 0;
- right: 0;
- width: 30%;
height: 100%;
- background-image: linear-gradient(#e04e39, #e04e39);
- transform: skewY(-15deg);
+ position: absolute;
+ right: 0;
+ top: 0;
transform-origin: bottom right;
+ transform: skewY(-15deg);
+ width: 30%;
z-index:-1;
border-top-left-radius: 7px;
}
diff --git a/addon/styles/typography.css b/addon/styles/typography.css
index a4c955d3..f8775e45 100644
--- a/addon/styles/typography.css
+++ b/addon/styles/typography.css
@@ -98,5 +98,7 @@
.text-intro {
font-size: 1.5em;
+ font-weight: 300;
+ line-height: 1.4;
margin-bottom: 6vh;
}
From 7073fdb5a56f8210348ba10890f8bb158d96a4ef Mon Sep 17 00:00:00 2001
From: Melanie Sumner
Date: Sun, 7 Jul 2019 15:49:06 -0500
Subject: [PATCH 24/24] added es-media element, TODOs and some grid css
---
addon/styles/addon.css | 1 +
addon/styles/components/es-button.css | 3 +++
addon/styles/components/es-list.css | 21 ++++++++++++++++++++-
addon/styles/components/es-media.css | 8 ++++++++
addon/styles/global.css | 7 ++++---
addon/styles/helpers.css | 22 +++++++++++++++++++++-
6 files changed, 57 insertions(+), 5 deletions(-)
create mode 100644 addon/styles/components/es-media.css
diff --git a/addon/styles/addon.css b/addon/styles/addon.css
index 9c64f4f2..190bcd71 100644
--- a/addon/styles/addon.css
+++ b/addon/styles/addon.css
@@ -11,6 +11,7 @@
@import "components/es-footer.css";
@import "components/es-header.css";
@import "components/es-list.css";
+@import "components/es-media.css";
@import "components/es-navbar.css";
@import "components/es-page-header.css";
@import "components/es-tabs.css";
diff --git a/addon/styles/components/es-button.css b/addon/styles/components/es-button.css
index 0628fe11..cd5d2c1c 100644
--- a/addon/styles/components/es-button.css
+++ b/addon/styles/components/es-button.css
@@ -45,3 +45,6 @@
}
}
+
+/* TODO add hover state */
+/* TODO add focus state */
diff --git a/addon/styles/components/es-list.css b/addon/styles/components/es-list.css
index 7cfd7595..8218051f 100644
--- a/addon/styles/components/es-list.css
+++ b/addon/styles/components/es-list.css
@@ -15,4 +15,23 @@
height: auto;
}
}
-} */
\ No newline at end of file
+} */
+
+
+
+.es-list-hero-images {
+ /* don't show it on mobile- it's not necessary for the site and it's not kind to the users' bandwidth */
+ display: none;
+
+ @media screen and (min-width: 992px) {
+ list-style: none;
+ margin: 0;
+ padding: 0;
+ display: grid;
+ grid-template-columns: 1fr 1fr 1fr;
+ grid-template-rows: 1fr 1fr;
+ grid-column-gap: 50px;
+ grid-row-gap: 0px;
+ max-height: 400px; /* whatever the max height of the images are */
+ }
+}
\ No newline at end of file
diff --git a/addon/styles/components/es-media.css b/addon/styles/components/es-media.css
new file mode 100644
index 00000000..693c0190
--- /dev/null
+++ b/addon/styles/components/es-media.css
@@ -0,0 +1,8 @@
+/* this component has a paragraph of text on one side, and and image on the other, and alternates depending on position. */
+.es-media {
+ /* TODO think about smaller viewports and put them here */
+ @media screen and (min-width: 992px) {
+ display: flex;
+ flex-flow: row wrap;
+ }
+}
\ No newline at end of file
diff --git a/addon/styles/global.css b/addon/styles/global.css
index 91d601c9..59af14e7 100644
--- a/addon/styles/global.css
+++ b/addon/styles/global.css
@@ -37,8 +37,8 @@ body, html {
}
p {
- font-size: 1em;
- font-weight: normal;
+ font-size: 1.2rem;
+ font-weight: 300;
margin: 0.25em 0.5em;
}
@@ -107,5 +107,6 @@ h1, h2 {
transform: skewY(-15deg);
width: 30%;
z-index:-1;
- border-top-left-radius: 7px;
}
+
+/* TODO this grid generator tool is really useful: https://cssgrid-generator.netlify.com/ */
diff --git a/addon/styles/helpers.css b/addon/styles/helpers.css
index 854d3d6e..1fac0d20 100644
--- a/addon/styles/helpers.css
+++ b/addon/styles/helpers.css
@@ -331,8 +331,22 @@
}
.margin-bottom-wide {
- margin-bottom: 5vh;
+ @media screen and (min-width:992px) {
+ margin-bottom: 5vh;
+ }
}
+.margin-top-wide {
+ @media screen and (min-width:992px) {
+ margin-top: 5vh;
+ }
+}
+.margin-top-bottom-wide {
+ @media screen and (min-width:992px) {
+ margin-top: 5vh;
+ margin-bottom: 5vh;
+ }
+}
+
.margin-left-small, .margin-left-narrow {
margin-left: 2rem;
@@ -354,3 +368,9 @@
padding-left: 15%;
padding-right: 15%;
}
+
+.padding-right-half {
+ @media screen and (min-width: 992px) {
+ padding-right: 50%;
+ }
+}