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 on mobile #424

Merged
merged 24 commits into from
Mar 27, 2019

Conversation

parostatkiem-zz
Copy link
Contributor

Description

My Products label in popover menu is not aligned with its icon. This bug will be fixed in another PR.

The version of Product Switcher depends on which link was clicked to open it. This means it's dependent on the fact if shellbar is collapsed or not, not on a viewport size directly. With this approach, the Product Switcher won't be damaged by any further changes in shellbar's behaviour and the situation with having desktop menu and mobile Product Switcher (and opposite) is impossible.

Changes proposed in this pull request:

  • add a link to mobile popover menu that opens mobile Product Switcher
  • manage Product Switcher being desktop or mobile with Svelte state (not CSS)
  • add a template for mobile Product Switcher
  • add custom styles for full-width modal and list inside it (see this)
  • write mobile e2e tests

Related issue(s)

@y-kkamil y-kkamil self-assigned this Mar 19, 2019
Copy link

@y-kkamil y-kkamil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the mobile product switcher be closed after clicking on one of the elements? It seems more natural for me, rather than having to click on the item and then closing product switcher.

toggleDropdownState(name) {
toggleDropdownState(name, event) {
if (event)
event.stopPropagation();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like prettier did not kick in --> it should either be enclosed within { } or in the same line

data-cy="desktop-product-switcher"
></button>
</div>
{#if !isMobile}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be moved to the top (line 6)? - the markup above is not being displayed on mobile anyway.. or am i just wrong? 🤔

@@ -217,14 +237,27 @@
}
},
methods: {
openMobileProductSwitcher(event) {
if (event)
event.stopPropagation();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same issue with Prettier here

@y-kkamil
Copy link

y-kkamil commented Mar 20, 2019

please take a look at my comment above:

Shouldn't the mobile product switcher be closed after clicking on one of the elements? It seems more natural for me, rather than having to click on the item and then closing product switcher.

other than that: i think it is ok

y-kkamil
y-kkamil previously approved these changes Mar 21, 2019
@dariadomagala-sap dariadomagala-sap self-assigned this Mar 22, 2019
Copy link
Contributor

@dariadomagala-sap dariadomagala-sap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would vote for creating two separate instances of Product Switcher, and pass the true/false values to it. I checked and it looks like it works properly and in my opinion your approach could cause more errors (like this disappearing button).

</span>
<span class="y-full-width-list__subtitle">
Subtitle
<!-- TODO: add proper subtitle -->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest adding it now, or removing this Subtitle text for now :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So.. should I add it to ProductSwitcher config?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so. Please check it with @hardl

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyway, I vote for a separate task here. If we introduced a new config variable, the docu would need to be updated and it'd be nice to use it in desktop PS also...

<ProductSwitcher
bind:dropDownStates
on:toggleDropdownState="toggleDropdownState(event.name)"
on:setProductSwitcherToDesktop="set({isProductSwitcherMobile: false})"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is not needed anymore with the new approach.

{/each}
{#if isProductSwitcherAvailable}
<li>
<a class="fd-menu__item" on:click="openMobileProductSwitcher(event)" data-cy="mobile-product-switcher">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now we could just leave for the click event toggleDropdownState('productSwitcherPopover'), nothing else is done in the openMobileProductSwitcher function anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are wrong, the event propagation is stopped. That's why it doesn't work when I put toggleDropdownState here. But I did this change in ProductSwitcher.html where stopping propagation wasn't needed :)

@y-kkamil y-kkamil self-requested a review March 27, 2019 08:45
@y-kkamil y-kkamil dismissed their stale review March 27, 2019 08:46

Due to serious changes after my approval, I will take a look once again

@parostatkiem-zz parostatkiem-zz merged commit 1afcf29 into SAP:master Mar 27, 2019
@parostatkiem-zz parostatkiem-zz deleted the product-switcher-on-mobile branch March 27, 2019 11:44
stanleychh pushed a commit to stanleychh/luigi that referenced this pull request Dec 30, 2021
* code cleanup & add comments

* Change mobile switcher button look

* Update fiori-fundamentals

* Improve mobile list styling

* Fix fd-shellbar--end text-align

* Update Cypress

* Add e2e tests

* Remove unused code

* Simplify PS management by adding separate mobile instance

* Remove "subtitle" label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants