Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

Feature - Menu Component [Design] #61

Open
2 tasks done
omarefg opened this issue Nov 14, 2021 · 1 comment
Open
2 tasks done

Feature - Menu Component [Design] #61

omarefg opened this issue Nov 14, 2021 · 1 comment
Assignees
Labels
carry-over-5 task that started in sprint 5 but it's not finished. design Design task feature New feature or request weight:2 weight:2
Milestone

Comments

@omarefg
Copy link
Contributor

omarefg commented Nov 14, 2021

Checklist βœ…

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Summary πŸ’‘

The Menu component is a component that attach to a ref and creates a menu refered to it.

Screenshot from 2021-11-14 10-26-28

It can receive anything as child, for example in the picture above is shown a Header showing the user info, but it will receive mostly MenuItems component, the Menu is inside a Paper component, it renders a ul element and the MenuItems would be the li elements inside.

It will be used like this:

import { Fragment, useRef } from 'react'
import { Menu, MenuItem } from '@platzily-ui/components'

const MyComponent = () => {
  const [anchorEl, setAnchorEl] = React.useState(null);
  const open = !!anchorEl;

  const handleClick = (open) => (event) => { setAnchorEl(open ? event.currentTarget : null); };  

  return (
    <Fragment>
      <button
        ref={ref}
        onClick={handleClick(true)}
      >
        Open Menu
      </button>
      <Menu
        anchorEl={anchorEl}
        open={open}
        onClose={handleClick(false)}
      >
        <MenuItem onClick={handleClick(false)}>option 1</MenuItem>
        <MenuItem onClick={handleClick(false)>option 2</MenuItem>
        <MenuItem onClick={handleClick(false)>option 3</MenuItem>
      </Menu>
    </Fragment>
  )
}

Requirements 🌈

The component must be tested using unit testing.

Motivation πŸ”¦

A way to provide a one in many selection path to the user.

@omarefg omarefg added feature New feature or request design Design task labels Nov 14, 2021
@omarefg omarefg added this to the Sprint 5 - UI milestone Nov 14, 2021
@felipedc09 felipedc09 self-assigned this Nov 16, 2021
@felipedc09 felipedc09 added the weight:2 weight:2 label Nov 16, 2021
@felipedc09
Copy link

I think this task is not necessary because this component would be created using a button component with any icon, the paper component and adding an item list, what do you think?.

@edanfesi edanfesi modified the milestones: Sprint 5 - UI, Sprint 6 - UI Dec 1, 2021
@edanfesi edanfesi added the carry-over-5 task that started in sprint 5 but it's not finished. label Dec 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
carry-over-5 task that started in sprint 5 but it's not finished. design Design task feature New feature or request weight:2 weight:2
Projects
Status: Todo
Development

No branches or pull requests

3 participants