oddsgate-ds 1.0.222 → 1.0.224

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.
@@ -4,5 +4,5 @@ export interface CategoryIndexProps {
4
4
  slug: string;
5
5
  }[];
6
6
  onChange: (category: string | null) => void;
7
- selectedCategory: string | null;
7
+ selectedCategory: string | null | undefined;
8
8
  }
package/dist/types.d.ts CHANGED
@@ -458,7 +458,7 @@ interface CategoryIndexProps {
458
458
  slug: string;
459
459
  }[];
460
460
  onChange: (category: string | null) => void;
461
- selectedCategory: string | null;
461
+ selectedCategory: string | null | undefined;
462
462
  }
463
463
 
464
464
  declare const CategoryIndex: React__default.FC<CategoryIndexProps>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oddsgate-ds",
3
- "version": "1.0.222",
3
+ "version": "1.0.224",
4
4
  "description": "Miew theme component library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -5,18 +5,23 @@ import {
5
5
  } from './CategoryIndex.theme'
6
6
  import { CategoryIndexProps } from './CategoryIndex.interface'
7
7
 
8
- // Expect categories as array of { name, slug }
9
8
  const CategoryIndex: React.FC<CategoryIndexProps> = ({
10
9
  categories,
11
10
  onChange,
12
11
  selectedCategory
13
12
  }) => {
13
+
14
+ const isNumber = selectedCategory && !isNaN(Number(selectedCategory))
15
+ const selected = isNumber
16
+ ? categories.find(cat => cat.name === '#')?.slug
17
+ : selectedCategory
18
+
14
19
  return (
15
20
  <StyledGlossaryCategoryIndex>
16
21
  {categories.map(category => (
17
22
  <StyledGlossaryCategoryIndexItem
18
23
  onClick={() => onChange(category.slug)}
19
- isSelected={selectedCategory === category.slug}
24
+ isSelected={selected === category.slug}
20
25
  key={`category-${category.slug}`}
21
26
  >
22
27
  {category.name}
@@ -1,5 +1,5 @@
1
1
  export interface CategoryIndexProps {
2
2
  categories: { name: string; slug: string }[]
3
3
  onChange: (category: string | null) => void
4
- selectedCategory: string | null
4
+ selectedCategory: string | null | undefined
5
5
  }
@@ -26,7 +26,6 @@ export const Glossary: React.FC<GlossaryProps> = ({
26
26
  tryAnotherLetterText
27
27
  }) => {
28
28
  const categoryNames = Object.keys(categoryData)
29
- console.log('categoryNames:', categoryNames)
30
29
  const noResults = categoryNames.every(
31
30
  category => !categoryData[category] || categoryData[category].length === 0
32
31
  )
@@ -5,6 +5,7 @@ import Glossary from './Glossary.component'
5
5
  const categories = [
6
6
  {
7
7
  name: '#',
8
+ slug: "86",
8
9
  items: [
9
10
  { name: '123', slug: '123' },
10
11
  { name: '321', slug: '321' }
@@ -12,6 +13,7 @@ const categories = [
12
13
  },
13
14
  {
14
15
  name: 'A',
16
+ slug: "a",
15
17
  items: [
16
18
  { name: 'Apple', slug: 'apple' },
17
19
  { name: 'Apricot', slug: 'apricot' }
@@ -19,6 +21,7 @@ const categories = [
19
21
  },
20
22
  {
21
23
  name: 'B',
24
+ slug: "b",
22
25
  items: [
23
26
  { name: 'Banana', slug: 'banana' },
24
27
  { name: 'Blueberry', slug: 'blueberry' }