@etsoo/toolpad 1.0.8 → 1.0.9
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 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare function TitleBar(): number | bigint | boolean | Iterable<React.ReactNode> | Promise<React.AwaitedReactNode> | import("react/jsx-runtime").JSX.Element | undefined;
|
|
@@ -17,9 +17,9 @@ export function TitleBar() {
|
|
|
17
17
|
const branding = React.useContext(BrandingContext);
|
|
18
18
|
// Application title
|
|
19
19
|
const title = branding?.title;
|
|
20
|
-
const titleUI = React.useMemo(() => {
|
|
20
|
+
const [titleUI, hasLink] = React.useMemo(() => {
|
|
21
21
|
if (title == null)
|
|
22
|
-
return;
|
|
22
|
+
return [undefined, true];
|
|
23
23
|
if (typeof title === "string" || Array.isArray(title)) {
|
|
24
24
|
let titleString;
|
|
25
25
|
let clickHandler;
|
|
@@ -30,14 +30,19 @@ export function TitleBar() {
|
|
|
30
30
|
else {
|
|
31
31
|
titleString = title;
|
|
32
32
|
}
|
|
33
|
-
return
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
return [
|
|
34
|
+
_jsx(Typography, { variant: "h6", sx: {
|
|
35
|
+
color: (theme.vars ?? theme).palette.primary.main,
|
|
36
|
+
fontWeight: "700",
|
|
37
|
+
ml: 0.5,
|
|
38
|
+
whiteSpace: "nowrap"
|
|
39
|
+
}, onClick: clickHandler == null ? undefined : (e) => clickHandler(e), children: titleString }),
|
|
40
|
+
true
|
|
41
|
+
];
|
|
39
42
|
}
|
|
40
|
-
return title;
|
|
43
|
+
return [title, false];
|
|
41
44
|
}, [title]);
|
|
45
|
+
if (!hasLink)
|
|
46
|
+
return titleUI;
|
|
42
47
|
return (_jsx(Link, { href: "/", style: { color: "inherit", textDecoration: "none" }, children: _jsxs(Stack, { direction: "row", alignItems: "center", children: [branding?.logo && _jsx(LogoContainer, { children: branding.logo }), titleUI] }) }));
|
|
43
48
|
}
|
package/package.json
CHANGED
|
@@ -20,8 +20,8 @@ export function TitleBar() {
|
|
|
20
20
|
|
|
21
21
|
// Application title
|
|
22
22
|
const title = branding?.title;
|
|
23
|
-
const titleUI = React.useMemo(() => {
|
|
24
|
-
if (title == null) return;
|
|
23
|
+
const [titleUI, hasLink] = React.useMemo(() => {
|
|
24
|
+
if (title == null) return [undefined, true];
|
|
25
25
|
|
|
26
26
|
if (typeof title === "string" || Array.isArray(title)) {
|
|
27
27
|
let titleString: string;
|
|
@@ -34,7 +34,7 @@ export function TitleBar() {
|
|
|
34
34
|
} else {
|
|
35
35
|
titleString = title;
|
|
36
36
|
}
|
|
37
|
-
return
|
|
37
|
+
return [
|
|
38
38
|
<Typography
|
|
39
39
|
variant="h6"
|
|
40
40
|
sx={{
|
|
@@ -46,13 +46,16 @@ export function TitleBar() {
|
|
|
46
46
|
onClick={clickHandler == null ? undefined : (e) => clickHandler(e)}
|
|
47
47
|
>
|
|
48
48
|
{titleString}
|
|
49
|
-
</Typography
|
|
50
|
-
|
|
49
|
+
</Typography>,
|
|
50
|
+
true
|
|
51
|
+
];
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
return title;
|
|
54
|
+
return [title, false];
|
|
54
55
|
}, [title]);
|
|
55
56
|
|
|
57
|
+
if (!hasLink) return titleUI;
|
|
58
|
+
|
|
56
59
|
return (
|
|
57
60
|
<Link href="/" style={{ color: "inherit", textDecoration: "none" }}>
|
|
58
61
|
<Stack direction="row" alignItems="center">
|