Skip to content

Commit

Permalink
fix: allow children search case (#1299)
Browse files Browse the repository at this point in the history
  • Loading branch information
pyphilia authored Jul 1, 2024
1 parent c4131a3 commit 1d7de28
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/components/item/ItemContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ const FolderContent = ({

// TODO: use hook's filter when available
const folderChildren = children?.filter(
(f) => shouldDisplayItem(f.type) && f.name.includes(itemSearch.text),
(f) =>
shouldDisplayItem(f.type) &&
f.name.toLowerCase().includes(itemSearch.text.toLowerCase()),
);

if (isLoading) {
Expand Down
4 changes: 1 addition & 3 deletions src/components/item/ItemSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { ChangeEvent, useState } from 'react';

import { Typography } from '@mui/material';

import { DiscriminatedItem } from '@graasp/sdk';
import { SearchInput } from '@graasp/ui';

import { useBuilderTranslation } from '../../config/i18n';
Expand Down Expand Up @@ -32,7 +31,6 @@ export const useItemSearch = ({
}: {
onSearch?: () => void;
} = {}): {
results?: DiscriminatedItem[];
text: string;
input: JSX.Element;
} => {
Expand All @@ -41,7 +39,7 @@ export const useItemSearch = ({

const handleSearchInput = (event: ChangeEvent<{ value: string }>) => {
const text = event.target.value;
setSearchText(text.toLowerCase());
setSearchText(text);
onSearch?.();
};

Expand Down

0 comments on commit 1d7de28

Please sign in to comment.