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

Feat/BottomNavigation - added BottomNavigation with Example #1333

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

dhavalveera
Copy link
Contributor

@dhavalveera dhavalveera commented Mar 31, 2024

This Pull Request introduces the BottomNavigation component to Flowbite-React, enhancing the navigation experience for users. The BottomNavigation component offers a convenient way to navigate between different sections or pages of an application, displayed at the bottom of the screen for easy access. Leveraging this component in Flowbite-React provides users with intuitive and efficient navigation options, contributing to an improved user experience overall. With this addition, Flowbite-React becomes even more versatile, catering to a broader range of UI navigation needs.

Summary by CodeRabbit

  • New Features
    • Introduced Bottom Navigation component with support for theming and border styling.
    • Added documentation for the Bottom Navigation component, including usage examples.
    • Implemented Bottom Navigation in the Flowbite framework with examples showcasing default and bordered styles.
    • Added new entries for Bottom Navigation in COMPONENTS_DATA and DOCS_SIDEBAR for easy navigation and documentation access.
  • Documentation
    • Provided detailed documentation for using the Bottom Navigation component including examples with Tailwind CSS.
  • Tests
    • Added test cases for the Bottom Navigation component to ensure correct rendering and functionality.
  • Refactor
    • Enhanced the Flowbite theme with the addition of FlowbiteBottomNavigationTheme.

Copy link

stackblitz bot commented Mar 31, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

changeset-bot bot commented Mar 31, 2024

⚠️ No Changeset found

Latest commit: 1243234

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Mar 31, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
flowbite-react ❌ Failed (Inspect) Apr 2, 2024 2:47am
flowbite-react-storybook ❌ Failed (Inspect) Apr 2, 2024 2:47am

Copy link
Contributor

coderabbitai bot commented Mar 31, 2024

Walkthrough

This update introduces a Bottom Navigation component to the Flowbite framework, enhancing user navigation with a stylish, customizable bar at the screen's bottom. Tailored for React and styled with Tailwind CSS, this component comes with examples, documentation, and tests ensuring functionality and ease of integration. It's a significant addition, providing developers with more tools to create intuitive and visually appealing web applications.

Changes

