-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(profile-topbar): upgrade component - INNO-586 #238
Changes from 21 commits
98a956f
8b01094
0d6d380
9ccb997
0616700
b0a05e5
73ef917
4bb93f3
f72070a
aa5c04a
5b7e10c
1ed7668
2819481
a044c2e
8bc1d02
716860f
2d5b07d
66176b9
98e0602
ba80fa6
bb2093e
7bd35bf
7fc7f64
50f9dda
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,27 @@ | ||
<div class="context-nav"> | ||
<span class="context-nav__label">Label for contextual nav</span> | ||
<span class="context-nav__label">{{ label }}</span> | ||
{% if items is defined and items is iterable %} | ||
<div class="context-nav__items"> | ||
{% for item in items %} | ||
<span class="context-nav__item"> | ||
<a href="#">Item one</a> | ||
</span> | ||
<span class="context-nav__item"> | ||
<a href="#">Item two</a> | ||
</span> | ||
<span class="context-nav__item"> | ||
<a href="#">Item three</a> | ||
</span> | ||
<span class="context-nav__item"> | ||
<a href="#">Item four</a> | ||
</span> | ||
</div> | ||
</div> | ||
|
||
<div class="context-nav"> | ||
<span class="context-nav__label">Label for longer list</span> | ||
<div class="context-nav__items"> | ||
<span class="context-nav__item"> | ||
<a href="#">Item one</a> | ||
</span> | ||
<span class="context-nav__item"> | ||
<a href="#">Item two</a> | ||
</span> | ||
<span class="context-nav__item"> | ||
<a href="#">Item three</a> | ||
</span> | ||
<span class="context-nav__item"> | ||
<a href="#">Item four</a> | ||
<a href="{{ item.target }}">{{ item.title }}</a> | ||
</span> | ||
{% endfor %} | ||
{% endif %} | ||
{% if items_hidden is defined and items_hidden is iterable %} | ||
<div class="context-nav__expander"> | ||
<span class="context-nav__more-button"> | ||
More<span class="icon icon--down ecl-u-color-primary"></span> | ||
{{ button_more }} | ||
<span class="icon icon--down ecl-u-color-primary"></span> | ||
</span> | ||
<div class="context-nav__hidden"> | ||
{% for hidden_item in items_hidden %} | ||
<span class="context-nav__item"> | ||
<a href="#">Item five</a> | ||
</span> | ||
<span class="context-nav__item"> | ||
<a href="#">Item six</a> | ||
</span> | ||
<span class="context-nav__item"> | ||
<a href="#">Item seven</a> | ||
</span> | ||
<span class="context-nav__item"> | ||
<a href="#">Item eight</a> | ||
<a href="{{ hidden_item.target }}">{{ hidden_item.title }}</a> | ||
</span> | ||
{% endfor %} | ||
</div> | ||
</div> | ||
{% endif %} | ||
</div> | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
# Profile topbar | ||
|
||
Defines the profile topbar component | ||
TODO: this component's behaviour needs to be rewritten without jQuery. | ||
Defines the profile topbar component. |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,60 @@ | ||
module.exports = { | ||
title: 'Profile topbars', | ||
label: 'Profile topbars', | ||
status: 'planned', | ||
status: 'ready', | ||
tags: ['organism'], | ||
context: { | ||
_demo: { | ||
scripts: | ||
"document.addEventListener('DOMContentLoaded', function () { ECL.initExpandables(); });", | ||
}, | ||
profile: { | ||
image: { | ||
src: 'http://lorempixel.com/output/business-q-c-160-160-10.jpg', | ||
alt: 'Example profile image', | ||
}, | ||
expandable: { | ||
button: { | ||
label: 'See details', | ||
extraClass: 'ecl-expandable__button ecl-profile-topbar__pane-button', | ||
extraAttributes: [ | ||
{ | ||
name: 'aria-controls', | ||
value: 'ecl-profile-topbar__expandable-1', | ||
}, | ||
{ name: 'aria-expanded', value: 'false' }, | ||
{ name: 'id', value: 'ecl-profile-topbar__expandable-button-1' }, | ||
{ name: 'type', value: 'button' }, | ||
], | ||
}, | ||
expandable_body: { | ||
extraAttributes: [ | ||
{ | ||
name: 'aria-hidden', | ||
value: 'true', | ||
}, | ||
{ | ||
name: 'aria-labelledby', | ||
value: 'ecl-profile-topbar__expandable-button-1', | ||
}, | ||
{ name: 'id', value: 'ecl-profile-topbar__expandable-1' }, | ||
{ name: 'class', value: 'ecl-profile-topbar__collapsible-area' }, | ||
], | ||
}, | ||
}, | ||
}, | ||
context_nav: { | ||
label: 'Department', | ||
items: [ | ||
{ | ||
target: '#', | ||
title: 'Trade', | ||
}, | ||
{ | ||
target: '#', | ||
title: ' European Anti-Fraud Office', | ||
}, | ||
], | ||
}, | ||
}, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* ECL Profile Topbar | ||
* @define profile-topbar | ||
*/ | ||
|
||
.ecl-profile-topbar { | ||
margin: 0; | ||
padding-bottom: map-get($ecl-spacing, 'm'); | ||
padding-top: map-get($ecl-spacing, 'm'); | ||
} | ||
|
||
.ecl-profile-topbar__pane { | ||
height: 100%; | ||
min-height: 160px; | ||
position: relative; | ||
} | ||
|
||
.ecl-profile-topbar__pane-button { | ||
bottom: 0; | ||
position: absolute; | ||
} | ||
|
||
.ecl-profile-topbar__collapsible-area { | ||
background-color: map-get($ecl-colors, 'grey-10'); | ||
overflow: hidden; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,65 @@ | ||
<div class="profile_topbar"> | ||
|
||
<div class="container"> | ||
<div class="section__group row"> | ||
<div class="col-md-2 profile_topbar__image"> | ||
<img src="http://placehold.it/160x160"/> | ||
</div> | ||
|
||
<div class="col-md-10 profile_topbar__column"> | ||
<div class="context-nav group-context-nav field-group-context_nav"><span | ||
class="context-nav__label">Department</span> | ||
<div class="context-nav__items"> | ||
<span class="context-nav__item"><a href="#">Trade</a></span> | ||
<span class="context-nav__item"><a href="#">European Anti-Fraud Office</a></span> | ||
</div> | ||
</div> | ||
|
||
<button class="btn btn-collapse" data-target="#collapse" data-toggle="collapse"> | ||
<span class="toggling-text">Show</span> | ||
<span class="icon icon--down ecl-u-color-primary"></span> | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
{# | ||
Component interface: | ||
- `extraClass` - classes to add to root component | ||
- `extraAttributes` - additional attributes to add to root component | ||
|
||
- `context_nav` - data for @ec-europa/ecl-context-navs component composition | ||
|
||
- `profile` data contains profile-specific information | ||
- `image` - data for @ec-europa/ecl-images component composition | ||
- `expandable` - data related to the expandable part of the component | ||
- `button` - data for @ec-europa/ecl-buttons component composition | ||
- `expandable_body` - accepts `extraAttributes` for the expandable | ||
|
||
- body (block): content in the expandable area (default: lorem ipsum text) | ||
#} | ||
|
||
|
||
{# Internal properties #} | ||
|
||
<div id="collapse" class="profile_topbar__expander"> | ||
<div class="container"> | ||
Expander content | ||
</div> | ||
{% set _cssClass = 'ecl-profile-topbar' %} | ||
{% set _extraAttributes = '' %} | ||
|
||
{# Internal logic - Process properties #} | ||
|
||
{% if extraClass is defined %} | ||
{% set _cssClass = _cssClass ~ ' ' ~ extraClass %} | ||
{% endif %} | ||
|
||
{% if extraAttributes is defined %} | ||
{% for attr in extraAttributes %} | ||
{% set _extraAttributes = _extraAttributes ~ ' ' ~ attr.name ~ '="' ~ attr.value ~ '"' %} | ||
{% endfor %} | ||
{% endif %} | ||
|
||
{# Print result #} | ||
|
||
<div class="{{ _cssClass }}" {{ _extraAttributes }}> | ||
<div class="ecl-container"> | ||
<div class="ecl-row"> | ||
<div class="ecl-col-md-2"> | ||
{% include '@ec-europa/ecl-images' with profile.image %} | ||
</div> | ||
<div class="ecl-col-md-10 ecl-profile-topbar__pane"> | ||
{% include '@ec-europa/ecl-context-navs' with context_nav %} | ||
{% include '@ec-europa/ecl-buttons' with profile.expandable.button %} | ||
</div> | ||
</div> | ||
</div> | ||
<div | ||
{% if profile.expandable.expandable_body.extraAttributes is defined %} | ||
{% for attr in profile.expandable.expandable_body.extraAttributes %} | ||
{% set attribute = attr.name ~ '="' ~ attr.value ~ '"' %} | ||
{{ attribute }} | ||
{% endfor %} | ||
{% endif %} | ||
> | ||
<div class="ecl-container"> | ||
{% block body %} | ||
<p> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce et augue quis est dignissim lacinia. Curabitur interdum iaculis sagittis. Maecenas sodales elit est, et suscipit nisl vulputate eget. Mauris vel pulvinar odio. Sed diam turpis, cursus vel congue vel, lobortis a ipsum. Donec vel quam nec enim tristique efficitur at eget nisl. | ||
</p> | ||
{% endblock %} | ||
</div> | ||
</div> | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,25 @@ | ||
{ | ||
"private": true, | ||
"name": "@ec-europa/ecl-profile-topbars", | ||
"version": "0.3.0", | ||
"description": "", | ||
"main": "_profile-topbars.scss", | ||
"style": "_profile-topbars.scss", | ||
"main": "ecl-profile-topbars.scss", | ||
"style": "ecl-profile-topbars.scss", | ||
"author": "European Commission", | ||
"license": "EUPL-1.1", | ||
"peerDependencies": { | ||
"@ec-europa/ecl-buttons": "^0.1.0", | ||
"@ec-europa/ecl-context-navs": "^0.1.0", | ||
"@ec-europa/ecl-icons": "^0.1.0" | ||
} | ||
"@ec-europa/ecl-buttons": "^0.7.1", | ||
"@ec-europa/ecl-context-navs": "^0.3.1", | ||
"@ec-europa/ecl-icons": "^0.5.1" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/ec-europa/europa-component-library.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/ec-europa/europa-component-library/issues" | ||
}, | ||
"homepage": "https://github.com/ec-europa/europa-component-library#readme" | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,3 @@ export * from './components/ecl-navigation/ecl-navigation-menus/megamenu'; | |
export * from './components/ecl-tables/ecl-tables'; | ||
export * from './components/ecl-tabs/tabs'; | ||
// export * from './components/ecl-timelines/timelines'; | ||
// export * from './components/ecl-profile-topbars/profile-topbars'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume that the js was there to manage expandable block. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually it contained a console statement to refactor the js. Since the expandable component can be simply instantiated via the local package js file, I did that directly there without this file. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
describe('profile-toolbars', () => { | ||
before(() => { | ||
// Set viewport size | ||
browser.setViewportSize({ | ||
width: 1400, | ||
height: 600, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Screenshots could be smaller (but no need to change it now). |
||
}); | ||
|
||
browser.pause(1000); | ||
browser.url('ecl-profile-topbars.html'); | ||
browser.injectAxeCore(); | ||
}); | ||
|
||
// Normal state | ||
it('should match the reference screenshot', () => { | ||
const screenshots = browser.checkDocument({ | ||
name: 'profile-toolbars', | ||
}); | ||
expect(screenshots).to.matchReference(); | ||
}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add accessibility tests too, as in other test files:
|
||
|
||
it('should be accessible', () => { | ||
const a11yReport = browser.runAxeCore('ecl-profile-topbar').value; | ||
expect(a11yReport).to.be.accessible; | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Label of the button should change when expanding the text.
It will require an update of the expandable component; this can be done in a follow-up ticket.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created INNO-682 as a follow-up.