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

Radix-based Menu on Button component #6059

Merged
merged 16 commits into from
Jul 11, 2024

Conversation

bkrmendy
Copy link
Contributor

@bkrmendy bkrmendy commented Jul 10, 2024

Problem

It's hard to create simple menu-on-button type UIs, that are triggered by a button and display a floating list of options that can be selected. We also want to support keyboard navigation to pick an option

Fix

Wrap DropdownMenu from Radix to implement the component described above. This PR adds the new component, and uses it in two places: the panel selector button and the pages + button (see canvas-toolbar.tsx and pages-pane.tsx for examples of the new dropdown component)

image image

How to read this PR

  • Fork this project
  • Try the panel opener button
  • Add a new page

If you're interested in the code,

  • look at the changes in canvas-toolbar.tsx
  • look at the changes in pages-pane.tsx
  • look at the underlying code in radix-components.tsx (final file name TBD)

Scope

This PR only deals with the simple menu-on-button component. It's more advanced variant, which will be used in the component picker, will come on a follow-up PR

Manual Tests:
I hereby swear that:

  • I opened a hydrogen project and it loaded
  • I could navigate to various routes in Preview mode

@bkrmendy bkrmendy marked this pull request as draft July 10, 2024 13:15
Copy link
Contributor

github-actions bot commented Jul 10, 2024

Try me

Copy link

relativeci bot commented Jul 10, 2024

#13333 Bundle Size — 62.65MiB (+0.05%).

183fe3c(current) vs 6339ece master#13328(baseline)

Important

Bundle introduced 19 duplicate packages – View changed duplicate packages

Bundle metrics  Change 6 changes Regression 3 regressions
                 Current
#13333
     Baseline
#13328
Regression  Initial JS 45.71MiB(+0.07%) 45.68MiB
No change  Initial CSS 0B 0B
Change  Cache Invalidation 24.16% 21.19%
No change  Chunks 30 30
No change  Assets 33 33
Change  Modules 4374(+0.55%) 4350
No change  Duplicate Modules 524 524
Change  Duplicate Code 31.7%(-0.03%) 31.71%
Regression  Packages 469(+4.22%) 450
Regression  Duplicate Packages 70(+37.25%) 51
Bundle size by type  Change 2 changes Regression 1 regression Improvement 1 improvement
                 Current
#13333
     Baseline
#13328
Regression  JS 62.64MiB (+0.05%) 62.61MiB
Improvement  HTML 11.16KiB (-0.33%) 11.2KiB

Bundle analysis reportBranch feature/panel-selector-dropdown-...Project dashboard

@bkrmendy bkrmendy changed the title Unified Dropdown Radix-based Menu on Button component Jul 11, 2024
@bkrmendy bkrmendy marked this pull request as ready for review July 11, 2024 10:05
@bkrmendy bkrmendy merged commit 3b9ef27 into master Jul 11, 2024
20 checks passed
@bkrmendy bkrmendy deleted the feature/panel-selector-dropdown-v2 branch July 11, 2024 11:42
liady pushed a commit that referenced this pull request Dec 13, 2024
## Problem
It's hard to create simple menu-on-button type UIs, that are triggered
by a button and display a floating list of options that can be selected.
We also want to support keyboard navigation to pick an option

## Fix
Wrap `DropdownMenu` from Radix to implement the component described
above. This PR adds the new component, and uses it in two places: the
panel selector button and the pages + button (see `canvas-toolbar.tsx`
and `pages-pane.tsx` for examples of the new dropdown component)
  
<img width="522" alt="image"
src="https://github.com/concrete-utopia/utopia/assets/16385508/4e8467a1-f75f-4b3d-af18-530fd8009a8d">

<img width="221" alt="image"
src="https://github.com/concrete-utopia/utopia/assets/16385508/a8a524df-b47b-4e87-a623-3a2c1d2be950">


### How to read this PR
- Fork [this
project](https://utopia.fish/p/e3a62781-midi-foxtrot/?branch_name=feature-panel-selector-dropdown-v2)
- Try the panel opener button
- Add a new page

If you're interested in the code, 
- look at the changes in `canvas-toolbar.tsx`
- look at the changes in `pages-pane.tsx`
- look at the underlying code in `radix-components.tsx` (final file name
TBD)


## Scope
This PR only deals with the simple menu-on-button component. It's more
advanced variant, which will be used in the component picker, will come
on a follow-up PR

**Manual Tests:**
I hereby swear that:

- [ ] I opened a hydrogen project and it loaded
- [ ] I could navigate to various routes in Preview mode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants