-
Notifications
You must be signed in to change notification settings - Fork 155
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
Adding Sidebar #145
base: main
Are you sure you want to change the base?
Adding Sidebar #145
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import nextpy as xt | ||
|
||
|
||
|
||
def SidebarItem(text, href, class_name="", **kwargs): | ||
return xt.link( | ||
xt.text(text), | ||
class_name=f"text-md text-left {class_name}", | ||
href=href, | ||
bg="transparent", | ||
_hover={"bg": "#0A4075"}, | ||
border_radius="999px", | ||
width="100%", | ||
pl="14px", | ||
py="6px", | ||
**kwargs, | ||
) | ||
|
||
|
||
def Sidebar( | ||
*children, | ||
top="0px", | ||
**kwargs, | ||
): | ||
return xt.box( | ||
xt.vstack( | ||
*children, | ||
spacing="4px", | ||
width="100%", | ||
align_items="start", | ||
pl="4px", | ||
pt="1rem", | ||
height="100%", | ||
), | ||
display=["none", "block", "block"], | ||
width="15em", | ||
top=top, | ||
height=f"calc(100dvh - {top})", | ||
position="sticky", | ||
class_name="pt-4 pl-4 overflow-y-auto ", | ||
**kwargs, | ||
) | ||
Comment on lines
+20
to
+42
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Consider making the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
SidebarItem
function correctly implements the creation of a sidebar item using thext.link
component. The use ofclass_name
to allow for additional styling is a good practice. However, consider documenting the expected**kwargs
to improve maintainability and usability for other developers.Consider adding documentation for the
**kwargs
parameter to clarify what additional arguments are supported and how they are used. This will enhance the function's usability and maintainability.