oddsgate-ds 1.0.203 → 1.0.204
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/organisms/Glossary/Glossary.component.d.ts +9 -1
- package/dist/esm/index.js +5 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/organisms/Glossary/Glossary.component.d.ts +9 -1
- package/dist/types.d.ts +6 -19
- package/package.json +1 -1
- package/src/components/organisms/Glossary/Glossary.component.tsx +17 -23
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
type GlossaryProps = {
|
|
3
|
+
searchTerm: string;
|
|
4
|
+
setSearchTerm: (term: string) => void;
|
|
5
|
+
selectedCategory: string | null;
|
|
6
|
+
setSelectedCategory: (cat: string | null) => void;
|
|
7
|
+
categoryData: Record<string, string[]>;
|
|
8
|
+
displayedCategories: string[];
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
};
|
|
3
11
|
export declare const Glossary: React.FC<GlossaryProps>;
|
|
4
12
|
export default Glossary;
|
package/dist/types.d.ts
CHANGED
|
@@ -720,28 +720,15 @@ type IProductsSlider = {
|
|
|
720
720
|
|
|
721
721
|
declare const ProductsSlider: ({ content, style, className, }: IProductsSlider) => React__default.JSX.Element;
|
|
722
722
|
|
|
723
|
-
type GlossaryItem = {
|
|
724
|
-
title: string;
|
|
725
|
-
categories: {
|
|
726
|
-
name: string;
|
|
727
|
-
items: {
|
|
728
|
-
slug: string;
|
|
729
|
-
name: string;
|
|
730
|
-
}[];
|
|
731
|
-
}[];
|
|
732
|
-
};
|
|
733
723
|
type GlossaryProps = {
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
}[];
|
|
741
|
-
}[];
|
|
724
|
+
searchTerm: string;
|
|
725
|
+
setSearchTerm: (term: string) => void;
|
|
726
|
+
selectedCategory: string | null;
|
|
727
|
+
setSelectedCategory: (cat: string | null) => void;
|
|
728
|
+
categoryData: Record<string, string[]>;
|
|
729
|
+
displayedCategories: string[];
|
|
742
730
|
placeholder?: string;
|
|
743
731
|
};
|
|
744
|
-
|
|
745
732
|
declare const Glossary: React__default.FC<GlossaryProps>;
|
|
746
733
|
|
|
747
734
|
declare const iconsList: string[];
|
package/package.json
CHANGED
|
@@ -1,37 +1,31 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react'
|
|
2
2
|
import { StyledGlossary, StyledGlossaryCategories } from './Glossary.themes'
|
|
3
3
|
|
|
4
4
|
import SearchBar from '@/components/molecules/SearchBar/SearchBar.component'
|
|
5
5
|
import GlossaryCategoryIndex from '@/components/molecules/CategoryIndex/CategoryIndex.component'
|
|
6
6
|
import CategoriesWrapper from '@/components/molecules/CategoriesWrapper/CategoriesWrapper.component'
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
type GlossaryProps = {
|
|
9
|
+
searchTerm: string
|
|
10
|
+
setSearchTerm: (term: string) => void
|
|
11
|
+
selectedCategory: string | null
|
|
12
|
+
setSelectedCategory: (cat: string | null) => void
|
|
13
|
+
categoryData: Record<string, string[]>
|
|
14
|
+
displayedCategories: string[]
|
|
15
|
+
placeholder?: string
|
|
16
|
+
}
|
|
8
17
|
|
|
9
18
|
export const Glossary: React.FC<GlossaryProps> = ({
|
|
10
|
-
|
|
11
|
-
|
|
19
|
+
searchTerm,
|
|
20
|
+
setSearchTerm,
|
|
21
|
+
selectedCategory,
|
|
22
|
+
setSelectedCategory,
|
|
23
|
+
categoryData,
|
|
24
|
+
displayedCategories,
|
|
12
25
|
placeholder
|
|
13
26
|
}) => {
|
|
14
|
-
const [searchTerm, setSearchTerm] = useState('')
|
|
15
|
-
const [selectedCategory, setSelectedCategory] = useState<string | null>(null)
|
|
16
|
-
|
|
17
|
-
const categoryData: Record<string, string[]> = {}
|
|
18
|
-
categories[0].items.forEach(cat => {
|
|
19
|
-
categoryData[cat.name] = []
|
|
20
|
-
})
|
|
21
|
-
items.forEach(item => {
|
|
22
|
-
item.categories[0].items.forEach(cat => {
|
|
23
|
-
if (categoryData[cat.name]) {
|
|
24
|
-
categoryData[cat.name].push(item.title)
|
|
25
|
-
}
|
|
26
|
-
})
|
|
27
|
-
})
|
|
28
|
-
|
|
29
27
|
const categoryNames = Object.keys(categoryData)
|
|
30
28
|
|
|
31
|
-
const displayedCategories = selectedCategory
|
|
32
|
-
? [selectedCategory]
|
|
33
|
-
: categoryNames
|
|
34
|
-
|
|
35
29
|
return (
|
|
36
30
|
<StyledGlossary>
|
|
37
31
|
<SearchBar
|