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

Examples pages syntax highlighter removes . from compound JSX components #70

Closed
tulup-conner opened this issue Apr 29, 2022 · 3 comments
Assignees
Labels
🐛 bug Something isn't working confirmed This bug was confirmed good first issue Good for newcomers

Comments

@tulup-conner
Copy link
Collaborator

Describe the bug
Compound components have their . separator removed by the syntax highlighter used for example pages.

To be clear, it is still valid to import ButtonGroup directly, but the examples pages use Button.Group.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://flowbite-react.com/#/button-group
  2. Notice the Default example produces the following syntax highlighted code:
<ButtonGroup>
  <ButtonComponent color="alternative">
    Profile
  </ButtonComponent>
  <ButtonComponent color="alternative">
    Settings
  </ButtonComponent>
  <ButtonComponent color="alternative">
    Messages
  </ButtonComponent>
</ButtonGroup>

Expected behavior
The code should look like:

<Button.Group>
  <Button color="alternative">Profile</Button>
  <Button color="alternative">Settings</Button>
  <Button color="alternative">Messages</Button>
</Button.Group>

Screenshots
n/a

Desktop (please complete the following information):
n/a

Smartphone (please complete the following information):
n/a

Additional context
n/a

@tulup-conner
Copy link
Collaborator Author

I didn't even notice this initially, but it looks like it also incorrectly resolves the name of Button to ButtonComponent.

@rluders
Copy link
Collaborator

rluders commented Apr 29, 2022

Yep. All components sub-components must have the property displayName attached.
Here is a good example:

NavbarComponent.displayName = 'Navbar';

@rluders rluders added 🐛 bug Something isn't working confirmed This bug was confirmed 📚 documentation Improvements or additions to documentation good first issue Good for newcomers and removed 🐛 bug Something isn't working 📚 documentation Improvements or additions to documentation labels Apr 29, 2022
@tulup-conner
Copy link
Collaborator Author

I can confirm adding the displayName totally fixes this- so I think we just need to add a displayName to existing components and this should be resolved. I can take that on.

tulup-conner added a commit to tulup-conner/flowbite-react that referenced this issue Apr 30, 2022
…hemesberg#70

Adds `displayName` fields to compound components.
This is essential for the syntax highlighter we
use to display the code needed for each component.

For example, `<ButtonComponent>`, which is invalid,
now becomes `<Button>`, which is ready to copy-paste.
tulup-conner added a commit to tulup-conner/flowbite-react that referenced this issue May 1, 2022
…hemesberg#70

Adds `displayName` fields to compound components.
This is essential for the syntax highlighter we
use to display the code needed for each component.

For example, `<ButtonComponent>`, which is invalid,
now becomes `<Button>`, which is ready to copy-paste.
rluders pushed a commit that referenced this issue May 2, 2022
 (#73)

Adds `displayName` fields to compound components.
This is essential for the syntax highlighter we
use to display the code needed for each component.

For example, `<ButtonComponent>`, which is invalid,
now becomes `<Button>`, which is ready to copy-paste.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working confirmed This bug was confirmed good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants