Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions src/cra-project/components/ProjectList/CardsContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,24 @@ export default class CardsContainer extends React.Component {

// Search input handler
handleChange(event) {
this.inputValue = event.currentTarget.value;

this.inputValue = this.inputValue.trim();
this.inputValue = this.inputValue.toLowerCase();

this.handleFilterListUpdate(this.value);
this.inputValue = event.target.value.trim().toLowerCase();
this.handleFilterListUpdate(this.state.value);
}

//debounce functionality in searh
// handleChange(event) {
// const newInput = event.target.value.trim().toLowerCase();
// this.inputValue = newInput;

// // 🔁 Clear the previous debounce timer if still waiting
// if (this.debounceTimeout) clearTimeout(this.debounceTimeout);

// // ⏳ Set a new debounce timer (300ms)
// this.debounceTimeout = setTimeout(() => {
// this.handleFilterListUpdate(this.state.value); // 🔍 Run filtering logic
// }, 300); // ⏱️ Delay (in milliseconds)
// }

sortArrayRandom(array) {
if (Array.isArray(array)) {
return array.sort(() => 0.5 - Math.random());
Expand Down