-
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 11 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,59 @@ | ||
module.exports = { | ||
title: 'Profile topbars', | ||
label: 'Profile topbars', | ||
status: 'planned', | ||
status: 'ready', | ||
tags: ['organism'], | ||
context: { | ||
_demo: { | ||
scripts: | ||
"document.addEventListener('DOMContentLoaded', function () { ECL.initExpandables(); });", | ||
}, | ||
profile: { | ||
avatar: 'http://lorempixel.com/output/business-q-c-160-160-10.jpg', | ||
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' }, | ||
], | ||
}, | ||
}, | ||
details: | ||
'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.', | ||
}, | ||
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,31 @@ | ||
/** | ||
* ECL Profile Topbar | ||
* @define profile-topbar | ||
*/ | ||
|
||
.ecl-profile-topbar { | ||
margin: 0; | ||
} | ||
|
||
// This is esentially .section__group which can be used when refactored. | ||
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. Small typo in "essentially" |
||
.ecl-profile-topbar__wrapper { | ||
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. What is the puropose of this wrapper? Couldn't we use padding inside the component instead? 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. You're right, it's a perfect candidate for a re-usable class. It's The inverse padding will have to be added on a specific class in a similar way. 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'm not sure I understand what you say.. 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 think I made it right this time, the result is not totally the same, but hopefully acceptable. |
||
margin-bottom: map-get($ecl-spacing, 'm'); | ||
margin-top: map-get($ecl-spacing, 'm'); | ||
} | ||
|
||
.ecl-profile-topbar__pane { | ||
height: 100%; | ||
min-height: 160px; | ||
position: relative; | ||
|
||
> .ecl-profile-topbar__pane-button { | ||
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. No need to use ">" selector here I guess. There is a specific class on the button so css could be at same level as the other ones (no hierarchy) |
||
bottom: 0; | ||
margin-bottom: 0; | ||
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. This margin is useless as buttons already have margin:0 :) 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. Good point 👍 |
||
position: absolute; | ||
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. Could have use a display flex instead of position absolute. 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 think the approach of relative -> absolute positioning is simple enough for this case. Flex would be a bit overkill in my opinion. |
||
} | ||
} | ||
|
||
.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,23 @@ | ||
<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> | ||
|
||
<div id="collapse" class="profile_topbar__expander"> | ||
<div class="container"> | ||
Expander content | ||
</div> | ||
<div class="ecl-profile-topbar"> | ||
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 use the same structure for twig file as we started to use in other components:
See featured-items component for instance. |
||
<div class="ecl-container"> | ||
<div class="ecl-row ecl-profile-topbar__wrapper"> | ||
<div class="ecl-col-md-2"> | ||
<img src="{{ profile.avatar }}"/> | ||
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. Missing alt for image 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. thanks, changed to |
||
</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 %} | ||
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. Label of the button should change when expanding the text. 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. Created INNO-682 as a follow-up. |
||
</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">{{ profile.details }}</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", | ||
"version": "0.4.0", | ||
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. No need to change version manually, it is handles automagically. 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. reverted 👍 |
||
"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,20 @@ | ||
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'); | ||
}); | ||
|
||
// 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:
|
||
}); |
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.
As this content could be a complexe html structure (with, list, grid, etc.), I would rather use a block in twig file instead of a variable.