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

add custom component to menuItem #113

Closed
gtolarc opened this issue Feb 16, 2021 · 3 comments
Closed

add custom component to menuItem #113

gtolarc opened this issue Feb 16, 2021 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@gtolarc
Copy link

gtolarc commented Feb 16, 2021

I wish I could put a custom component in the menuItem. For example, to put a badge to display real-time information from a table. Here is concept ex).

import { MenuItemType } from '@paljs/ui';

const items: MenuItemType[] = [
  { title: 'Home Page', icon: { name: 'home' }, link: { href: '/admin' } },
  {
    title: 'Models',
    icon: { name: 'layers-outline' },
    children: [
      {
        title: 'Users',
        link: { href: '/admin/models/User' } },
        extras: [ // <- this
          { position: 'prefix', component: <Hello /> },
          { position: 'postfix', component: <World /> },
        ],
    ],
  },
];
export default items;
@AhmedElywa AhmedElywa self-assigned this Feb 17, 2021
@AhmedElywa AhmedElywa added the enhancement New feature or request label Feb 17, 2021
AhmedElywa added a commit that referenced this issue Feb 17, 2021
@gtolarc
Copy link
Author

gtolarc commented Feb 18, 2021

It works well, but there is a problem with the arrangement of custom components added in the default css.
Can you add the following css by default?

.menu-item {
  position: relative;
}

@AhmedElywa
Copy link
Collaborator

You can add this in your use case just warp the component with styled component and add this to it

@gtolarc
Copy link
Author

gtolarc commented Feb 18, 2021

I'm already using it like that, but wouldn't it be better to apply it by default so that new users don't feel confused?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants