oddsgate-ds 1.0.198 → 1.0.200

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.
Files changed (49) hide show
  1. package/dist/cjs/index.js +5 -5
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/types/components/molecules/CategoriesWrapper/CategoriesWrapper.component.d.ts +4 -0
  4. package/dist/cjs/types/components/molecules/CategoriesWrapper/CategoriesWrapper.interface.d.ts +5 -0
  5. package/dist/cjs/types/components/molecules/CategoriesWrapper/CategoriesWrapper.theme.d.ts +6 -0
  6. package/dist/cjs/types/components/molecules/CategoryIndex/CategoryIndex.component.d.ts +4 -0
  7. package/dist/cjs/types/components/molecules/CategoryIndex/CategoryIndex.interface.d.ts +5 -0
  8. package/dist/cjs/types/components/molecules/CategoryIndex/CategoryIndex.theme.d.ts +7 -0
  9. package/dist/cjs/types/components/molecules/SearchBar/SearchBar.component.d.ts +4 -0
  10. package/dist/cjs/types/components/molecules/SearchBar/SearchBar.interface.d.ts +6 -0
  11. package/dist/cjs/types/components/molecules/SearchBar/SearchBar.theme.d.ts +4 -0
  12. package/dist/cjs/types/components/organisms/Glossary/Glossary.component.d.ts +4 -0
  13. package/dist/cjs/types/components/organisms/Glossary/Glossary.interface.d.ts +24 -0
  14. package/dist/cjs/types/components/organisms/Glossary/Glossary.themes.d.ts +9 -0
  15. package/dist/cjs/types/index.d.ts +1 -0
  16. package/dist/esm/index.js +5 -5
  17. package/dist/esm/index.js.map +1 -1
  18. package/dist/esm/types/components/molecules/CategoriesWrapper/CategoriesWrapper.component.d.ts +4 -0
  19. package/dist/esm/types/components/molecules/CategoriesWrapper/CategoriesWrapper.interface.d.ts +5 -0
  20. package/dist/esm/types/components/molecules/CategoriesWrapper/CategoriesWrapper.theme.d.ts +6 -0
  21. package/dist/esm/types/components/molecules/CategoryIndex/CategoryIndex.component.d.ts +4 -0
  22. package/dist/esm/types/components/molecules/CategoryIndex/CategoryIndex.interface.d.ts +5 -0
  23. package/dist/esm/types/components/molecules/CategoryIndex/CategoryIndex.theme.d.ts +7 -0
  24. package/dist/esm/types/components/molecules/SearchBar/SearchBar.component.d.ts +4 -0
  25. package/dist/esm/types/components/molecules/SearchBar/SearchBar.interface.d.ts +6 -0
  26. package/dist/esm/types/components/molecules/SearchBar/SearchBar.theme.d.ts +4 -0
  27. package/dist/esm/types/components/organisms/Glossary/Glossary.component.d.ts +4 -0
  28. package/dist/esm/types/components/organisms/Glossary/Glossary.interface.d.ts +24 -0
  29. package/dist/esm/types/components/organisms/Glossary/Glossary.themes.d.ts +9 -0
  30. package/dist/esm/types/index.d.ts +1 -0
  31. package/dist/types.d.ts +27 -1
  32. package/package.json +1 -1
  33. package/src/components/molecules/CategoriesWrapper/CategoriesWrapper.component.tsx +33 -0
  34. package/src/components/molecules/CategoriesWrapper/CategoriesWrapper.interface.ts +4 -0
  35. package/src/components/molecules/CategoriesWrapper/CategoriesWrapper.stories.tsx +27 -0
  36. package/src/components/molecules/CategoriesWrapper/CategoriesWrapper.theme.ts +39 -0
  37. package/src/components/molecules/CategoryIndex/CategoryIndex.component.tsx +33 -0
  38. package/src/components/molecules/CategoryIndex/CategoryIndex.interface.ts +5 -0
  39. package/src/components/molecules/CategoryIndex/CategoryIndex.stories.tsx +23 -0
  40. package/src/components/molecules/CategoryIndex/CategoryIndex.theme.ts +27 -0
  41. package/src/components/molecules/SearchBar/SearchBar.component.tsx +30 -0
  42. package/src/components/molecules/SearchBar/SearchBar.interface.ts +5 -0
  43. package/src/components/molecules/SearchBar/SearchBar.stories.tsx +18 -0
  44. package/src/components/molecules/SearchBar/SearchBar.theme.ts +47 -0
  45. package/src/components/organisms/Glossary/Glossary.component.tsx +74 -0
  46. package/src/components/organisms/Glossary/Glossary.interface.ts +12 -0
  47. package/src/components/organisms/Glossary/Glossary.stories.tsx +278 -0
  48. package/src/components/organisms/Glossary/Glossary.themes.ts +27 -0
  49. package/src/index.ts +1 -0
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { CategoriesWrapperProps } from './CategoriesWrapper.interface';
3
+ declare const CategoriesWrapper: React.FC<CategoriesWrapperProps>;
4
+ export default CategoriesWrapper;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export interface CategoriesWrapperProps {
3
+ category: string;
4
+ categoryItems: React.ReactNode[];
5
+ }
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ export declare const StyledCategoryWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
3
+ export declare const StyledCategorySeparator: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
4
+ export declare const StyledCategorySeparatorLine: 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 StyledCategoryContent: 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 StyledCategoryItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { CategoryIndexProps } from './CategoryIndex.interface';
3
+ declare const CategoryIndex: React.FC<CategoryIndexProps>;
4
+ export default CategoryIndex;
@@ -0,0 +1,5 @@
1
+ export interface CategoryIndexProps {
2
+ categories: string[];
3
+ onChange: (category: string | null) => void;
4
+ selectedCategory: string | null;
5
+ }
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ type ItemProps = {
3
+ isSelected?: boolean;
4
+ };
5
+ export declare const StyledGlossaryCategoryIndex: 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 StyledGlossaryCategoryIndexItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, ItemProps>> & string;
7
+ export {};
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { SearchBarProps } from './SearchBar.interface';
3
+ declare const SearchBar: React.FC<SearchBarProps>;
4
+ export default SearchBar;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ export interface SearchBarProps {
3
+ value: string;
4
+ onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
5
+ placeholder?: string;
6
+ }
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ export declare const StyledGlossarySearch: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
3
+ export declare const SearchInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, never>> & string;
4
+ export declare const SearchButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { GlossaryProps } from './Glossary.interface';
3
+ export declare const Glossary: React.FC<GlossaryProps>;
4
+ export default Glossary;
@@ -0,0 +1,24 @@
1
+ type GlossaryItem = {
2
+ title: string;
3
+ categories: {
4
+ name: string;
5
+ items: {
6
+ slug: string;
7
+ name: string;
8
+ }[];
9
+ }[];
10
+ };
11
+ export type GlossaryProps = {
12
+ title: string;
13
+ subtitle: string;
14
+ items: GlossaryItem[];
15
+ categories: {
16
+ name: string;
17
+ items: {
18
+ slug: string;
19
+ name: string;
20
+ }[];
21
+ }[];
22
+ placeholder?: string;
23
+ };
24
+ export {};
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
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
+ export declare const StyledGlossaryHeader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
4
+ 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;
5
+ export declare const StyledGlossarySubtitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>> & string;
6
+ export declare const StyledGlossaryIndex: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
7
+ 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;
8
+ export declare const StyledGlossarySeparator: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
9
+ export declare const StyledGlossaryCategoryItems: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, never>> & string;
@@ -49,6 +49,7 @@ export { default as Cover } from './components/organisms/Cover';
49
49
  export { default as Tabs } from './components/organisms/Tabs';
