flowbite-react icon indicating copy to clipboard operation
flowbite-react copied to clipboard

Feat/render timeline point inner content

Open adel-gu opened this issue 1 year ago β€’ 3 comments

Issue #1276

Summary

This PR adds an optional render prop on the TimelinePoint to render any component as inner content for the TimelinePoint component.

Example usage

    ...
      <Timeline.Point
          render={() => (
            <Avatar img="https://flowbite.com/docs/images/people/profile-picture-3.jpg" rounded size="xm" />
          )}
      />
    ...

Preview

Screenshot from 2024-12-26 10-28-53

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Added a "Render props" section to the Timeline component documentation.
    • Introduced a new React component for rendering a structured timeline with customizable inner content.
    • Added a new story titled "ActivityLog" to showcase the Timeline component with avatars and timestamps.
    • Enhanced the TimelinePoint component to support a render function for flexible content rendering.
    • Improved the Timeline.Point component to allow rendering components as inner content.
  • Bug Fixes

    • Improved test coverage for the Timeline component, validating the render prop functionality.
  • Documentation

    • Updated documentation to include guidance on the new render prop feature.

adel-gu avatar Dec 26 '24 09:12 adel-gu

πŸ¦‹ Changeset detected

Latest commit: 2c54812ed8b424733b82894739c7e345595cce3c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
flowbite-react Patch

Not sure what this means? Click here to learn what changesets are.

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

changeset-bot[bot] avatar Dec 26 '24 09:12 changeset-bot[bot]

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Comments Updated (UTC)
flowbite-react βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jan 15, 2025 4:16pm
flowbite-react-storybook βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jan 15, 2025 4:16pm

vercel[bot] avatar Dec 26 '24 09:12 vercel[bot]

[!WARNING] There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

πŸ”§ eslint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/ui/src/components/Timeline/TimelinePoint.tsx

Oops! Something went wrong! :(

ESLint: 8.57.0

ESLint couldn't find the plugin "eslint-plugin-react".

(The package "eslint-plugin-react" was not found when loaded as a Node module from the directory "/packages/ui".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-react@latest --save-dev

The plugin "eslint-plugin-react" was referenced from the config file in "packages/ui/.eslintrc.cjs".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

Walkthrough

The pull request introduces a new "Render props" feature for the Timeline component, enhancing its documentation and implementation across several files. This feature allows developers to customize the inner content of timeline points by rendering components such as avatars. Changes include updates to documentation, the addition of a new React component, export statements, test cases, and Storybook stories, collectively improving the flexibility and usability of the Timeline component.

Changes

File Change Summary
apps/web/content/docs/components/timeline.mdx Added "Render props" section explaining how to use the render prop
apps/web/examples/timeline/index.ts Added export for render function from ./timeline.render module
apps/web/examples/timeline/timeline.render.tsx New client component with timeline example using render props
packages/ui/src/components/Timeline/Timeline.spec.tsx Added test case for render prop functionality
packages/ui/src/components/Timeline/Timeline.stories.tsx New ActivityLog story showcasing render prop with avatars
packages/ui/src/components/Timeline/TimelinePoint.tsx Added render prop to TimelinePointProps interface
.changeset/lucky-ladybugs-film.md Enhanced Timeline.Point component to support rendering components as inner content

Sequence Diagram

sequenceDiagram
    participant Developer
    participant TimelineComponent
    participant RenderProp
    
    Developer->>TimelineComponent: Configure Timeline
    Developer->>TimelineComponent: Provide render prop
    TimelineComponent->>RenderProp: Invoke render function
    RenderProp-->>TimelineComponent: Return custom React element
    TimelineComponent->>Developer: Render custom content

Poem

🐰 A Timeline's Tale of Render and Flair
Hop, skip, and jump through events with care
Avatars dancing, stories unfold
Render props weaving narratives bold
A rabbit's delight, components so bright! 🎨

β€” CodeRabbit's Poetic Insight 🌟


πŸ“œ Recent review details

Configuration used: CodeRabbit UI Review profile: CHILL Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between de75a474e85a4dcff321c145592da54b47fcca0f and 2c54812ed8b424733b82894739c7e345595cce3c.

πŸ“’ Files selected for processing (1)
  • packages/ui/src/components/Timeline/TimelinePoint.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/ui/src/components/Timeline/TimelinePoint.tsx

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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • 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/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Dec 26 '24 09:12 coderabbitai[bot]