Skip to content

Commit

Permalink
Draft
Browse files Browse the repository at this point in the history
  • Loading branch information
botisSmile committed Oct 5, 2023
1 parent 2276d25 commit 90252d9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
11 changes: 4 additions & 7 deletions front/example-app/src/components/SearchBar/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,9 @@ function getCategoryPathLabel(path: string[], categories: ICategory[], separator
const category = categories.find((category: ICategory) => category.id === path[0])
path.shift()
console.log('newPath', path)
// label = category?.name +
// (category?.children.length > 0 ? '/' : '') +
// getCategoryPathLabel(path, category?.children ?? [], separator)
label = `${category?.name}/${getCategoryPathLabel(path, category.children, separator)}`
label = category?.name +
(category?.children?.length > 0 ? '/' : '') +
getCategoryPathLabel(path, category?.children ?? [], separator)
}

return label.split('/').join(' / ');
Expand Down Expand Up @@ -102,9 +101,7 @@ function SearchBar(props: IProps): JSX.Element {
}
}) ?? []

options.concat(products.data?.categories.collection ?? [])

options = products.data?.categories.collection ?? [];
options = options.concat(products.data?.categories.collection ?? [])


console.log('options', options)
Expand Down
6 changes: 6 additions & 0 deletions front/example-app/src/types/category.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import {ICategory} from "@elastic-suite/gally-admin-shared";


export interface ICategoryAutoComplete extends ICategory {
type: 'category'
}
4 changes: 4 additions & 0 deletions front/example-app/src/types/product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ export interface IProduct extends Omit<IGraphqlProduct, 'price'> {
price?: number
image?: string
}

export interface IProductAutoComplete extends IProduct {
type: 'product'
}

0 comments on commit 90252d9

Please sign in to comment.