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(Timeline): add isItemActive prop #3198

Merged
merged 1 commit into from
May 19, 2023
Merged

Conversation

SevenOutman
Copy link
Member

@SevenOutman SevenOutman commented May 17, 2023

New isItemActive prop of Timeline component

Specify which Timeline.Item should be marked active (with the blue dot).

Example

<Timeline isItemActive={index => index === 1}>
  <Timeline.Item>First item</Timeline.Item>
  <Timeline.Item>Second item</Timeline.Item>
  <Timeline.Item>Third item</Timeline.Item>
</Timeline>
image

Signature

The isItemActive function takes two arguments and returns a boolean value

type TimelineProps = {
  /**
   * @param index           The index of the item
   * @param totalItemsCount The total count of all items
   * 
   * @returns Whether this item should be marked as active
   */
  isItemActive?: (index: number, totalItemsCount: number) => boolean;
}

Presets

Two preset values are provided for convenience.

  • Timeline.ACTIVE_FIRST Mark the first item as active
  • Timeline.ACTIVE_LAST Mark the last item as active (the default behavior)

Usage

<Timeline isItemActive={Timeline.ACTIVE_FIRST}>
  <Timeline.Item>First item</Timeline.Item>
  <Timeline.Item>Second item</Timeline.Item>
  <Timeline.Item>Third item</Timeline.Item>
</Timeline>
image

Close #3160

@vercel
Copy link

vercel bot commented May 17, 2023

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

Name Status Preview Comments Updated (UTC)
rsuite-nextjs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 17, 2023 5:43am
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
rsuite-v4 ⬜️ Ignored (Inspect) May 17, 2023 5:43am

@codesandbox-ci
Copy link

codesandbox-ci bot commented May 17, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit ab3cde1:

Sandbox Source
rsuite-tp-ci Configuration

@codecov
Copy link

codecov bot commented May 17, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (20fbdee) 93.38% compared to head (ab3cde1) 93.39%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3198   +/-   ##
=======================================
  Coverage   93.38%   93.39%           
=======================================
  Files         564      564           
  Lines       20287    20308   +21     
  Branches     2754     2755    +1     
=======================================
+ Hits        18945    18966   +21     
  Misses        695      695           
  Partials      647      647           
Flag Coverage Δ
ChromeCi 93.35% <100.00%> (+<0.01%) ⬆️
Firefox 92.64% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/List/test/ListSpec.tsx 100.00% <ø> (ø)
src/Timeline/Timeline.tsx 100.00% <100.00%> (ø)
src/Timeline/TimelineItem.tsx 100.00% <100.00%> (ø)
src/Timeline/test/TimelineItemSpec.tsx 100.00% <100.00%> (ø)
src/Timeline/test/TimelineSpec.tsx 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@SevenOutman SevenOutman marked this pull request as ready for review May 17, 2023 06:13
@SevenOutman SevenOutman requested a review from simonguo May 17, 2023 06:14
Copy link
Member

@simonguo simonguo left a comment

Choose a reason for hiding this comment

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

👍🏻 ,don't forget to update the API docs after release.

@SevenOutman
Copy link
Member Author

👍🏻 ,don't forget to update the API docs after release.

Sure. I've opened #3203 to keep track of it.

@SevenOutman SevenOutman merged commit 377930f into main May 19, 2023
16 of 19 checks passed
@SevenOutman SevenOutman deleted the feature/Timeline-reverse branch May 19, 2023 02:40
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.

Timeline component: add a new boolean prop: reverse
2 participants