Skip to content

Commit 06e3e74

Browse files
authored
Search and UX Improvements (#528)
## Updates & Enhancements We've been busy improving the timeline component! Here are some of the highlights from recent development efforts: * **Search Functionality Added:** You can now easily find specific content within the timeline items using the new search bar in the toolbar. Navigate between results with dedicated "previous" and "next" buttons. * **Improved Styling & Appearance:** The timeline has a more polished and consistent look. We've refined the styling of cards, navigation elements, and list items for better readability and visual appeal. * **Enhanced Accessibility:** We've made significant strides in making the timeline more accessible. This includes better screen reader support, improved keyboard navigation, clearer focus indicators, and enhanced ARIA attributes. * **Better Media Handling:** The component now includes improved support for displaying various media types (images, videos, and YouTube videos) within timeline cards, with dedicated components for a smoother experience. * **Added Animations:** Subtle ripple and pulse animations have been added to timeline points to provide visual feedback and enhance interactivity. * **Smoother Slideshow:** The slideshow functionality has been optimized using `requestAnimationFrame` for smoother transitions and better performance. * **Under-the-Hood Improvements:** We've extensively refactored the codebase for better organization, maintainability, performance, and type safety. This includes streamlining logic, optimizing event handling, and cleaning up code. * **Bug Fixes:** Addressed visual issues such as color contrast in dark mode and preventing content overflow in cards. These updates aim to provide a more functional, aesthetically pleasing, accessible, and performant timeline experience.
1 parent d01a716 commit 06e3e74

File tree

93 files changed

+3583
-1990
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+3583
-1990
lines changed

.stylelintrc

+4-11
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
{
2-
"processors": [
3-
"stylelint-processor-styled-components"
4-
],
5-
"plugins": [
6-
"stylelint-order"
7-
],
8-
"extends": [
9-
"stylelint-config-styled-components",
10-
"stylelint-config-recess-order"
11-
]
12-
}
2+
"customSyntax": "postcss-styled-syntax",
3+
"rules": {},
4+
"ignoreFiles": ["node_modules/**/*", "dist/**/*"]
5+
}

.vscode/settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
],
1212
"sonarlint.connectedMode.project": {
1313
"connectionId": "prabhuignoto",
14-
"projectKey": "prabhuignoto"
14+
"projectKey": "prabhuignoto_react-chrono"
1515
}
1616
}

README.md

