oddsgate-ds 1.0.221 → 1.0.222
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/molecules/CategoryIndex/CategoryIndex.interface.d.ts +4 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/molecules/CategoryIndex/CategoryIndex.interface.d.ts +4 -1
- package/dist/types.d.ts +4 -1
- package/package.json +1 -1
- package/src/components/molecules/CategoryIndex/CategoryIndex.component.tsx +5 -17
- package/src/components/molecules/CategoryIndex/CategoryIndex.interface.ts +1 -1
- package/src/components/organisms/Glossary/Glossary.component.tsx +8 -4
package/dist/types.d.ts
CHANGED
|
@@ -453,7 +453,10 @@ interface CategoriesWrapperProps {
|
|
|
453
453
|
declare const CategoriesWrapper: React__default.FC<CategoriesWrapperProps>;
|
|
454
454
|
|
|
455
455
|
interface CategoryIndexProps {
|
|
456
|
-
categories:
|
|
456
|
+
categories: {
|
|
457
|
+
name: string;
|
|
458
|
+
slug: string;
|
|
459
|
+
}[];
|
|
457
460
|
onChange: (category: string | null) => void;
|
|
458
461
|
selectedCategory: string | null;
|
|
459
462
|
}
|
package/package.json
CHANGED
|
@@ -5,33 +5,21 @@ import {
|
|
|
5
5
|
} from './CategoryIndex.theme'
|
|
6
6
|
import { CategoryIndexProps } from './CategoryIndex.interface'
|
|
7
7
|
|
|
8
|
+
// Expect categories as array of { name, slug }
|
|
8
9
|
const CategoryIndex: React.FC<CategoryIndexProps> = ({
|
|
9
10
|
categories,
|
|
10
11
|
onChange,
|
|
11
12
|
selectedCategory
|
|
12
13
|
}) => {
|
|
13
|
-
// Find the numeric/symbol category - could be "0-9", "123", "#", etc.
|
|
14
|
-
const numericCategory = categories.find(
|
|
15
|
-
cat => /^[0-9#]/.test(cat) || cat === '0-9' || cat === '123'
|
|
16
|
-
)
|
|
17
|
-
|
|
18
14
|
return (
|
|
19
15
|
<StyledGlossaryCategoryIndex>
|
|
20
16
|
{categories.map(category => (
|
|
21
17
|
<StyledGlossaryCategoryIndexItem
|
|
22
|
-
onClick={() =>
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
)
|
|
26
|
-
}
|
|
27
|
-
isSelected={
|
|
28
|
-
category === '#'
|
|
29
|
-
? !!numericCategory && selectedCategory === numericCategory
|
|
30
|
-
: selectedCategory === category
|
|
31
|
-
}
|
|
32
|
-
key={`category-${category}`}
|
|
18
|
+
onClick={() => onChange(category.slug)}
|
|
19
|
+
isSelected={selectedCategory === category.slug}
|
|
20
|
+
key={`category-${category.slug}`}
|
|
33
21
|
>
|
|
34
|
-
{category}
|
|
22
|
+
{category.name}
|
|
35
23
|
</StyledGlossaryCategoryIndexItem>
|
|
36
24
|
))}
|
|
37
25
|
</StyledGlossaryCategoryIndex>
|
|
@@ -25,9 +25,8 @@ export const Glossary: React.FC<GlossaryProps> = ({
|
|
|
25
25
|
noResultsText,
|
|
26
26
|
tryAnotherLetterText
|
|
27
27
|
}) => {
|
|
28
|
-
|
|
29
28
|
const categoryNames = Object.keys(categoryData)
|
|
30
|
-
|
|
29
|
+
console.log('categoryNames:', categoryNames)
|
|
31
30
|
const noResults = categoryNames.every(
|
|
32
31
|
category => !categoryData[category] || categoryData[category].length === 0
|
|
33
32
|
)
|
|
@@ -41,7 +40,10 @@ export const Glossary: React.FC<GlossaryProps> = ({
|
|
|
41
40
|
/>
|
|
42
41
|
|
|
43
42
|
<GlossaryCategoryIndex
|
|
44
|
-
categories={categoryNames
|
|
43
|
+
categories={categoryNames.map(name => {
|
|
44
|
+
const found = categoryData[name]
|
|
45
|
+
return found ? { name, slug: name } : { name, slug: name }
|
|
46
|
+
})}
|
|
45
47
|
selectedCategory={selectedCategory}
|
|
46
48
|
onChange={cat =>
|
|
47
49
|
setSelectedCategory(cat === selectedCategory ? null : cat)
|
|
@@ -50,7 +52,9 @@ export const Glossary: React.FC<GlossaryProps> = ({
|
|
|
50
52
|
{noResults ? (
|
|
51
53
|
<StyledNoResultsContainer>
|
|
52
54
|
<StyledNoResultsTitle>{noResultsText}</StyledNoResultsTitle>
|
|
53
|
-
<StyledNoResultsSubtitle>
|
|
55
|
+
<StyledNoResultsSubtitle>
|
|
56
|
+
{tryAnotherLetterText}
|
|
57
|
+
</StyledNoResultsSubtitle>
|
|
54
58
|
</StyledNoResultsContainer>
|
|
55
59
|
) : (
|
|
56
60
|
<>
|