50
50
  export { default as CircularSlider } from './components/organisms/CircularSlider';
51
51
  export { default as ProductsSlider } from './components/organisms/ProductsSlider';
52
+ export { default as Glossary } from './components/organisms/Glossary/Glossary.component';
52
53
  export { iconsList } from './helpers/getIcons';
53
54
  export { default as GlobalStyles } from './styles/Global';
54
55
  export { default as clickOutSideToClose } from './helpers/clickOutsideToClose';
package/dist/types.d.ts CHANGED
@@ -720,6 +720,32 @@ 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
+ type GlossaryProps = {
734
+ title: string;
735
+ subtitle: string;
736
+ items: GlossaryItem[];
737
+ categories: {
738
+ name: string;
739
+ items: {
740
+ slug: string;
741
+ name: string;
742
+ }[];
743
+ }[];
744
+ placeholder?: string;
745
+ };
746
+
747
+ declare const Glossary: React__default.FC<GlossaryProps>;
748
+
723
749
  declare const iconsList: string[];
724
750
 
725
751
  declare const GlobalStyles: React$1.NamedExoticComponent<styled_components.ExecutionProps & object>;
@@ -732,4 +758,4 @@ declare function useMediaMatch(query?: string): boolean;
732
758
 
733
759
  declare const debounce: (callback: any, wait: number) => (...args: any) => void;
