Atri-Labs / atrilabs-engine

🧘‍♂️ Open-source no-code & code web app builder
https://atrilabs.com
GNU General Public License v3.0
4.13k stars 182 forks source link

Add a Vertical Menu Component #181

Open cruxcode opened 2 years ago

cruxcode commented 2 years ago

A vertical menu component that works as shown here.

Here is the component Signature

export type MenuItemType = {
  key: string;
  label: string;
  type: "menuitem";
  children: (SubMenuType | MenuItemGroupType)[];
};

export type SubMenuType = {
  key: string;
  label: string;
  children: (SubMenuType | MenuItemGroupType)[];
  type: "submenu";
};

export type MenuItemGroupType = {
  key: string;
  label: string;
  children: { key: string; label: string }[];
  type: "group";
};

export type ItemType = MenuItemType | SubMenuType | MenuItemGroupType;

export type VerticalMenuProps = {
  styles: React.CSSProperties;
  custom: {
   items: ItemType[];
  };
};

// replace the body of this function with your code
export const VerticalMenu: React.FC<VerticalMenuProps> = React.forwardRef((ref, props) => {
  return <div></div>;
})
Jitulteron7 commented 2 years ago

@cruxcode Plz assign me for this issue

cruxcode commented 2 years ago

The top-most menu items are called MenuItemType. A MenuItemType can have children of type SubMenuType or MenuItemGroupType. The difference between the two is that SubMenuType is collapsable while MenuItemGroupType are not collapsable.

cruxcode commented 2 years ago

@cruxcode Plz assign me for this issue

I have updated the signature. Please have a look at it again.

cruxcode commented 2 years ago

Relevant discussions for this issue https://github.com/Atri-Labs/atrilabs-engine/discussions/169 https://github.com/Atri-Labs/atrilabs-engine/discussions/184 https://github.com/Atri-Labs/atrilabs-engine/discussions/180 https://github.com/Atri-Labs/atrilabs-engine/discussions/186 https://github.com/Atri-Labs/atrilabs-engine/discussions/187

Jitulteron7 commented 2 years ago

thank you

darshitac11 commented 1 year ago

@all-contributors please add @arjundubey-cr for userTesting

allcontributors[bot] commented 1 year ago

@darshitac11

I've put up a pull request to add @arjundubey-cr! :tada: