Skip to content
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

product switcher header to fiori3 concept #669

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
49c086c
changed header and other stuff
JohannesDoberer Jul 22, 2019
e91c897
Merge branch 'master' into change-product-switcher-header-to-fiori3-c…
JohannesDoberer Jul 22, 2019
89de31a
fixing tets
JohannesDoberer Jul 22, 2019
4d62c0c
test fix
JohannesDoberer Jul 22, 2019
55855de
Merge branch 'master' into change-product-switcher-header-to-fiori3-c…
JohannesDoberer Jul 22, 2019
528c000
Merge branch 'master' into change-product-switcher-header-to-fiori3-c…
JohannesDoberer Jul 22, 2019
2f5e2a1
small change
JohannesDoberer Jul 23, 2019
e722ccb
refactor styles, add styles when icon instead of image, refactor html
marynaKhromova Jul 23, 2019
166c260
left over
JohannesDoberer Jul 24, 2019
f62ec7f
Merge branch 'master' into change-product-switcher-header-to-fiori3-c…
jesusreal Jul 25, 2019
5aaca7b
Merge branch 'master' into change-product-switcher-header-to-fiori3-c…
jesusreal Jul 25, 2019
7681991
Fix syntax error in angular app
jesusreal Jul 25, 2019
7fd6832
typo
JohannesDoberer Jul 25, 2019
0a69351
Merge branch 'change-product-switcher-header-to-fiori3-concept-' of g…
JohannesDoberer Jul 25, 2019
bced21e
Merge branch 'master' into change-product-switcher-header-to-fiori3-c…
maxmarkus Jul 26, 2019
abfcfd3
scrolling
JohannesDoberer Jul 26, 2019
2f2bd09
Merge branch 'change-product-switcher-header-to-fiori3-concept-' of g…
JohannesDoberer Jul 26, 2019
1d98f09
fix bug on mobile devices
marynaKhromova Jul 29, 2019
aaeccd9
css fix mobile
JohannesDoberer Jul 29, 2019
e9058b7
Merge branch 'master' into change-product-switcher-header-to-fiori3-c…
JohannesDoberer Jul 29, 2019
1010e74
Merge branch 'master' into change-product-switcher-header-to-fiori3-c…
JohannesDoberer Jul 29, 2019
7799fc6
Merge branch 'master' into change-product-switcher-header-to-fiori3-c…
JohannesDoberer Jul 29, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ class Navigation {
getProductSwitcherItems = () => {
const items = [
{
icon: 'https://sap.github.io/fundamental/images/products/06.png',
icon:
'https://pbs.twimg.com/profile_images/1143452953858183170/QLk-HGmK_bigger.png',
label: 'hybris',
externalLink: {
url: 'https://www.hybris.com',
Expand All @@ -246,21 +247,24 @@ class Navigation {
];
if (projectExists('pr1')) {
items.push({
icon: 'https://sap.github.io/fundamental/images/products/06.png',
icon:
'https://pbs.twimg.com/profile_images/1143452953858183170/QLk-HGmK_bigger.png',
label: 'Project 1',
link: '/projects/pr1'
});
}
if (projectExists('pr2')) {
items.push({
icon: 'https://sap.github.io/fundamental/images/products/06.png',
icon:
'https://pbs.twimg.com/profile_images/1143452953858183170/QLk-HGmK_bigger.png',
label: 'Project 2',
link: '/projects/pr2'
});
}
if (projectExists('pr3')) {
items.push({
icon: 'https://sap.github.io/fundamental/images/products/06.png',
icon:
'https://pbs.twimg.com/profile_images/1143452953858183170/QLk-HGmK_bigger.png',
label: 'Project 3',
link: '/projects/pr3'
});
Expand Down
43 changes: 35 additions & 8 deletions core/src/TopNavDropDown.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

<svelte:window on:resize="setViewportHeightVariable()"/>
{#if !isMobile}
<nav class="fd-menu">
<ul class="fd-menu__list fd-menu__list--top">
Expand Down Expand Up @@ -77,6 +77,9 @@ <h5 class="fd-action-bar__title fd-has-type-1">{node.label}</h5>
import { NavigationHelpers } from './utilities/helpers';
import { RoutingHelpers } from './utilities/helpers';
export default {
async oncreate() {
this.setViewportHeightVariable();
},
async onupdate({ changed, current, previous }) {
const currentNode = this.get().node;
let children = this.get().children;
Expand Down Expand Up @@ -105,6 +108,12 @@ <h5 class="fd-action-bar__title fd-has-type-1">{node.label}</h5>
},
closeSubNav() {
this.fire('close');
},
setViewportHeightVariable() {
// get the viewport height and multiple it by 1% to get a value for a vh unit
let vh = window.innerHeight * 0.01;
// set the value in the --vh custom property to the root of the document
document.documentElement.style.setProperty('--vh', `${vh}px`);
}
},
helpers: {
Expand All @@ -118,6 +127,17 @@ <h5 class="fd-action-bar__title fd-has-type-1">{node.label}</h5>
};
</script>
<style type="text/scss">
$topNavHeight: 48px;
$productSwitcherHeight: 64px;
.fd-popover__body {
overflow: auto;
max-height: calc(100vh - 50px);
max-height: calc(var(--vh, 1vh) * 100 - 50px);
}
.fd-product-switcher {
position: relative;
display: block;
}
.fd-product-switcher__product-icon > img {
max-height: 40px;
}
Expand All @@ -136,17 +156,22 @@ <h5 class="fd-action-bar__title fd-has-type-1">{node.label}</h5>
}
}

@media (max-width: 600px) {
.y-full-width-list__item {
padding: 10px 5px !important;
@media (max-width: 1023px) {
.y-full-width-list {
&__icon {
img {
width: 16px;
vertical-align: top;
}
}
}
}

.y-fd-modal--full-screen {
z-index: 1000;
position: fixed;
box-sizing: border-box;
top: 0px;
top: $topNavHeight;
left: 0;
margin: auto auto;

Expand Down Expand Up @@ -175,7 +200,10 @@ <h5 class="fd-action-bar__title fd-has-type-1">{node.label}</h5>
}
}
.fd-modal__body {
max-height: none;
max-height: calc(100vh - #{$topNavHeight} - #{$productSwitcherHeight});
max-height: calc(
var(--vh, 1vh) * 100 - #{$topNavHeight} - #{$productSwitcherHeight}
);
padding: 0;
}

Expand All @@ -201,9 +229,8 @@ <h5 class="fd-action-bar__title fd-has-type-1">{node.label}</h5>

&__item {
display: block !important;
padding: 20px 8px;
padding: 12px 15px;
cursor: pointer;
margin-left: 40px;
cursor: pointer;

&:hover {
Expand Down
127 changes: 91 additions & 36 deletions core/src/navigation/ProductSwitcher.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,26 @@
<div class="fd-product-switcher__body">
<nav class="fd-menu">
<ul class="fd-menu__list">
{#each productSwitcherItems as productSwitcherItem} {#if
productSwitcherItem.icon && productSwitcherItem.label}
{#each productSwitcherItems as productSwitcherItem}
{#if productSwitcherItem.label}
<li on:click="onActionClick(productSwitcherItem)">
<a class="fd-menu__item">
<span class="fd-product-switcher__product-icon">
<img src="{productSwitcherItem.icon}">
<span
jesusreal marked this conversation as resolved.
Show resolved Hide resolved
class="fd-product-switcher__product-icon {productSwitcherItem.icon && hasOpenUIicon(productSwitcherItem) ? 'sap-icon--' + productSwitcherItem.icon + ' sap-icon--m' : '' }"
>
{#if !hasOpenUIicon(productSwitcherItem)}
<img
src="{productSwitcherItem.icon}"
>
{/if}
</span>
<span
class="fd-product-switcher__product-title"
>{productSwitcherItem.label}</span>
</a>
</li>
{/if} {/each}
{/if}
{/each}
</ul>
</nav>
</div>
Expand All @@ -52,42 +59,43 @@
on:click="event.stopPropagation()"
>
<div class="fd-modal__content" role="document">
<div class="fd-modal__header">
<h1 class="fd-modal__title">My Products</h1>
<!-- TODO: add proper title -->
<div class="fd-action-bar">
<div class="fd-action-bar__back">
<button
class="fd-button--light fd-button--compact sap-icon--nav-back"
on:click="toggleDropdownState(event)"
data-cy="mobile-product-switcher-close"
></button>
</div>
<div class="fd-action-bar__header">
<h5 class="fd-action-bar__title fd-has-type-1">My Products</h5>
</div>
</div>
<div class="fd-modal__body">
<div class="fd-product-switcher__body">
<ul class="y-full-width-list">
{#each productSwitcherItems as productSwitcherItem}
{#if productSwitcherItem.icon && productSwitcherItem.label}
{#if productSwitcherItem.label}
<li
on:click="onActionClick(productSwitcherItem)"
class="y-full-width-list__item"
>
<span
class="y-full-width-list__icon"
style="background-image: url({productSwitcherItem.icon})"
></span>
<span class="y-full-width-list__title">{productSwitcherItem.label}</span>
<span class="y-full-width-list__subtitle">
<!-- Here comes the subtitle which is unknown for now -->
class="y-full-width-list__icon {productSwitcherItem.icon && hasOpenUIicon(productSwitcherItem) ? 'sap-icon--' + productSwitcherItem.icon + ' sap-icon--m' : '' }"
jesusreal marked this conversation as resolved.
Show resolved Hide resolved
>
{#if !hasOpenUIicon(productSwitcherItem)}
<img
src="{productSwitcherItem.icon}"
>
{/if}
</span>
<span class="y-full-width-list__title">{productSwitcherItem.label}</span>
</li>
{/if}
{/each}
</ul>
</div>
</div>
<footer class="fd-modal__footer">
<div class="fd-modal__actions">
<button
class="fd-button"
on:click="toggleDropdownState(event)"
data-cy="mobile-product-switcher-close"
>Close</button>
</div>
</footer>
</div>
</div>
</section>
Expand All @@ -97,6 +105,7 @@ <h1 class="fd-modal__title">My Products</h1>
import { LuigiConfig } from '../core-api';
import { Routing } from '../services/routing';
import { StateHelpers } from '../utilities/helpers';
import { NavigationHelpers } from '../utilities/helpers';

export default {
async oncreate() {
Expand Down Expand Up @@ -135,10 +144,28 @@ <h1 class="fd-modal__title">My Products</h1>
// set the value in the --vh custom property to the root of the document
document.documentElement.style.setProperty('--vh', `${vh}px`);
}
},
helpers: {
hasOpenUIicon(node) {
return NavigationHelpers.isOpenUIiconName(node.icon);
}
}
};
</script>
<style type="text/scss">
$topNavHeight: 48px;
$productSwitcherHeight: 64px;

:global(.fd-popover__body) {
overflow: auto;
max-height: calc(100vh - 50px);
max-height: calc(var(--vh, 1vh) * 100 - 50px);
}

.fd-product-switcher {
position: relative;
display: block;
}
.fd-product-switcher__product-icon > img {
max-height: 40px;
}
Expand All @@ -147,14 +174,18 @@ <h1 class="fd-modal__title">My Products</h1>
.fd-menu__item {
padding: 0;
text-align: center;

&:hover {
background-color: transparent;
}
}
}

.y-fd-modal--full-screen {
z-index: 1000;
position: fixed;
box-sizing: border-box;
top: 0;
top: $topNavHeight;
left: 0;
margin: auto auto;

Expand Down Expand Up @@ -183,7 +214,10 @@ <h1 class="fd-modal__title">My Products</h1>
}
}
.fd-modal__body {
max-height: none;
max-height: calc(100vh - #{$topNavHeight} - #{$productSwitcherHeight});
max-height: calc(
var(--vh, 1vh) * 100 - #{$topNavHeight} - #{$productSwitcherHeight}
);
padding: 0;
}

Expand All @@ -196,14 +230,44 @@ <h1 class="fd-modal__title">My Products</h1>
}
}

@media (min-width: 320px) {
.fd-action-bar__back {
display: block !important;
}
}

@media (max-width: 1023px) {
.y-full-width-list {
&__icon {
img {
width: 16px;
vertical-align: top;
}
}
}
}

@media (min-width: 1024px) {
.fd-product-switcher {
&__product-icon {
&.sap-icon--m {
&:before {
font-size: 38px;
}
}
}
}
}

.y-full-width-list {
width: 100%;
text-align: left;
list-style: none;

&__item {
display: block;
padding: 12px 8px;
padding: 12px 15px;
cursor: pointer;
cursor: pointer;

&:hover {
Expand All @@ -214,15 +278,6 @@ <h1 class="fd-modal__title">My Products</h1>
}
}

&__icon {
vertical-align: middle;
width: 40px;
height: 40px;
grid-row: 1 / 3;
background-position: center;
background-size: cover;
}

&__title {
color: #515559;
}
Expand Down
1 change: 1 addition & 0 deletions core/src/navigation/TopNav.html
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@
const dropDownState = !dropDownStates[name];

this.closeAllDropdowns();
this.closeMobileTopNavDropDown();

dropDownStates[name] = dropDownState;

Expand Down