+21
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
- [🎨Theme](#theme)
6666
- [Customize Font sizes](#customize-font-sizes)
6767
- [Customize alt text for buttons](#customize-alt-text-for-buttons)
68+
- [Search Functionality](#search-functionality)
6869
- [Using custom class names](#using-custom-class-names)
6970
- [📦CodeSandbox Examples](#codesandbox-examples)
7071
- [Kitchen Sink](#kitchen-sink)
@@ -201,6 +202,9 @@ Below are the available configuration options for the component:
201202
| uniqueId | | Used with `noUniqueId` to set a custom unique id for the wrapper. |
202203
| useReadMore | true | Enables or disables the "read more" button. Available if text content on the card is taller than the card itself. |
203204
| disableToolbar | false | Hides the toolbar / control panel |
205+
| searchPlaceholder | "Search..." | Customizes the placeholder text for the search input. |
206+
| searchAriaLabel | "Search timeline" | Sets the aria-label for the search input for accessibility. |
207+
| clearSearch | "Clear search" | Customizes the text for the clear search button. |
204208

205209
### Mode
206210

@@ -573,6 +577,23 @@ Defaults
573577
| `play` | 'Play Slideshow' |
574578
| `previous` | 'Previous' |
575579

580+
### Search Functionality
581+
582+
React-Chrono includes a powerful search feature that allows users to quickly find specific content within your timeline. The search functionality is included in the toolbar by default and can be customized with several props.
583+
584+
The search feature scans through all text content in your timeline items, including titles, card titles, subtitles, and detailed text. When matches are found, users can navigate through the results, and the timeline will automatically focus on the matching items.
585+
586+
```jsx
587+
<Chrono
588+
items={data}
589+
searchPlaceholder="Find in timeline..."
590+
searchAriaLabel="Search through timeline events"
591+
clearSearch="Reset search"
592+
/>
593+
```
594+
595+
You can hide the search functionality (along with the rest of the toolbar) by setting the `disableToolbar` prop to `true`.
596+
576597
## Using custom class names
577598

578599
You can use the classNames prop to apply your own class names. The following example shows how to use custom class names on different elements.

cypress/e2e/react-chrono/horizontal_spec.js

-9
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,4 @@ context('Chrono.Horizontal.Basic', () => {
1212
it('check timeline controls', () => {
1313
cy.get('.timeline-controls').children().should('have.length', 6);
1414
});
15-
16-
// it('check read more', () => {
17-
// cy.get('.timeline-card-content').within(() => {
18-
// cy.get('.card-description').should('have.class', 'show-less');
19-
// cy.get('.show-more').click();
20-
// cy.wait(400);
21-
// cy.get('.card-description').should('not.have.class', 'show-less');
22-
// });
23-
// });
2415
});

cypress/e2e/react-chrono/vertical_alternating_nomedia.js

-13
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,6 @@ context('Chrono.Vertical.Alternating', () => {
6262
.should('have.class', 'active');
6363
});
6464

65-
it('check read more action', () => {
66-
cy.get('.vertical-item-row')
67-
.eq(1)
68-
.find('.card-description')
69-
.should('have.class', 'show-less');
70-
cy.get('.vertical-item-row').eq(1).find('.show-more').click();
71-
cy.wait(500);
72-
cy.get('.vertical-item-row')
73-
.eq(1)
74-
.find('.card-description')
75-
.should('not.have.class', 'show-less');
76-
});
77-
7865
it('check scroll', () => {
7966
cy.get('.timeline-main-wrapper').scrollTo('bottom');
8067
cy.wait(1000);

cypress/e2e/react-chrono/vertical_alternating_spec.js

-21
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,6 @@ context('Chrono.Vertical.Alternating.Mixed', () => {
6262
.should('have.class', 'active');
6363
});
6464

65-
it('check read more action', () => {
66-
cy.get('.vertical-item-row')
67-
.eq(2)
68-
.find('.card-description')
69-
.should('have.class', 'show-less');
70-
// cy.scrollTo(700);
71-
cy.get('.vertical-item-row').eq(2).find('.show-more').click();
72-
cy.wait(500);
73-
cy.get('.vertical-item-row')
74-
.eq(2)
75-
.find('.card-description')
76-
.should('not.have.class', 'show-less');
77-
});
78-
7965
it('check video', () => {
8066
cy.get('.vertical-item-row')
8167
.eq(2)
@@ -87,13 +73,6 @@ context('Chrono.Vertical.Alternating.Mixed', () => {
8773
);
8874
});
8975

90-
// it('check video', () => {
91-
// cy.get('.vertical-item-row')
92-
// .eq(8)
93-
// .find('video')
94-
// .should('have.css', 'visibility', 'hidden');
95-
// });
96-
9776
it('check scroll', () => {
9877
cy.get('.timeline-main-wrapper').scrollTo('bottom');
9978
cy.wait(1000);

cypress/e2e/react-chrono/vertical_spec.js

-13
Original file line numberDiff line numberDiff line change
@@ -70,19 +70,6 @@ context('Chrono.Vertical.Basic', () => {
7070
.should('have.class', 'active');
7171
});
7272

73-
// it('check read more action', () => {
74-
// cy.get('.vertical-item-row')
75-
// .eq(1)
76-
// .find('.card-description')
77-
// .should('have.class', 'show-less');
78-
// cy.get('.vertical-item-row').eq(1).find('.show-more').click();
79-
// cy.wait(500);
80-
// cy.get('.vertical-item-row')
81-
// .eq(1)
82-
// .find('.card-description')
83-
// .should('not.have.class', 'show-less');
84-
// });
85-
8673
it('check scroll', () => {
8774
cy.get('.timeline-main-wrapper').scrollTo('bottom');
8875
cy.wait(1000);

cypress/tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"compilerOptions": {
44
"types": [
55
"cypress"
6-
]
6+
],
7+
"rootDir": ".."
78
},
89
"include": [
910
"../node_modules/cypress",

package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
"cssnano": "^7.0.6",
104104
"cypress": "14.2.1",
105105
"eslint": "^9.23.0",
106+
"eslint-config-prettier": "^10.1.2",
106107
"eslint-plugin-import": "^2.31.0",
107108
"eslint-plugin-jsx-a11y": "^6.10.2",
108109
"eslint-plugin-react": "^7.37.4",
@@ -115,6 +116,8 @@
115116
"lint-staged": "^15.5.0",
116117
"postcss": "^8.5.3",
117118
"postcss-preset-env": "^10.1.5",
119+
"postcss-scss": "^4.0.9",
120+
"postcss-styled-syntax": "^0.7.1",
118121
"postcss-syntax": "^0.36.2",
119122
"prettier": "^3.5.3",
120123
"pretty-quick": "^4.1.1",
@@ -136,8 +139,8 @@
136139
"snyk": "^1.1296.1",
137140
"start-server-and-test": "^2.0.11",
138141
"stylelint": "^16.17.0",
142+
"stylelint-config-recess-order": "^6.0.0",
139143
"stylelint-config-recommended": "^15.0.0",
140-
"stylelint-config-styled-components": "^0.1.1",
141144
"stylelint-order": "^6.0.4",
142145
"typescript": "^5.8.2",
143146
"typescript-plugin-styled-components": "^3.0.0",

pnpm-lock.yaml

+57-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)