How do i add a client react component to the sidebar #630
-
Hello! I've just started learning nextjs so sorry if it is a dumb question, but im trying to add a progress indicator to the sidebar. Appreciate all the help and shoutout to this great library! Link to my repo - https://github.com/spiritoftime/psle-math/tree/main/open-math-prep For comparison, this is the default sidebar: I tried to customise app\docs\layout.tsx, as follows:
I managed to get the progress indicator out, but im struggling to preserve the original sidebar. As you can see in the "Introductions", it has lost its original styling and these Items are not clickable. I couldn't find a way to preserve the original sidebar. From the docs, im seeing an excerpt that may be of help in letting me pass in my LectureSideBar and im trying to see I can add a react element in there (to no avail yet)
Could someone help me out? Thank you so much! P.S. the localstorage item in the useeffect for LectureSideBar is
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You have overridden the default sidebar item, so for your new item component you also need to inherit all functionalities of the original one. It doesn't make sense to preserve the original one if you have already overridden it. You can copy the original implementation from our source code. I'll suggest to add the indicator component to the page instead |
Beta Was this translation helpful? Give feedback.
You have overridden the default sidebar item, so for your new item component you also need to inherit all functionalities of the original one. It doesn't make sense to preserve the original one if you have already overridden it.
You can copy the original implementation from our source code.
I'll suggest to add the indicator component to the page instead