willba-component-library 0.1.17 → 0.1.19

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "willba-component-library",
3
- "version": "0.1.17",
3
+ "version": "0.1.19",
4
4
  "description": "A stroybook 6 with TypeScript demo",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",
@@ -25,13 +25,11 @@ export interface FilterBarProps {
25
25
  ageCategories?: AgeCategoryType[]
26
26
  redirectUrl: string
27
27
  palette?: Palette
28
- currentPath?: string
29
28
  }
30
29
 
31
30
  export default function FilterBar({
32
31
  language,
33
32
  ageCategories = AGE_CATEGORIES_FALLBACK,
34
- currentPath,
35
33
  redirectUrl = REDIRECT_URL_FALLBACK,
36
34
  palette,
37
35
  }: FilterBarProps) {
@@ -94,12 +92,12 @@ export default function FilterBar({
94
92
  <div className="will-filter-bar-tabs" ref={targetFilterBarRef}>
95
93
  <TabButton
96
94
  label={t('tabs.events')}
97
- onClick={() => setSelectedPath('./events')}
95
+ onClick={() => setSelectedPath('/events')}
98
96
  active={selectedPath === '/events'}
99
97
  />
100
98
  <TabButton
101
99
  label={t('tabs.rooms')}
102
- onClick={() => setSelectedPath('./rooms')}
100
+ onClick={() => setSelectedPath('/rooms')}
103
101
  active={selectedPath === '/rooms'}
104
102
  />
105
103
  </div>
@@ -86,15 +86,13 @@ export default function useFilterBar({ redirectUrl }: UseFilterBarPropsType) {
86
86
  }, [selectedFilter])
87
87
 
88
88
  useEffect(() => {
89
- let currentPath = '/events' // Default path name
90
-
91
89
  if (typeof window !== 'undefined') {
92
- // Get current path name
93
- currentPath =
94
- window.location.pathname.includes('/events') ||
95
- window.location.pathname.includes('/rooms')
96
- ? window.location.pathname
97
- : '/events'
90
+ // Handle default selected tab
91
+ const currentPath = window.location.pathname.includes('/events')
92
+ ? '/events'
93
+ : window.location.pathname.includes('/rooms')
94
+ ? '/rooms'
95
+ : '/events'
98
96
 
99
97
  setSelectedPath(currentPath)
100
98
  }