willba-component-library 0.0.42 → 0.0.43

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.
@@ -1,6 +1,5 @@
1
- import React from 'react';
2
1
  type ThemeProps = {
3
2
  vendor?: string;
4
3
  };
5
- export default function MyComponent({ vendor }: ThemeProps): React.JSX.Element;
4
+ export default function useTheme({ vendor }: ThemeProps): void;
6
5
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "willba-component-library",
3
- "version": "0.0.42",
3
+ "version": "0.0.43",
4
4
  "description": "A stroybook 6 with TypeScript demo",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",
@@ -21,7 +21,7 @@ type FilterBarProps = {
21
21
  }
22
22
 
23
23
  export default function FilterBar({ vendor, language }: FilterBarProps) {
24
- const cssLoaded = useTheme({ vendor })
24
+ useTheme({ vendor })
25
25
 
26
26
  const [rerenderKey, setRerenderKey] = useState(0)
27
27
 
@@ -49,7 +49,7 @@ export default function FilterBar({ vendor, language }: FilterBarProps) {
49
49
  } = useFilterBar()
50
50
 
51
51
  return (
52
- <div className={`filter-bar ${cssLoaded ? 'dynamic-theme-class' : ''}`}>
52
+ <div className={`filter-bar `}>
53
53
  <div className="filter-bar-header">
54
54
  <SelectButton
55
55
  label={t('calendar.startDate')}
@@ -0,0 +1,5 @@
1
+ // cssModules.d.ts
2
+ declare module '*.css' {
3
+ const classes: { [key: string]: string }
4
+ export default classes
5
+ }
@@ -0,0 +1,13 @@
1
+ /* styles.module.css */
2
+
3
+ .default {
4
+ /* Default styles */
5
+ }
6
+
7
+ .kisakallio {
8
+ /* Styles for Kisakallio theme */
9
+ }
10
+
11
+ .pajulahti {
12
+ /* Styles for Pajulahti theme */
13
+ }
@@ -1,54 +1,21 @@
1
- // import React, { useEffect, useState } from 'react'
1
+ import { useEffect } from 'react'
2
2
 
3
- // type ThemeProps = {
4
- // vendor?: string
5
- // }
6
-
7
- // export default function useTheme({ vendor }: ThemeProps) {
8
- // const [cssLoaded, setCssLoaded] = useState(false)
9
-
10
- // useEffect(() => {
11
- // async function loadThemeCSS() {
12
- // try {
13
- // let cssUrl = ''
14
-
15
- // if (vendor === 'Kisakallio') {
16
- // cssUrl = './Kisakallio.css'
17
- // } else if (vendor === 'Pajulahti') {
18
- // cssUrl = './Pajulahti.css'
19
- // } else {
20
- // cssUrl = './Default.css'
21
- // }
22
-
23
- // await loadCSS(cssUrl)
24
- // setCssLoaded(true)
25
- // } catch (error) {
26
- // console.error('Error loading CSS:', error)
27
- // }
28
- // }
29
-
30
- // loadThemeCSS()
31
- // }, [vendor])
32
-
33
- // return cssLoaded
34
- // }
35
-
36
- import React, { useEffect } from 'react'
37
3
  type ThemeProps = {
38
4
  vendor?: string
39
5
  }
40
6
 
41
- export default function MyComponent({ vendor }: ThemeProps) {
7
+ export default function useTheme({ vendor }: ThemeProps) {
42
8
  useEffect(() => {
43
9
  if (vendor === 'Kisakallio') {
44
- addCSSFile('./Kisakallio.css')
10
+ addCSSFile('../src/themes/Kisakallio.css')
11
+ } else if (vendor === 'Pajulahti') {
12
+ addCSSFile('../src/themes/Pajulahti.css')
45
13
  } else {
46
- addCSSFile('./Default.css')
14
+ addCSSFile('../src/themes/Default.css')
47
15
  }
48
16
  }, [vendor])
49
17
 
50
- // Rest of your component code
51
- return <div>My Component</div>
18
+ return
52
19
  }
53
20
 
54
21
  const addCSSFile = (href: string) => {