@aarhus-university/au-lib-react-components 10.0.10 → 10.0.12

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,7 +1,7 @@
1
1
  {
2
2
  "sideEffects": false,
3
3
  "name": "@aarhus-university/au-lib-react-components",
4
- "version": "10.0.10",
4
+ "version": "10.0.12",
5
5
  "description": "Library for shared React components for various applications on au.dk",
6
6
  "scripts": {
7
7
  "build": "webpack --config ./webpack.config.js"
@@ -57,7 +57,7 @@
57
57
  "prop-types": "^15.8.1",
58
58
  "query-string": "^7.1.0",
59
59
  "react-autosuggest": "^10.1.0",
60
- "react-router-dom": "^6.2.1",
60
+ "react-router-dom": "^5.3.3",
61
61
  "webpack": "^5.68.0"
62
62
  },
63
63
  "peerDependencies": {
@@ -1,37 +1,14 @@
1
1
  /* eslint-env browser */
2
2
  /* eslint-disable max-len */
3
3
  import React, { useEffect, useRef, FC } from 'react';
4
- import {
5
- BrowserRouter as Router,
6
- Routes,
7
- Route,
8
- NavLink,
9
- useLocation,
10
- } from 'react-router-dom';
11
4
  import { setTabbedContent, isBelowViewportLimit, destroyTabs } from '@aarhus-university/au-designsystem-delphinus/source/js/components/tabs';
12
5
 
13
- const TabRoutes: FC<TabRoutesProps> = ({ onRouteChange, content }: TabRoutesProps) => {
14
- const location = useLocation();
15
- useEffect(() => {
16
- onRouteChange(location);
17
- }, [location]);
18
-
19
- return (
20
- <Routes>
21
- {content}
22
- </Routes>
23
- );
24
- };
25
-
26
- TabRoutes.displayName = 'Routes';
27
-
28
6
  let windowInnerWidth = 0;
29
7
  let tabbedObject: ITabbedObject | null = null;
30
8
 
31
9
  const AUTabbedContentComponent: FC<AUTabbedContentComponentProps> = ({
32
10
  tabKey,
33
11
  tabs,
34
- tabContent,
35
12
  children,
36
13
  focus,
37
14
  initial,
@@ -73,45 +50,6 @@ const AUTabbedContentComponent: FC<AUTabbedContentComponentProps> = ({
73
50
  }
74
51
  }, []);
75
52
 
76
- if (withRouter) {
77
- const renderRouteTabs = tabs.map((tab) => (
78
- <NavLink
79
- key={tab.href}
80
- to={tab.href}
81
- className={({ isActive }) => (isActive ? 'nav__item nav__item--active' : 'nav__item')}
82
- dangerouslySetInnerHTML={{ __html: tab.text }}
83
- />
84
- ));
85
- const renderContent = (tabContent || []).map((content, index: number) => (
86
- <Route
87
- key={tabs[index].href}
88
- path={tabs[index].href}
89
- >
90
- {content?.content}
91
- </Route>
92
- ));
93
-
94
- return (
95
- <Router>
96
- <div ref={tabsElement} className={classNames}>
97
- <div className="nav nav--has-active-item">
98
- <div className="nav__items">
99
- {renderRouteTabs}
100
- </div>
101
- </div>
102
- <TabRoutes
103
- content={renderContent}
104
- onRouteChange={() => {
105
- if (typeof callback === 'function') {
106
- callback(0);
107
- }
108
- }}
109
- />
110
- </div>
111
- </Router>
112
- );
113
- }
114
-
115
53
  // eslint-disable-next-line jsx-a11y/control-has-associated-label
116
54
  const renderTabs = tabs.map((tab: ITabbedTab) => <a key={tab.href} href={tab.href} className="nav__item" data-gtm={tab.dataGtm} dangerouslySetInnerHTML={{ __html: tab.text }} />);
117
55