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

Create Menu component #742

Closed
seancolsen opened this issue Oct 21, 2021 · 4 comments · Fixed by #1076
Closed

Create Menu component #742

seancolsen opened this issue Oct 21, 2021 · 4 comments · Fixed by #1076
Assignees
Labels
affects: dx Related to developer experience affects: ux Related to user experience type: enhancement New feature or request work: frontend Related to frontend code in the mathesar_ui directory

Comments

@seancolsen
Copy link
Contributor

seancolsen commented Oct 21, 2021

From what I can tell, we're going to end up with multiple places throughout the app where we want dropdown menus which behave similar to the typical "File" menus atop a desktop application.

From a discussion about styling dropdown menus, @ghislaineguerin proposed this mockup:

mockup

Additional thoughts:

  • I'd also like to see the text for all menu items left-aligned with each other regardless of whether an icon is present.

  • We might also want nested menus at some point, so it would be worth considering that when setting up this UI component.

Here's an example of a dropdown menu with other features that we may someday want to support

image

Initially proposed designs

  • For the most common use-case with a trigger that looks like a button with a downward pointing chevron

    <DropdownMenu icon={} label="" >
      <DropdownMenuItem icon={} label="" onClick={}/>
      <DropdownMenuItem icon={} label="" onClick={} isDisabled/>
      <DropdownMenuDivider />
      <DropdownSubMenu icon={} label="">
        <DropdownMenuItem icon={} label="" onClick={}/>
      </DropdownSubMenu>
    </DropdownMenu>
  • With a custom trigger

    <DropdownMenu>
      <svelte:fragment slot="trigger">
        put anything here
      </svelte:fragment>
      <DropdownMenuItem icon={} label="" onClick={}/>
      <DropdownMenuItem icon={} label="" onClick={}/>
    </DropdownMenu>

Finalized component design

<Menu>
  <MenuItem icon={} label="" onClick={}/>
  <MenuItem icon={} label="" onClick={}/>
  <MenuItem>
     Custom menu item
  </MenuItem>
  <MenuDivider/>
  <NestedMenu icon={} label="">
    <MenuItem icon={} label="" onClick={}/>
    <MenuItem icon={} label="" onClick={}/>
  </NestedMenu>
</Menu>
@seancolsen seancolsen added type: enhancement New feature or request affects: dx Related to developer experience affects: ux Related to user experience work: frontend Related to frontend code in the mathesar_ui directory status: triage labels Oct 21, 2021
@seancolsen seancolsen changed the title Create DropdownMenu components Create UI components for dropdown menus Oct 21, 2021
@pavish
Copy link
Member

pavish commented Oct 21, 2021

@seancolsen The proposed component design looks good to me.

We can use this issue to keep track of developing the DropdownMenu and DropdownMenuItem components.

The DropdownSubMenu can be taken up when we have a design which requires it. As of now, we do not have a need, let's pick it up when we do.

@pavish pavish added good first issue Everything in "Help wanted", PLUS being relatively easy and straightforward to implement. ready Ready for implementation and removed status: triage labels Oct 21, 2021
@pavish pavish added this to the [06] General Improvements #4 milestone Oct 21, 2021
@kgodey kgodey added the help wanted Community contributors can implement this label Oct 22, 2021
@pavish
Copy link
Member

pavish commented Nov 17, 2021

@seancolsen I think we may have to rethink the design for this.

I think Menu should be a separate low level component of it's own and we can slot it within Dropdown whenever required.

For eg., the column dropdown menu changes it's structure entirely when we try to switch column type. Having a separate Menu component would give us more flexibility.

I'm thinking of something like:

<Dropdown>
  <svelte:fragment slot="trigger">
  </svelte:fragment>

  <svelte:fragment slot="content">
    <Menu>
     <MenuItem icon={} label="" onClick={}/>
     <MenuItem icon={} label="" onClick={}/>
    </Menu>
  </svelte:fragment/>
</Dropdown>

This will separate the Menu logic from Dropdown logic. We can use this Menu in other places, such as on right-click context menu.

I do think it also makes sense to additionally have a DropdownMenu component which wraps both these up.

@seancolsen
Copy link
Contributor Author

@pavish That sounds good

@pavish pavish changed the title Create UI components for dropdown menus Create Menu component Jan 19, 2022
@seancolsen seancolsen self-assigned this Feb 15, 2022
@seancolsen seancolsen added status: started and removed ready Ready for implementation good first issue Everything in "Help wanted", PLUS being relatively easy and straightforward to implement. help wanted Community contributors can implement this labels Feb 15, 2022
@seancolsen seancolsen mentioned this issue Feb 15, 2022
7 tasks
@kgodey kgodey added this to the [07] Initial Data Types milestone Mar 1, 2022
@kgodey
Copy link
Contributor

kgodey commented Mar 1, 2022

I moved this to "Initial Data Types" since it's blocking other issues in it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects: dx Related to developer experience affects: ux Related to user experience type: enhancement New feature or request work: frontend Related to frontend code in the mathesar_ui directory
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

3 participants