734
760
 
735
- export { Accordion, AccordionItem, AwardBadge, AwardCard, BlogCard, Button, CardMarquee, CareersCard, CheckRadioField, Chip, CircularSlider, CloseButton, Column, Counter, Cover, Dropdown, DropdownItem, EmptyState, EventsCard, Flex, FormField, GlobalStyles, Heading, Icon, IconBox, IconTitle, ImageWrapper, LegalLinks, LicenseCard, Loader, LogosCard, Marquee, Modal, NewsCard, OffCanvas, PortalComponent, ProductCard, ProductsSlider, Quote, RichText, Row, ScrollingNav, Separator, ShareModal, Slider, SocialLinks, Spacer, Tabs, TeamCard, Video, VideoEmbed, clickOutSideToClose, debounce, iconsList, isTouchDevice, useMediaMatch, variables };
761
+ export { Accordion, AccordionItem, AwardBadge, AwardCard, BlogCard, Button, CardMarquee, CareersCard, CheckRadioField, Chip, CircularSlider, CloseButton, Column, Counter, Cover, Dropdown, DropdownItem, EmptyState, EventsCard, Flex, FormField, GlobalStyles, Glossary, Heading, Icon, IconBox, IconTitle, ImageWrapper, LegalLinks, LicenseCard, Loader, LogosCard, Marquee, Modal, NewsCard, OffCanvas, PortalComponent, ProductCard, ProductsSlider, Quote, RichText, Row, ScrollingNav, Separator, ShareModal, Slider, SocialLinks, Spacer, Tabs, TeamCard, Video, VideoEmbed, clickOutSideToClose, debounce, iconsList, isTouchDevice, useMediaMatch, variables };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oddsgate-ds",
3
- "version": "1.0.198",
3
+ "version": "1.0.200",
4
4
  "description": "Miew theme component library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -0,0 +1,33 @@
