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.
- 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 +1 -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 +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/molecules/CategoryIndex/CategoryIndex.component.tsx +7 -2
- package/src/components/molecules/CategoryIndex/CategoryIndex.interface.ts +1 -1
- package/src/components/organisms/Glossary/Glossary.component.tsx +0 -1
- package/src/components/organisms/Glossary/Glossary.stories.tsx +3 -0
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
|
@@ -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={
|
|
24
|
+
isSelected={selected === category.slug}
|
|
20
25
|
key={`category-${category.slug}`}
|
|
21
26
|
>
|
|
22
27
|
{category.name}
|
|
@@ -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' }
|