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

Using Sidebar with react-router #327

Open
apust opened this issue Jan 25, 2021 · 0 comments
Open

Using Sidebar with react-router #327

apust opened this issue Jan 25, 2021 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@apust
Copy link
Contributor

apust commented Jan 25, 2021

When using Sidebar with react-router, it is essentially easier to implement your own SidebarItem than to use an existing component.

interface SidebarItemProps {
  icon: string;
  title: string;
  url: string;
}

export function SidebarItem({ icon, title, url }: SidebarItemProps) {
  return (
    <NavLink
      to={url}
      className="_e_sidebar-item"
      activeClassName="_e_sidebar-item_active"
    >
      <div className="_e_sidebar-item__icon">
        <Icon name={icon} />
      </div>
      <div className="_e_sidebar-item__text">{title}</div>
      <div className="_e_sidebar-item__tooltip _e_tooltip _e_tooltip_right">
        {title}
      </div>
    </NavLink>
  );
}

We should provide a better experience for developers. We can even consider using react-router-dom as a peer dependency to @elephas/react-layout, since that's what all React devs working with Elephas React are using anyways.

@apust apust added the help wanted Extra attention is needed label Jan 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant