willba-component-library 0.0.37 → 0.0.38

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.0.37",
3
+ "version": "0.0.38",
4
4
  "description": "A stroybook 6 with TypeScript demo",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",
@@ -15,5 +15,6 @@ type Story = StoryObj<typeof FilterBar>
15
15
  export const Primary: Story = {
16
16
  args: {
17
17
  vendor: '',
18
+ language: '',
18
19
  },
19
20
  }
@@ -1,4 +1,4 @@
1
- import React from 'react'
1
+ import React, { useEffect } from 'react'
2
2
  import { useTranslation } from 'react-i18next'
3
3
 
4
4
  import Divider from './components/divider/Divider'
@@ -13,14 +13,20 @@ import useTheme from '../../themes/useTheme'
13
13
 
14
14
  import './FilterBar.css'
15
15
  import '../../themes/Default.css'
16
- import '../../i18n'
16
+ import i18n from '../../i18n'
17
17
 
18
18
  type FilterBarProps = {
19
19
  vendor?: string
20
+ language?: string
20
21
  }
21
22
 
22
- export default function FilterBar({ vendor }: FilterBarProps) {
23
+ export default function FilterBar({ vendor, language }: FilterBarProps) {
23
24
  // useTheme({ vendor })
25
+
26
+ useEffect(() => {
27
+ i18n.changeLanguage(language)
28
+ }, [language])
29
+
24
30
  const { t } = useTranslation('filterBar')
25
31
 
26
32
  const {
package/src/i18n.ts CHANGED
@@ -17,7 +17,7 @@ i18n.use(initReactI18next).init({
17
17
  fi: { filterBar: fiFilterBar },
18
18
  },
19
19
  lng: localeFromUrl,
20
- fallbackLng: 'fi', // Fallback language
20
+ fallbackLng: 'fi',
21
21
  interpolation: {
22
22
  escapeValue: false,
23
23
  },