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

Implement React Icons in the Sidebar - potentially other parts of the site as well #415

Open
1 task
futuresoup opened this issue Jan 23, 2024 · 4 comments
Open
1 task
Assignees

Comments

@futuresoup
Copy link
Member

futuresoup commented Jan 23, 2024

  • How do we use these in Markdown and Sidebar?
@futuresoup
Copy link
Member Author

@sbasken I believe you installed React Icons for the admonitions. How can we use them elsewhere on the site?

Particularly the sidebar

@futuresoup futuresoup changed the title Implement React Icons in menu, body, etc. Implement React Icons in the Sidebar - potentially other parts of the site as well Jan 24, 2024
@sbasken
Copy link
Contributor

sbasken commented Jan 24, 2024

@futuresoup Let me check!

@sbasken
Copy link
Contributor

sbasken commented Jan 24, 2024

@futuresoup To use react-icons, you can simply import the library in other component files you want to use but since sidebar is a Docusaurus built in component, you would first need to run npm run swizzle, eject DocSidebarItem component from @docusaurus/theme-classic. Once you have the component in the src/theme folder, you should be able to import react icon in the index.js file like below:

<div style={{ display: 'flex', alignItems: 'center' }}>
    <FaBookOpen style={{ marginRight: '8px' }} />
    {label}
 </div>
Screenshot 2024-01-24 at 11 03 07 AM

This will generate the same icon for every item on the side bar so we would have to use if statement to generate different icons if you want to use different ones.

@sbasken
Copy link
Contributor

sbasken commented Jan 24, 2024

And 'Resources' and 'Contribute' have 'doc' as type in sidebar.js so it's probably another component.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

4 participants