willba-component-library 0.2.96 → 0.2.98

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.2.96",
3
+ "version": "0.2.98",
4
4
  "description": "A custom UI component library",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",
@@ -77,6 +77,7 @@ export const Main: Story = {
77
77
  },
78
78
  ],
79
79
  outerLoading: false,
80
+ siteId: undefined,
80
81
  },
81
82
  render: (args) => (
82
83
  <div style={{ background: 'white', padding: '30px', height: '100vh' }}>
@@ -36,6 +36,7 @@ export default function FilterBar({
36
36
  mode,
37
37
  tabs,
38
38
  outerLoading,
39
+ siteId,
39
40
  }: FilterBarTypes) {
40
41
  const themePalette = useTheme({ palette })
41
42
 
@@ -63,6 +64,7 @@ export default function FilterBar({
63
64
  ageCategories,
64
65
  onSubmit,
65
66
  tabs,
67
+ siteId,
66
68
  })
67
69
 
68
70
  // Scroll in to view
@@ -12,6 +12,7 @@ export type FilterBarTypes = {
12
12
  mode?: string
13
13
  tabs?: Tab[]
14
14
  outerLoading?: boolean
15
+ siteId?: string
15
16
  }
16
17
 
17
18
  export type AgeCategoryCount = {
@@ -15,6 +15,7 @@ type Props = {
15
15
  ageCategories?: AgeCategoryType[]
16
16
  onSubmit?: ((val: Filters) => void) | null
17
17
  tabs?: Tab[]
18
+ siteId?: string
18
19
  }
19
20
 
20
21
  export const useFilterBar = ({
@@ -22,6 +23,7 @@ export const useFilterBar = ({
22
23
  ageCategories,
23
24
  onSubmit,
24
25
  tabs,
26
+ siteId,
25
27
  }: Props) => {
26
28
  const [selectedPath, setSelectedPath] = useState<string>(Pages.EVENTS)
27
29
  const [selectedFilter, setSelectedFilter] = useState<string | boolean>(false)
@@ -115,10 +117,16 @@ export const useFilterBar = ({
115
117
  if (onSubmit && window.location.href.includes(selectedPath)) {
116
118
  onSubmit(newParams)
117
119
  } else {
118
- setInnerLoading(true),
119
- (window.location.href = `${redirectUrl}/${selectedPath}${
120
- querySearchParams ? `?${querySearchParams.toString()}` : ''
121
- }`)
120
+ const siteIdParam = siteId ? `siteId=${siteId}` : ''
121
+ const querySearchParam = querySearchParams
122
+ ? querySearchParams.toString()
123
+ : ''
124
+
125
+ const params = [siteIdParam, querySearchParam].filter(Boolean).join('&')
126
+ const path = `${redirectUrl}${selectedPath}`
127
+
128
+ setInnerLoading(true)
129
+ window.location.href = params ? `${path}?${params}` : path
122
130
  }
123
131
  }
124
132
 
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- export declare const SpinnerSVG: ({ fill, size, }: {
3
- fill?: string | undefined;
4
- size?: number | undefined;
5
- }) => React.JSX.Element;
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- import './CloseButton.css';
3
- interface CloseButtonPropsType {
4
- handleClose: () => void;
5
- }
6
- export declare const CloseButton: ({ handleClose }: CloseButtonPropsType) => React.JSX.Element;
7
- export {};
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import './SubmitButton.css';
3
- export declare const SubmitButton: ({ onClick }: any) => React.JSX.Element;
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- import { DateRange } from 'react-day-picker';
3
- import { CalendarOffset } from '../../FilterBarTypes';
4
- import 'react-day-picker/dist/style.css';
5
- import './Calendar.css';
6
- type Props = {
7
- calendarRange: DateRange | undefined;
8
- setCalendarRange: (range: DateRange | undefined) => void;
9
- calendarOffset?: CalendarOffset;
10
- selectedPath: string;
11
- locale?: string;
12
- };
13
- export declare const Calendar: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
14
- export {};
@@ -1,8 +0,0 @@
1
- /// <reference types="react" />
2
- type Props = {
3
- handleSelectedFilter: (arg: boolean) => void;
4
- };
5
- export declare const useCloseFilterSection: ({ handleSelectedFilter }: Props) => {
6
- filtersRef: import("react").MutableRefObject<HTMLDivElement | null>;
7
- };
8
- export {};
@@ -1,5 +0,0 @@
1
- type Props = {
2
- language?: string;
3
- };
4
- export declare const useUpdateTranslations: ({ language }: Props) => void;
5
- export {};
@@ -1,6 +0,0 @@
1
- import { DateRange } from 'react-day-picker';
2
- type Props = {
3
- calendarRange?: DateRange;
4
- };
5
- export declare const parseDates: ({ calendarRange }: Props) => string | null;
6
- export {};
@@ -1 +0,0 @@
1
- export declare const handleOverlappingDates: () => void;
@@ -1,3 +0,0 @@
1
- export { parseDates } from './parseDates';
2
- export { parseDate } from './parseDate';
3
- export { nightsCount } from './nightsCount';
@@ -1,6 +0,0 @@
1
- import { DateRange } from 'react-day-picker';
2
- type Props = {
3
- calendarRange?: DateRange;
4
- };
5
- export declare const nightsCount: ({ calendarRange }: Props) => number | undefined;
6
- export {};
@@ -1,7 +0,0 @@
1
- type Props = {
2
- date?: Date;
3
- dateFormat?: string;
4
- language?: string;
5
- };
6
- export declare const parseDate: ({ date, dateFormat, language, }: Props) => string | null;
7
- export {};
@@ -1,6 +0,0 @@
1
- import { DateRange } from 'react-day-picker';
2
- type Props = {
3
- calendarRange?: DateRange;
4
- };
5
- export declare const parseDates: ({ calendarRange }: Props) => string | null;
6
- export {};