-
Notifications
You must be signed in to change notification settings - Fork 163
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
Adding Sidebar #145
Conversation
WalkthroughThe update introduces Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Review Status
Actionable comments generated: 2
Configuration used: CodeRabbit UI
Files selected for processing (5)
- nextpy/init.py (1 hunks)
- nextpy/init.pyi (1 hunks)
- nextpy/interfaces/web/components/chakra/init.py (1 hunks)
- nextpy/interfaces/web/components/chakra/layout/init.py (1 hunks)
- nextpy/interfaces/web/components/chakra/layout/sidebar.py (1 hunks)
Files skipped from review due to trivial changes (1)
- nextpy/init.py
Additional comments: 3
nextpy/interfaces/web/components/chakra/layout/__init__.py (1)
- 16-16: The addition of
Sidebar
andSidebarItem
to the exports is correctly implemented and aligns with the PR's objectives to enhance the framework's sidebar functionality. The dynamic approach to populating__all__
ensures that these components are automatically exported, which is both efficient and maintainable.nextpy/interfaces/web/components/chakra/__init__.py (1)
- 164-165: The declarations for
sidebar
andsidebar_item
are correctly added, aligning with the PR's objectives. However, unlike other components that use the.create
method, these are directly assigned. If this inconsistency is intentional due to the nature ofSidebar
andSidebarItem
, it's acceptable. Otherwise, consider aligning with the existing component creation pattern for consistency.nextpy/__init__.pyi (1)
- 401-402: The addition of
sidebar
andsidebar_item
imports fromnextpy.interfaces.web.components
is correctly implemented and follows the existing pattern of importing components in this file. This change effectively exposes the new sidebar functionality to users of thenext.py
framework, aligning with the PR's objectives.
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, | ||
) |
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 the xt.link
component. The use of class_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.
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, | ||
) |
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 Sidebar
function effectively creates a sidebar container with customizable top positioning and additional styling options. The use of xt.vstack
for vertical alignment of children and the sticky
positioning are well-suited for a sidebar component. However, the hardcoded display
values may limit responsiveness across different screen sizes.
Consider making the display
property customizable through parameters or responsive design techniques to enhance the sidebar's adaptability across various devices.
Components ->
xt.sidebar() - Parent element for the sidebar. Takes a prop "top", which can be the height of navbar or whatever needs to be rendered above it.
xt.sidebar_item - It takes title and href and class_name for styling.
Summary by CodeRabbit
Sidebar
andSidebarItem
components for creating a sticky sidebar layout in web interfaces, with customizable properties such as width, top position, and styling options.