1
+ import React from 'react'
2
+ import {
3
+ StyledCategoryContent,
4
+ StyledCategorySeparator,
5
+ StyledCategoryWrapper,
6
+ StyledCategoryItem,
7
+ StyledCategorySeparatorLine
8
+ } from './CategoriesWrapper.theme'
9
+ import { CategoriesWrapperProps } from './CategoriesWrapper.interface'
10
+ import Button from '@/components/atoms/Button'
11
+
12
+ const CategoriesWrapper: React.FC<CategoriesWrapperProps> = ({
13
+ category,
14
+ categoryItems
15
+ }) => {
16
+ return (
17
+ <StyledCategoryWrapper>
18
+ <StyledCategorySeparator>
19
+ {category}
20
+ <StyledCategorySeparatorLine />
21
+ </StyledCategorySeparator>
22
+ <StyledCategoryContent>
23
+ {categoryItems.map((item, index) => (
24
+ <StyledCategoryItem key={index}>
25
+ <Button variant="text">{item}</Button>
26
+ </StyledCategoryItem>
27
+ ))}
28
+ </StyledCategoryContent>
29
+ </StyledCategoryWrapper>
30
+ )
31
+ }
32
+
33
+ export default CategoriesWrapper;
@@ -0,0 +1,4 @@
1
+ export interface CategoriesWrapperProps {
2
+ category: string
3
+ categoryItems: React.ReactNode[]
4
+ }
@@ -0,0 +1,27 @@
1
+ import React from 'react'
2
+ import { Meta, StoryObj } from '@storybook/react'
3
+ import CategoriesWrapper from './CategoriesWrapper.component'
4
+
5
+ const meta: Meta<typeof CategoriesWrapper> = {
6
+ title: 'Components/CategoriesWrapper',
7
+ component: CategoriesWrapper
8
+ }
9
+ export default meta
10
+
11
+ type Story = StoryObj<typeof CategoriesWrapper>
12
+
13
+ export const Default: Story = {
14
+ args: {
15
+ category: 'A',
16
+ categoryItems: [
17
+ 'Ace',
18
+ 'Admin',
19
+ 'AFK',
20
+ 'Anti-eco',
21
+ 'Aimbot',
22
+ 'All-in',
23
+ 'Armor',
24
+ 'APM'
25
+ ]
26
+ }
27
+ }
@@ -0,0 +1,39 @@
1
+ import { colors } from '@/styles/variables'
2
+ import styled from 'styled-components'
3
+
4
+ export const StyledCategoryWrapper = styled.div`
5
+ display: flex;
6
+ flex-direction: column;
7
+ width: 100%;
8
+ `
9
+
10
+ export const StyledCategorySeparator = styled.div`
11
+ display: flex;
12
+ align-items: center;
13
+ width: 100%;
14
+ gap: 0.75rem;
15
+ font-size: 3rem;
16
+ font-weight: 700;
17
+ `
18
+ export const StyledCategorySeparatorLine = styled.div`
19
+ flex-grow: 1;
20
+ height: 50%;
21
+ border-bottom: 1px solid ${colors.gray20};
22
+ opacity: 0.5;
23
+ `
24
+
25
+ export const StyledCategoryContent = styled.div`
26
+ display: flex;
27
+ gap: 1.875rem;
28
+ flex-wrap: wrap;
29
+ padding: 2.5rem 0 3rem 0;
30
+ `
31
+ export const StyledCategoryItem = styled.div`
32
+ & > button {
33
+ height: 2.125rem;
34
+ padding: 0.625rem 2.5rem;
35
+ font-size: 1.5rem;
36
+ font-weight: 700;
37
+ text-transform: none;
38
+ }
39
+ `
@@ -0,0 +1,33 @@
1
+ import React from 'react'
2
+ import {
3
+ StyledGlossaryCategoryIndex,
4
+ StyledGlossaryCategoryIndexItem
5
+ } from './CategoryIndex.theme'
6
+ import { CategoryIndexProps } from './CategoryIndex.interface'
7
+
8
+ const CategoryIndex: React.FC<CategoryIndexProps> = ({
9
+ categories,
10
+ onChange,
11
+ selectedCategory
12
+ }) => {
13
+ const allCategories = ['#', ...categories]
14
+
15
+ return (
16
+ <StyledGlossaryCategoryIndex>
17
+ {allCategories.map(category => (
18
+ <StyledGlossaryCategoryIndexItem
19
+ onClick={() => onChange(category === '#' ? null : category)}
20
+ isSelected={
21
+ selectedCategory === category ||
22
+ (selectedCategory === null && category === '#')
23
+ }
24
+ key={`category-${category}`}
25
+ >
26
+ {category}
27
+ </StyledGlossaryCategoryIndexItem>
28
+ ))}
29
+ </StyledGlossaryCategoryIndex>
30
+ )
31
+ }
32
+
33
+ export default CategoryIndex
@@ -0,0 +1,5 @@
1
+ export interface CategoryIndexProps {
2
+ categories: string[]
3
+ onChange: (category: string | null) => void
4
+ selectedCategory: string | null
5
+ }
@@ -0,0 +1,23 @@
1
+ import React, { useState } from 'react'
2
+ import CategoryIndex from './CategoryIndex.component'
3
+
4
+ const categories = Array.from({ length: 26 }, (_, i) =>
5
+ String.fromCharCode(65 + i)
6
+ )
7
+
8
+ export default {
9
+ title: 'Components/CategoryIndex',
10
+ component: CategoryIndex
11
+ }
12
+
13
+ export const Default = () => {
14
+ const [selected, setSelected] = useState<string | null>(null)
15
+
16
+ return (
17
+ <CategoryIndex
18
+ categories={[...categories]}
19
+ selectedCategory={selected}
20
+ onChange={setSelected}
21
+ />
22
+ )
23
+ }
@@ -0,0 +1,27 @@
1
+ import { colors } from '@/styles/variables'
2
+ import styled from 'styled-components'
3
+
4
+ type ItemProps = {
5
+ isSelected?: boolean
6
+ }
7
+
8
+ export const StyledGlossaryCategoryIndex = styled.div`
9
+ display: flex;
10
+ flex-wrap: wrap;
11
+ `
12
+
13
+ export const StyledGlossaryCategoryIndexItem = styled.div<ItemProps>`
14
+ cursor: pointer;
15
+ border-radius: 100%;
16
+ background-color: ${({ isSelected }) =>
17
+ isSelected ? `${colors.primary50}66` : ''};
18
+ display: flex;
19
+ align-items: center;
20
+ justify-content: center;
21
+ width: 2.125rem;
22
+ height: 2.125rem;
23
+ box-sizing: border-box;
24
+ color: ${colors.gray20};
25
+ font-weight: 700;
26
+ font-size: 1.5rem;
27
+ `
@@ -0,0 +1,30 @@
1
+ import React from 'react'
2
+ import {
3
+ SearchButton,
4
+ SearchInput,
5
+ StyledGlossarySearch
6
+ } from './SearchBar.theme'
7
+ import Icon from '@/components/atoms/Icon'
8
+ import { SearchBarProps } from './SearchBar.interface'
9
+
10
+ const SearchBar: React.FC<SearchBarProps> = ({
11
+ value,
12
+ onChange,
13
+ placeholder
14
+ }) => {
15
+ return (
16
+ <StyledGlossarySearch>
17
+ <SearchInput
18
+ type="text"
19
+ placeholder={placeholder}
20
+ value={value}
21
+ onChange={onChange}
22
+ />
23
+ <SearchButton>
24
+ <Icon icon="icon-search" />
25
+ </SearchButton>
26
+ </StyledGlossarySearch>
27
+ )
28
+ }
29
+
30
+ export default SearchBar
@@ -0,0 +1,5 @@
1
+ export interface SearchBarProps {
2
+ value: string
3
+ onChange: (e: React.ChangeEvent<HTMLInputElement>) => void
4
+ placeholder?: string
5
+ }
@@ -0,0 +1,18 @@
1
+ import React, { useState } from 'react'
2
+ import SearchBar from './SearchBar.component'
3
+
4
+ export default {
5
+ title: 'Components/SearchBar',
6
+ component: SearchBar
7
+ }
8
+
9
+ export const Default = () => {
10
+ const [value, setValue] = useState('')
11
+ return (
12
+ <SearchBar
13
+ value={value}
14
+ onChange={e => setValue(e.target.value)}
15
+ placeholder="Search..."
16
+ />
17
+ )
18
+ }
@@ -0,0 +1,47 @@
1
+ import styled from 'styled-components'
2
+ import { colors } from '@/styles/variables'
3
+
4
+ export const StyledGlossarySearch = styled.div`
5
+ position: relative;
6
+ width: 100%;
7
+ max-width: 870px;
8
+ margin: 2rem auto;
9
+ `
10
+
11
+ export const SearchInput = styled.input`
12
+ display: flex;
13
+ align-items: center;
14
+ width: 100%;
15
+ padding: 1.5rem 0.75rem;
16
+ border-radius: 62.5rem;
17
+ border: none;
18
+ background: ${colors.gray20};
19
+ font-size: 0.9375rem;
20
+ color: ${colors.hellobar};
21
+ &::placeholder {
22
+ color: ${colors.hellobar};
23
+ }
24
+ `
25
+
26
+ export const SearchButton = styled.button`
27
+ position: absolute;
28
+ top: 50%;
29
+ transform: translateY(-50%);
30
+ right: 1.5rem;
31
+ width: 2.5rem;
32
+ height: 2.5rem;
33
+ border-radius: 50%;
34
+ background: ${colors.hellobar};
35
+ border: none;
36
+ cursor: pointer;
37
+ color: ${colors.gray20};
38
+ display: flex;
39
+ align-items: center;
40
+ justify-content: center;
41
+
42
+ svg {
43
+ width: 1.25rem;
44
+ height: 1.25rem;
45
+ display: block;
46
+ }
47
+ `
@@ -0,0 +1,74 @@
1
+ import React, { useState } from 'react'
2
+ import {
3
+ StyledGlossary,
4
+ StyledGlossaryCategories,
5
+ StyledGlossarySubtitle,
6
+ StyledGlossaryTitle
7
+ } from './Glossary.themes'
8
+
9
+ import SearchBar from '@/components/molecules/SearchBar/SearchBar.component'
10
+ import GlossaryCategoryIndex from '@/components/molecules/CategoryIndex/CategoryIndex.component'
11
+ import CategoriesWrapper from '@/components/molecules/CategoriesWrapper/CategoriesWrapper.component'
12
+ import { GlossaryProps } from './Glossary.interface'
13
+
14
+ export const Glossary: React.FC<GlossaryProps> = ({
15
+ title,
16
+ subtitle,
17
+ items,
18
+ categories,
19
+ placeholder
20
+ }) => {
21
+ const [searchTerm, setSearchTerm] = useState('')
22
+ const [selectedCategory, setSelectedCategory] = useState<string | null>(null)
23
+
24
+ const categoryData: Record<string, string[]> = {}
25
+ categories[0].items.forEach(cat => {
26
+ categoryData[cat.name] = []
27
+ })
28
+ items.forEach(item => {
29
+ item.categories[0].items.forEach(cat => {
30
+ if (categoryData[cat.name]) {
31
+ categoryData[cat.name].push(item.title)
32
+ }
33
+ })
34
+ })
35
+
36
+ const categoryNames = Object.keys(categoryData)
37
+
38
+ const displayedCategories = selectedCategory
39
+ ? [selectedCategory]
40
+ : categoryNames
41
+
42
+ return (
43
+ <StyledGlossary>
44
+ <StyledGlossaryTitle>{title}</StyledGlossaryTitle>
45
+ <StyledGlossarySubtitle>{subtitle}</StyledGlossarySubtitle>
46
+
47
+ <SearchBar
48
+ value={searchTerm}
49
+ onChange={e => setSearchTerm(e.target.value)}
50
+ placeholder={placeholder}
51
+ />
52
+
53
+ <GlossaryCategoryIndex
54
+ categories={categoryNames}
55
+ selectedCategory={selectedCategory}
56
+ onChange={cat =>
57
+ setSelectedCategory(cat === selectedCategory ? null : cat)
58
+ }
59
+ />
60
+
61
+ <StyledGlossaryCategories>
62
+ {displayedCategories.map(category => (
63
+ <CategoriesWrapper
64
+ key={category}
65
+ category={category}
66
+ categoryItems={categoryData[category]}
67
+ />
68
+ ))}
69
+ </StyledGlossaryCategories>
70
+ </StyledGlossary>
71
+ )
72
+ }
73
+
74
+ export default Glossary
@@ -0,0 +1,12 @@
1
+ type GlossaryItem = {
2
+ title: string
3
+ categories: { name: string; items: { slug: string; name: string }[] }[]
4
+ }
5
+
6
+ export type GlossaryProps = {
7
+ title: string
8
+ subtitle: string
9
+ items: GlossaryItem[]
10
+ categories: { name: string; items: { slug: string; name: string }[] }[]
11
+ placeholder?: string
12
+ }