Skip to content

Commit 672c86a

Browse files
Add BroswerRouterProps to SciReactUIProviderProps
1 parent efb296e commit 672c86a

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

changelog.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ SciReactUI Changelog
22
====================
33

44

5-
[v0.1.1] - 2025-?-?
5+
[v0.2.0] - 2025-?-?
66
--------------------
77

88
### Added
@@ -12,7 +12,7 @@ SciReactUI Changelog
1212
- Styles added to Navbar and Footer incorrectly remove built in styles.
1313

1414
### Changed
15-
- Breadcrumbs component uses react-router-dom for page routing.
15+
- Breadcrumbs component uses react-router-dom for page routing. Breaking change requires use of BrowserRouter or SciReactUIProvider.
1616

1717
[v0.1.0] - 2025-04-10
1818
---------------------

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@diamondlightsource/sci-react-ui",
3-
"version": "0.1.1alpha",
3+
"version": "0.2",
44
"description": "A theme and component library to make websites at scientific institutions simple to create.",
55
"author": "Diamond Light Source",
66
"license": "ISC",

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ export * from "./themes/BaseTheme";
1212
export * from "./themes/GenericTheme";
1313
export * from "./themes/DiamondTheme";
1414
export * from "./themes/ThemeProvider";
15+
export * from "./themes/SciReactUIProvider";

src/themes/SciReactUIProvider.tsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
import * as React from "react";
2-
import { BrowserRouter } from "react-router-dom";
2+
import { BrowserRouter, BrowserRouterProps } from "react-router-dom";
33
import { ThemeProvider, ThemeProviderProps } from "./ThemeProvider";
44

5-
type SciReactUIProviderProps = React.PropsWithChildren<ThemeProviderProps>;
5+
interface SciReactUIProviderProps
6+
extends React.PropsWithChildren<ThemeProviderProps> {
7+
router?: BrowserRouterProps;
8+
}
69

7-
export const SciReactUIProvider: React.FC<SciReactUIProviderProps> = (
8-
props,
9-
) => {
10+
export const SciReactUIProvider: React.FC<SciReactUIProviderProps> = ({
11+
children,
12+
router,
13+
...themeProps
14+
}) => {
1015
return (
11-
<ThemeProvider {...props}>
12-
<BrowserRouter> {props.children} </BrowserRouter>
16+
<ThemeProvider {...themeProps}>
17+
<BrowserRouter {...router}>{children} </BrowserRouter>
1318
</ThemeProvider>
1419
);
1520
};

0 commit comments

Comments
 (0)