Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

feat(Menu): add widget #478

Merged
merged 8 commits into from
Aug 9, 2018
Merged

feat(Menu): add widget #478

merged 8 commits into from
Aug 9, 2018

Conversation

samouss
Copy link
Contributor

@samouss samouss commented Aug 9, 2018

Summary

This PR implements the Menu widget.

screen shot 2018-08-09 at 11 00 17

You can try the widget on Storybook.

Questions

One thing to note is that I scoped the top level div of the widget under the slot. It avoids to still have the top level className when you completely rewrite the widget. But it introduce a top level div on top of the widget (see picture below). It can be removed when Vue will support a "Fragment" like component. Do we want to implement this behaviour on all the widgets?

With default render

screen shot 2018-08-09 at 10 56 49 1

With custom render

screen shot 2018-08-09 at 10 57 35

@samouss samouss requested a review from a team August 9, 2018 09:01
@@ -1,46 +1,51 @@
<template>
<div :class="suit()" v-if="state">
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this fit is.css?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it fits since the full DOM widget is under the slot. It's just that we have now an extra (useless) div on top of the widget.

exports[`custom default render renders correctly 1`] = `

<div>
<div class>
Copy link
Contributor

Choose a reason for hiding this comment

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

Empty class, but not an issue I guess

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep but we do not care that much since it's the result of the custom render. I add a class only when canRefine is false.

Copy link
Contributor

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

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

code seems good here 🔥

@Haroenv Haroenv merged commit 0eeb79f into feat/connectors Aug 9, 2018
@Haroenv Haroenv deleted the feat/menu branch August 9, 2018 19:29
@samouss
Copy link
Contributor Author

samouss commented Aug 10, 2018

We didn't pick the solution with the top level div for the moment, since the extra div could be a bit problematic for users. We can review this proposal once the Fragment are available.

Haroenv pushed a commit to algolia/instantsearch that referenced this pull request Dec 28, 2022
* feat(Menu): update props

* feat(Menu): remove useless label props for slots

* feat(Menu): add searchable as TODO

* feat(Menu): update stories with more use cases

* style: run Prettier

* refactor(Menu): remove the className on the parent div

* docs(Menu): update

* fix(Menu): avoid the extra div
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants