oddsgate-ds 1.0.203 → 1.0.205
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/cjs/types/components/organisms/Glossary/Glossary.themes.d.ts +3 -0
- 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/esm/types/components/organisms/Glossary/Glossary.themes.d.ts +3 -0
- package/dist/types.d.ts +6 -19
- package/package.json +1 -1
- package/src/components/organisms/Glossary/Glossary.component.tsx +34 -34
- package/src/components/organisms/Glossary/Glossary.stories.tsx +137 -263
- package/src/components/organisms/Glossary/Glossary.themes.ts +25 -1
|
@@ -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;
|
|
@@ -2,3 +2,6 @@
|
|
|
2
2
|
export declare const StyledGlossary: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
3
|
export declare const StyledGlossaryTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>> & string;
|
|
4
4
|
export declare const StyledGlossaryCategories: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
5
|
+
export declare const StyledNoResultsContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
6
|
+
export declare const StyledNoResultsTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>> & string;
|
|
7
|
+
export declare const StyledNoResultsSubtitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>> & string;
|
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
|
|
2
|
-
import { StyledGlossary, StyledGlossaryCategories } from './Glossary.themes'
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { StyledGlossary, StyledGlossaryCategories, StyledNoResultsContainer, StyledNoResultsSubtitle, StyledNoResultsTitle } 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
|
|
@@ -47,16 +41,22 @@ export const Glossary: React.FC<GlossaryProps> = ({
|
|
|
47
41
|
setSelectedCategory(cat === selectedCategory ? null : cat)
|
|
48
42
|
}
|
|
49
43
|
/>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
<
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
44
|
+
{displayedCategories.length === 0 ? (
|
|
45
|
+
<StyledNoResultsContainer>
|
|
46
|
+
<StyledNoResultsTitle>No results found!</StyledNoResultsTitle>
|
|
47
|
+
<StyledNoResultsSubtitle>Try another term</StyledNoResultsSubtitle>
|
|
48
|
+
</StyledNoResultsContainer>
|
|
49
|
+
) : (
|
|
50
|
+
<StyledGlossaryCategories>
|
|
51
|
+
{displayedCategories.map(category => (
|
|
52
|
+
<CategoriesWrapper
|
|
53
|
+
key={category}
|
|
54
|
+
category={category}
|
|
55
|
+
categoryItems={categoryData[category]}
|
|
56
|
+
/>
|
|
57
|
+
))}
|
|
58
|
+
</StyledGlossaryCategories>
|
|
59
|
+
)}
|
|
60
60
|
</StyledGlossary>
|
|
61
61
|
)
|
|
62
62
|
}
|
|
@@ -1,278 +1,152 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
2
|
import Glossary from './Glossary.component'
|
|
3
|
+
interface GlossaryItem {
|
|
4
|
+
slug: string
|
|
5
|
+
name: string
|
|
6
|
+
}
|
|
3
7
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
8
|
+
interface GlossaryCategory {
|
|
9
|
+
name: string
|
|
10
|
+
items: GlossaryItem[]
|
|
7
11
|
}
|
|
8
12
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
subtitle="Explore commonly used terms in the gaming world."
|
|
13
|
-
categories={[
|
|
14
|
-
{
|
|
15
|
-
name: 'glossary-category',
|
|
13
|
+
const categories: GlossaryCategory[] = [
|
|
14
|
+
{
|
|
15
|
+
name: 'A',
|
|
16
16
|
items: [
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
{ slug: 'e', name: 'E' },
|
|
23
|
-
{ slug: 'f', name: 'F' },
|
|
24
|
-
{ slug: 'g', name: 'G' },
|
|
25
|
-
{ slug: 'h', name: 'H' },
|
|
26
|
-
{ slug: 'i', name: 'I' },
|
|
27
|
-
{ slug: 'j', name: 'J' },
|
|
28
|
-
{ slug: 'k', name: 'K' },
|
|
29
|
-
{ slug: 'l', name: 'L' },
|
|
30
|
-
{ slug: 'n', name: 'N' },
|
|
31
|
-
{ slug: 'o', name: 'O' },
|
|
32
|
-
{ slug: 'q', name: 'Q' },
|
|
33
|
-
{ slug: 'r', name: 'R' },
|
|
34
|
-
{ slug: 't', name: 'T' },
|
|
35
|
-
{ slug: 'u', name: 'U' },
|
|
36
|
-
{ slug: 'v', name: 'V' },
|
|
37
|
-
{ slug: 'w', name: 'W' },
|
|
38
|
-
{ slug: 'x', name: 'X' },
|
|
39
|
-
{ slug: 'y', name: 'Y' },
|
|
40
|
-
{ slug: 'z', name: 'Z' }
|
|
17
|
+
{ slug: 'afk', name: 'AFK' },
|
|
18
|
+
{ slug: 'aimbot', name: 'AIMBOT' },
|
|
19
|
+
{ slug: 'aggro', name: 'Aggro' },
|
|
20
|
+
{ slug: 'aoe', name: 'AOE' },
|
|
21
|
+
{ slug: 'avatar', name: 'Avatar' }
|
|
41
22
|
]
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
name: '
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'B',
|
|
45
26
|
items: [
|
|
46
|
-
|
|
47
|
-
|
|
27
|
+
{ slug: 'buff', name: 'Buff' },
|
|
28
|
+
{ slug: 'boss', name: 'Boss' },
|
|
29
|
+
{ slug: 'build', name: 'Build' }
|
|
48
30
|
]
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
categories: [{ name: 'advanced-category', items: [{ slug: 'p', name: 'P' }] }]
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
title: 'Quest',
|
|
134
|
-
categories: [{ name: 'glossary-category', items: [{ slug: 'q', name: 'Q' }] }]
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
title: 'Respawn',
|
|
138
|
-
categories: [{ name: 'glossary-category', items: [{ slug: 'r', name: 'R' }] }]
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
title: 'Support',
|
|
142
|
-
categories: [{ name: 'advanced-category', items: [{ slug: 's', name: 'S' }] }]
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
title: 'Tank',
|
|
146
|
-
categories: [{ name: 'glossary-category', items: [{ slug: 't', name: 'T' }] }]
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
title: 'Ultimate',
|
|
150
|
-
categories: [{ name: 'glossary-category', items: [{ slug: 'u', name: 'U' }] }]
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
title: 'Vision',
|
|
154
|
-
categories: [{ name: 'glossary-category', items: [{ slug: 'v', name: 'V' }] }]
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
title: 'Wave',
|
|
158
|
-
categories: [{ name: 'glossary-category', items: [{ slug: 'w', name: 'W' }] }]
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
title: 'XP',
|
|
162
|
-
categories: [{ name: 'glossary-category', items: [{ slug: 'x', name: 'X' }] }]
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
title: 'Yolo',
|
|
166
|
-
categories: [{ name: 'glossary-category', items: [{ slug: 'y', name: 'Y' }] }]
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
title: 'Zoning',
|
|
170
|
-
categories: [{ name: 'glossary-category', items: [{ slug: 'z', name: 'Z' }] }]
|
|
171
|
-
},
|
|
172
|
-
// Additional terms
|
|
173
|
-
{
|
|
174
|
-
title: 'ADC',
|
|
175
|
-
categories: [{ name: 'glossary-category', items: [{ slug: 'a', name: 'A' }] }]
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
title: 'AoE',
|
|
179
|
-
categories: [{ name: 'glossary-category', items: [{ slug: 'a', name: 'A' }] }]
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
title: 'Backdoor',
|
|
183
|
-
categories: [{ name: 'glossary-category', items: [{ slug: 'b', name: 'B' }] }]
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
title: 'CC',
|
|
187
|
-
categories: [{ name: 'glossary-category', items: [{ slug: 'c', name: 'C' }] }]
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
title: 'Cheese',
|
|
191
|
-
categories: [{ name: 'glossary-category', items: [{ slug: 'c', name: 'C' }] }]
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
title: 'Draft',
|
|
195
|
-
categories: [{ name: 'glossary-category', items: [{ slug: 'd', name: 'D' }] }]
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
title: 'Engage',
|
|
199
|
-
categories: [{ name: 'glossary-category', items: [{ slug: 'e', name: 'E' }] }]
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
title: 'Feed',
|
|
203
|
-
categories: [{ name: 'glossary-category', items: [{ slug: 'f', name: 'F' }] }]
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
title: 'First Blood',
|
|
207
|
-
categories: [{ name: 'glossary-category', items: [{ slug: 'f', name: 'F' }] }]
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
title: 'GG',
|
|
211
|
-
categories: [{ name: 'glossary-category', items: [{ slug: 'g', name: 'G' }] }]
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
title: 'Harass',
|
|
215
|
-
categories: [{ name: 'glossary-category', items: [{ slug: 'h', name: 'H' }] }]
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
title: 'Initiate',
|
|
219
|
-
categories: [{ name: 'glossary-category', items: [{ slug: 'i', name: 'I' }] }]
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
title: 'Kiting',
|
|
223
|
-
categories: [{ name: 'glossary-category', items: [{ slug: 'k', name: 'K' }] }]
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
title: 'Leash',
|
|
227
|
-
categories: [{ name: 'glossary-category', items: [{ slug: 'l', name: 'L' }] }]
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
title: 'Meta',
|
|
231
|
-
categories: [{ name: 'glossary-category', items: [{ slug: 'm', name: 'M' }] }]
|
|
232
|
-
},
|
|
233
|
-
{
|
|
234
|
-
title: 'Outplay',
|
|
235
|
-
categories: [{ name: 'glossary-category', items: [{ slug: 'o', name: 'O' }] }]
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
title: 'Peel',
|
|
239
|
-
categories: [{ name: 'advanced-category', items: [{ slug: 'p', name: 'P' }] }]
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
title: 'Roam',
|
|
243
|
-
categories: [{ name: 'glossary-category', items: [{ slug: 'r', name: 'R' }] }]
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
title: 'Snowball',
|
|
247
|
-
categories: [{ name: 'advanced-category', items: [{ slug: 's', name: 'S' }] }]
|
|
248
|
-
},
|
|
249
|
-
{
|
|
250
|
-
title: 'Split Push',
|
|
251
|
-
categories: [{ name: 'advanced-category', items: [{ slug: 's', name: 'S' }] }]
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
title: 'Tilt',
|
|
255
|
-
categories: [{ name: 'glossary-category', items: [{ slug: 't', name: 'T' }] }]
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
title: 'Trade',
|
|
259
|
-
categories: [{ name: 'glossary-category', items: [{ slug: 't', name: 'T' }] }]
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
title: 'Wombo Combo',
|
|
263
|
-
categories: [{ name: 'glossary-category', items: [{ slug: 'w', name: 'W' }] }]
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
title: 'Zone',
|
|
267
|
-
categories: [{ name: 'glossary-category', items: [{ slug: 'z', name: 'Z' }] }]
|
|
268
|
-
}
|
|
269
|
-
]}
|
|
270
|
-
placeholder="What are you looking for?"
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
// Helper to build categoryData from categories and items
|
|
35
|
+
interface BuildCategoryDataItem {
|
|
36
|
+
slug: string
|
|
37
|
+
name: string
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface BuildCategoryDataCategory {
|
|
41
|
+
name: string
|
|
42
|
+
items: BuildCategoryDataItem[]
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
interface CategoryData {
|
|
46
|
+
[categoryName: string]: string[]
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function buildCategoryData(
|
|
50
|
+
categories: BuildCategoryDataCategory[],
|
|
51
|
+
items: BuildCategoryDataItem[]
|
|
52
|
+
): CategoryData {
|
|
53
|
+
const data: CategoryData = {}
|
|
54
|
+
categories.forEach((cat: BuildCategoryDataCategory) => {
|
|
55
|
+
data[cat.name] = cat.items.map((item: BuildCategoryDataItem) => item.name)
|
|
56
|
+
})
|
|
57
|
+
return data
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Helper to filter items by searchTerm and selectedCategory
|
|
61
|
+
function getDisplayedCategories(
|
|
62
|
+
categories: any[],
|
|
63
|
+
items: never[],
|
|
64
|
+
searchTerm: string,
|
|
65
|
+
selectedCategory: string | null
|
|
66
|
+
) {
|
|
67
|
+
const filtered: Record<string | number, any[]> = {}
|
|
68
|
+
categories.forEach((cat: { items: any[]; name: string | number }) => {
|
|
69
|
+
const catItems = cat.items
|
|
70
|
+
.map((item: { name: any }) => item.name)
|
|
71
|
+
.filter(
|
|
72
|
+
( name: string) =>
|
|
73
|
+
(!searchTerm ||
|
|
74
|
+
name.toLowerCase().includes(searchTerm.toLowerCase())) &&
|
|
75
|
+
(!selectedCategory || cat.name === selectedCategory)
|
|
76
|
+
)
|
|
77
|
+
if (catItems.length > 0) filtered[cat.name] = catItems
|
|
78
|
+
})
|
|
79
|
+
return Object.keys(filtered)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
// Build categoryData for the Glossary component
|
|
84
|
+
const categoryData = buildCategoryData(categories, [])
|
|
85
|
+
|
|
86
|
+
export default {
|
|
87
|
+
title: 'Organisms/Glossary',
|
|
88
|
+
component: Glossary
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export const Basic = () => {
|
|
92
|
+
const [searchTerm, setSearchTerm] = useState('')
|
|
93
|
+
const [selectedCategory, setSelectedCategory] = useState<string | null>(null)
|
|
94
|
+
|
|
95
|
+
// For demo, just show all categories if nothing is selected
|
|
96
|
+
const displayedCategories = getDisplayedCategories(
|
|
97
|
+
categories,
|
|
98
|
+
[],
|
|
99
|
+
searchTerm,
|
|
100
|
+
selectedCategory
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<Glossary
|
|
105
|
+
searchTerm={searchTerm}
|
|
106
|
+
setSearchTerm={setSearchTerm}
|
|
107
|
+
selectedCategory={selectedCategory}
|
|
108
|
+
setSelectedCategory={setSelectedCategory}
|
|
109
|
+
categoryData={categoryData}
|
|
110
|
+
displayedCategories={displayedCategories}
|
|
111
|
+
placeholder="What are you looking for?"
|
|
271
112
|
/>
|
|
272
|
-
)
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
|
|
273
116
|
Basic.parameters = {
|
|
274
117
|
backgrounds: {
|
|
275
118
|
default: 'glossary-bg',
|
|
276
119
|
values: [{ name: 'glossary-bg', value: '#33052F' }]
|
|
277
120
|
}
|
|
278
121
|
}
|
|
122
|
+
|
|
123
|
+
export const NoResults = () => {
|
|
124
|
+
const [searchTerm, setSearchTerm] = useState('zzzz') // unlikely to match anything
|
|
125
|
+
const [selectedCategory, setSelectedCategory] = useState<string | null>(null)
|
|
126
|
+
|
|
127
|
+
const displayedCategories = getDisplayedCategories(
|
|
128
|
+
categories,
|
|
129
|
+
[],
|
|
130
|
+
searchTerm,
|
|
131
|
+
selectedCategory
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
return (
|
|
135
|
+
<Glossary
|
|
136
|
+
searchTerm={searchTerm}
|
|
137
|
+
setSearchTerm={setSearchTerm}
|
|
138
|
+
selectedCategory={selectedCategory}
|
|
139
|
+
setSelectedCategory={setSelectedCategory}
|
|
140
|
+
categoryData={categoryData}
|
|
141
|
+
displayedCategories={displayedCategories}
|
|
142
|
+
placeholder="What are you looking for?"
|
|
143
|
+
/>
|
|
144
|
+
)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
NoResults.parameters = {
|
|
148
|
+
backgrounds: {
|
|
149
|
+
default: 'glossary-bg',
|
|
150
|
+
values: [{ name: 'glossary-bg', value: '#33052F' }]
|
|
151
|
+
}
|
|
152
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { colors } from '@/styles/variables'
|
|
1
|
+
import { colors, typography } from '@/styles/variables'
|
|
2
2
|
import styled from 'styled-components'
|
|
3
3
|
|
|
4
4
|
export const StyledGlossary = styled.div`
|
|
@@ -15,3 +15,27 @@ export const StyledGlossaryTitle = styled.h1`
|
|
|
15
15
|
export const StyledGlossaryCategories = styled.div`
|
|
16
16
|
width: 100%;
|
|
17
17
|
`
|
|
18
|
+
export const StyledNoResultsContainer = styled.div`
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
margin-top: 6rem;
|
|
24
|
+
`
|
|
25
|
+
export const StyledNoResultsTitle = styled.h1`
|
|
26
|
+
color: ${colors.primary50};
|
|
27
|
+
font-size: 7.5rem;
|
|
28
|
+
font-weight: 700;
|
|
29
|
+
text-align: center;
|
|
30
|
+
@media (max-width: 600px) {
|
|
31
|
+
font-size: 3rem;
|
|
32
|
+
}
|
|
33
|
+
`
|
|
34
|
+
export const StyledNoResultsSubtitle = styled.h4`
|
|
35
|
+
color: ${colors.gray20};
|
|
36
|
+
font-size: 2.25rem;
|
|
37
|
+
font-weight: 700;
|
|
38
|
+
@media (max-width: 600px) {
|
|
39
|
+
font-size: 1.5rem;
|
|
40
|
+
}
|
|
41
|
+
`
|