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.
@@ -1,5 +1,8 @@
1
1
  export interface CategoryIndexProps {
2
- categories: string[];
2
+ categories: {
3
+ name: string;
4
+ slug: string;
5
+ }[];
3
6
  onChange: (category: string | null) => void;
4
7
  selectedCategory: string | null;
5
8
  }
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: string[];
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oddsgate-ds",
3
- "version": "1.0.221",
3
+ "version": "1.0.222",
4
4
  "description": "Miew theme component library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -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
- onChange(
24
- category === '#' && numericCategory ? numericCategory : category
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>
@@ -1,5 +1,5 @@
1
1
  export interface CategoryIndexProps {
2
- categories: string[]
2
+ categories: { name: string; slug: string }[]
3
3
  onChange: (category: string | null) => void
4
4
  selectedCategory: string | null
5
5
  }
@@ -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>{tryAnotherLetterText}</StyledNoResultsSubtitle>
55
+ <StyledNoResultsSubtitle>
56
+ {tryAnotherLetterText}
57
+ </StyledNoResultsSubtitle>
54
58
  </StyledNoResultsContainer>
55
59
  ) : (
56
60
  <>