Files Summary
.../components.tsx, .../docs-sidebar.ts Added a new entry for "Bottom Navigation" in the COMPONENTS_DATA and DOCS_SIDEBAR arrays.
.../examples/bottomNavigation/*.tsx Introduced components for styled Bottom Navigation with icons and labels.
.../examples/index.ts, .../BottomNavigation/index.ts Added exports for Bottom Navigation components in the examples and UI library.
.../BottomNavigation/*.spec.tsx, .../BottomNavigation/*.stories.tsx Included test cases and storybook stories for the Bottom Navigation components.
.../Flowbite/FlowbiteTheme.ts, .../index.ts, .../theme.ts Updated theme declarations and exports to include Bottom Navigation component.

🐇✨
In the realm of code where the bits do hop,
A new component lands with a gentle plop.
Navigate below, with ease and grace,
A Bottom Nav bar finds its place.
With icons and borders, styled so neat,
🌟 Flowbite's journey now more complete. 🌟
~ @coderabbitai 🐰💻

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?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 40e4e87 and 3d1b41b.
Files ignored due to path filters (2)
  • apps/web/public/images/components/bottom-bar-dark.svg is excluded by !**/*.svg
  • apps/web/public/images/components/bottom-bar.svg is excluded by !**/*.svg
Files selected for processing (16)
  • apps/web/content/docs/components/bottom-navigation.mdx (1 hunks)
  • apps/web/data/components.tsx (1 hunks)
  • apps/web/data/docs-sidebar.ts (1 hunks)
  • apps/web/examples/bottomNavigation/bottomNavigation.root.tsx (1 hunks)
  • apps/web/examples/bottomNavigation/bottomNavigation.withBorder.tsx (1 hunks)
  • apps/web/examples/bottomNavigation/index.ts (1 hunks)
  • apps/web/examples/index.ts (1 hunks)
  • packages/ui/src/components/BottomNavigation/BottomNavigation.spec.tsx (1 hunks)
  • packages/ui/src/components/BottomNavigation/BottomNavigation.stories.tsx (1 hunks)
  • packages/ui/src/components/BottomNavigation/BottomNavigation.tsx (1 hunks)
  • packages/ui/src/components/BottomNavigation/BottomNavigationItem.tsx (1 hunks)
  • packages/ui/src/components/BottomNavigation/index.ts (1 hunks)
  • packages/ui/src/components/BottomNavigation/theme.ts (1 hunks)
  • packages/ui/src/components/Flowbite/FlowbiteTheme.ts (2 hunks)
  • packages/ui/src/index.ts (1 hunks)
  • packages/ui/src/theme.ts (2 hunks)
Files skipped from review due to trivial changes (3)
  • apps/web/data/docs-sidebar.ts
  • apps/web/examples/bottomNavigation/index.ts
  • packages/ui/src/components/BottomNavigation/index.ts
Additional Context Used
GitHub Check Runs (1)
🕵 Lint failure (13)

packages/ui/src/components/BottomNavigation/BottomNavigation.spec.tsx: [failure] 5-5:
Describe callback cannot be async

Additional comments not posted (18)
packages/ui/src/components/BottomNavigation/theme.ts (1)

3-18: Consider using CSS variables for colors and sizes to enhance theme customization. This approach allows users to easily modify the component's appearance without altering the source code.

apps/web/content/docs/components/bottom-navigation.mdx (1)

6-20: The documentation is clear and informative. However, it would be beneficial to include a section on how to customize the BottomNavigation component, such as changing colors or adding custom icons, to help users tailor the component to their needs.

apps/web/examples/index.ts (1)

7-7: The export for bottomNavigation is consistent with the naming and structure of other component exports. This ensures a uniform approach to exporting components in the library.

packages/ui/src/components/BottomNavigation/BottomNavigation.stories.tsx (1)

17-47: The Storybook stories provide a good overview of the BottomNavigation component's capabilities. Consider adding a story that demonstrates how to use the component with a dynamic list of navigation items, as this is a common use case.

packages/ui/src/components/BottomNavigation/BottomNavigation.tsx (1)

25-45: The implementation of the BottomNavigation component is well-structured and follows best practices. However, consider adding PropTypes for better type checking in non-TypeScript environments.

apps/web/examples/bottomNavigation/bottomNavigation.root.tsx (1)

26-43: The example implementation is clear and demonstrates the basic usage of the BottomNavigation component effectively. To enhance the example, consider adding comments explaining each part of the component, especially the theme prop customization.

apps/web/examples/bottomNavigation/bottomNavigation.withBorder.tsx (1)

26-44: The example implementation showcasing the BottomNavigation component with borders is well-done. Similar to the previous example, adding comments to explain the customization and the use of the bordered prop would make the example more informative for users.

packages/ui/src/index.ts (1)

8-8: The export for the BottomNavigation component is correctly added and follows the library's export pattern. This ensures that the component is properly exposed for use in consumer applications.

packages/ui/src/components/BottomNavigation/BottomNavigationItem.tsx (4)

1-1: Consider removing "use client"; if server-side rendering (SSR) support is intended for this component, as it explicitly opts out of SSR.


20-26: The BottomNavigationItemProps interface extends ComponentProps<"button"> but omits "ref". Ensure that this omission is intentional and documented if necessary, as it may limit the component's flexibility in certain use cases.


39-39: The use of mergeDeep for theme customization is a good practice for flexibility. However, ensure that this deep merge function handles all edge cases correctly, especially with nested properties and arrays.


67-72: The default icon (IoMdHome) is a good fallback. Ensure that the choice of this specific icon as the default is documented, as it might not be intuitive for all use cases.

packages/ui/src/theme.ts (2)

7-7: The import of bottomNavigationTheme is correctly placed alphabetically among other component themes. This maintains consistency and readability in the theme imports.


50-50: Successfully adding the bottomNavigation theme to the global theme object ensures that the new component is fully integrated into the theming system. This allows for easy customization and consistency across the library.

packages/ui/src/components/BottomNavigation/BottomNavigation.spec.tsx (1)

111-134: The test utility functions and the TestBottomNavigation component are well-structured and promote code reuse across tests. This approach enhances test readability and maintainability.

packages/ui/src/components/Flowbite/FlowbiteTheme.ts (2)

7-7: The import of FlowbiteBottomNavigationTheme is correctly placed alphabetically among other component themes. This maintains consistency and readability in the theme imports.


52-52: Successfully adding the bottomNavigation to the FlowbiteTheme interface ensures that the new component's theme is fully integrated into the theming system. This allows for easy customization and consistency across the library.

apps/web/data/components.tsx (1)

38-44: The addition of the "Bottom Navigation" entry to the COMPONENTS_DATA array is correctly implemented, with appropriate image paths and link. This ensures that the new component is discoverable in the documentation or UI library.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 3d1b41b and a98e9cf.
Files selected for processing (1)
  • packages/ui/src/components/BottomNavigation/BottomNavigation.spec.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • packages/ui/src/components/BottomNavigation/BottomNavigation.spec.tsx
Additional Context Used

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between a98e9cf and 2dbc413.
Files selected for processing (6)
  • apps/web/content/docs/components/bottom-navigation.mdx (1 hunks)
  • apps/web/examples/bottomNavigation/bottomNavigation.root.tsx (1 hunks)
  • apps/web/examples/bottomNavigation/bottomNavigation.withBorder.tsx (1 hunks)
  • apps/web/examples/bottomNavigation/bottomNavigation.withTooltip.tsx (1 hunks)
  • apps/web/examples/bottomNavigation/index.ts (1 hunks)
  • packages/ui/src/components/BottomNavigation/BottomNavigationItem.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (5)
  • apps/web/content/docs/components/bottom-navigation.mdx
  • apps/web/examples/bottomNavigation/bottomNavigation.root.tsx
  • apps/web/examples/bottomNavigation/bottomNavigation.withBorder.tsx
  • apps/web/examples/bottomNavigation/index.ts
  • packages/ui/src/components/BottomNavigation/BottomNavigationItem.tsx
Additional Context Used
Additional comments not posted (3)
apps/web/examples/bottomNavigation/bottomNavigation.withTooltip.tsx (3)

1-1: The usage of "use client"; at the top of the file indicates that this component is intended to run only in the client-side environment. Ensure that this aligns with the overall architecture and deployment strategy of the Flowbite-React library, especially considering server-side rendering (SSR) scenarios.


9-24: The code snippet provided as a string within the code variable is a great way to showcase the usage of the BottomNavigation component. However, ensure that this code snippet is kept up-to-date with any changes to the component's API to prevent documentation drift. Additionally, consider adding a brief comment within the code snippet explaining its purpose, especially the use of showTooltip, for better clarity to developers.


26-42: The Component function demonstrates the BottomNavigation component with a custom theme. This is a good practice for showcasing theme customization capabilities. However, ensure that the CSS classes used (absolute, bottom-0, left-0, etc.) are consistent with the rest of the Flowbite-React library to maintain a cohesive look and feel. Additionally, consider explaining the choice of these specific classes in either code comments or documentation to help developers understand the theming approach.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 2dbc413 and d2ffd70.
Files selected for processing (2)
  • apps/web/content/docs/components/bottom-navigation.mdx (1 hunks)
  • apps/web/examples/bottomNavigation/bottomNavigation.withTooltip.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • apps/web/examples/bottomNavigation/bottomNavigation.withTooltip.tsx
Additional Context Used

apps/web/content/docs/components/bottom-navigation.mdx Outdated Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between d2ffd70 and 1243234.
Files selected for processing (1)
  • apps/web/content/docs/components/bottom-navigation.mdx (1 hunks)
Additional Context Used
Additional comments not posted (5)
apps/web/content/docs/components/bottom-navigation.mdx (5)

1-8: The introduction provides a clear overview of the Bottom Navigation component's purpose and usage. Well done on setting the context for the readers.


10-14: The "Default bottom navigation" section is clear and provides useful guidance on implementing the default navigation bar. The example reference is correctly formatted.


16-20: The "Menu items with border" section clearly explains how to differentiate menu items with borders. The example reference is correctly formatted.


22-32: The "Example with Tooltip" and "Theme" sections are informative, providing guidance on enhancing the bottom navigation with tooltips and customizing its appearance through theming. The references to examples and theme documentation are correctly formatted.


34-36: The reference link for "Flowbite Bottom Navigation" needs verification. As previously noted, it may direct users to incorrect documentation. Please ensure it points to the correct page for the Bottom Navigation component.

@dhavalveera
Copy link
Contributor Author

@SutuSebastian - can you please review?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants