@vrobots/storybook 0.2.19 → 0.2.21
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/dist/package.json
CHANGED
|
@@ -4,7 +4,14 @@ export interface IPageProps {
|
|
|
4
4
|
breadcrumbs?: IBreadcrumb[];
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
}
|
|
7
|
+
export interface IPageHeadingProps {
|
|
8
|
+
heading: string;
|
|
9
|
+
subheading?: string;
|
|
10
|
+
actions?: React.ReactNode;
|
|
11
|
+
color?: string;
|
|
12
|
+
}
|
|
7
13
|
export declare const Page: {
|
|
8
14
|
({ breadcrumbs, children }: IPageProps): import("react/jsx-runtime").JSX.Element;
|
|
9
15
|
Flex({ children, breadcrumbs }: IPageProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
Heading({ heading, subheading, actions, color }: IPageHeadingProps): import("react/jsx-runtime").JSX.Element;
|
|
10
17
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Box } from "@chakra-ui/react";
|
|
2
|
+
import { Box, Heading, HStack, Text } from "@chakra-ui/react";
|
|
3
3
|
import { Breadcrumbs } from "./Breadcrumbs";
|
|
4
4
|
import { useHeader } from "./Header";
|
|
5
5
|
import React from "react";
|
|
6
|
+
import { useColorMode } from "./ui/color-mode";
|
|
6
7
|
export const Page = ({ breadcrumbs, children }) => {
|
|
7
8
|
return (_jsxs(Box, { flex: 1, display: 'flex', flexDirection: 'column', alignItems: 'stretch', minHeight: '100%', p: 4, children: [_jsx(Breadcrumbs, { breadcrumbs: breadcrumbs }), _jsx(Box, { flex: '1 1 auto', mt: !!breadcrumbs?.length ? 2 : 0, children: children })] }));
|
|
8
9
|
};
|
|
@@ -11,3 +12,15 @@ Page.Flex = ({ children, breadcrumbs }) => {
|
|
|
11
12
|
const breadcrumbsRef = React.useRef(null);
|
|
12
13
|
return (_jsxs(React.Fragment, { children: [_jsx(Breadcrumbs, { breadcrumbs: breadcrumbs, ref: breadcrumbsRef }), _jsx(Box, { display: "flex", justifyContent: "center", alignItems: "center", height: `calc(100vh - ${((headerRef.current?.offsetHeight || 0) * 2) + (breadcrumbsRef.current?.offsetHeight || 0)}px)`, children: children })] }));
|
|
13
14
|
};
|
|
15
|
+
Page.Heading = ({ heading, subheading, actions, color }) => {
|
|
16
|
+
const { colorMode } = useColorMode();
|
|
17
|
+
const isLightMode = colorMode === 'light';
|
|
18
|
+
const panelShadow = isLightMode
|
|
19
|
+
? '0 20px 45px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255,255,255,0.9)'
|
|
20
|
+
: '0 20px 45px rgba(2, 6, 23, 0.55), inset 0 1px 0 rgba(255,255,255,0.05)';
|
|
21
|
+
const panelBorder = isLightMode ? 'rgba(15, 23, 42, 0.1)' : 'rgba(148, 163, 184, 0.26)';
|
|
22
|
+
const accentBackground = isLightMode
|
|
23
|
+
? 'linear-gradient(120deg, rgba(224, 242, 254, 0.88), rgba(255, 255, 255, 0.88))'
|
|
24
|
+
: 'linear-gradient(120deg, rgba(8, 47, 73, 0.45), rgba(15, 23, 42, 0.6))';
|
|
25
|
+
return (_jsxs(Box, { mb: 4, p: { base: 3, md: 4 }, borderRadius: 'xl', bg: accentBackground, borderWidth: '1px', borderColor: panelBorder, boxShadow: panelShadow, children: [_jsxs(HStack, { gap: 4, mb: 4, children: [_jsx(Heading, { width: '50%', color: color, children: heading }), _jsx(Box, { textAlign: 'right', width: '50%', children: actions })] }), subheading && (_jsx(Text, { mt: 1, color: isLightMode ? 'gray.700' : 'gray.200', children: subheading }))] }));
|
|
26
|
+
};
|