@vrobots/storybook 0.1.26 → 0.1.28

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vrobots/storybook",
3
3
  "private": false,
4
- "version": "0.1.26",
4
+ "version": "0.1.28",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -5,7 +5,7 @@ export interface IHeaderLogo {
5
5
  }
6
6
  export interface IHeaderProps {
7
7
  appName?: string;
8
- defaultPath?: string;
8
+ onClickLogo?: () => void;
9
9
  logo: IHeaderLogo;
10
10
  menu?: React.ReactNode | null;
11
11
  version?: string | null;
@@ -14,14 +14,13 @@ export interface IHeaderProps {
14
14
  export interface IHeaderContextProps {
15
15
  appName: string;
16
16
  setAppName: React.Dispatch<React.SetStateAction<string>>;
17
- defaultPath: string;
18
- setDefaultPath: React.Dispatch<React.SetStateAction<string>>;
19
17
  logo: IHeaderLogo;
20
18
  setLogo: React.Dispatch<React.SetStateAction<IHeaderLogo>>;
21
19
  menu: React.ReactNode | null;
22
20
  setMenu: React.Dispatch<React.SetStateAction<React.ReactNode | null>>;
23
21
  version?: string | null;
24
22
  setVersion?: React.Dispatch<React.SetStateAction<string>>;
23
+ onClickLogo?: () => void;
25
24
  }
26
25
  export declare const HeaderContext: React.Context<IHeaderContextProps>;
27
26
  export declare const useHeader: () => IHeaderContextProps;
@@ -11,7 +11,7 @@ export const HeaderProvider = (props) => {
11
11
  const [menu, setMenu] = React.useState(props?.menu || null);
12
12
  const [logo, setLogo] = React.useState(props.logo);
13
13
  const [version, setVersion] = React.useState(props.version || '');
14
- const [defaultPath, setDefaultPath] = React.useState(props.defaultPath || '');
14
+ const { onClickLogo } = props;
15
15
  React.useEffect(() => {
16
16
  setAppName(props.appName || '');
17
17
  }, [props.appName]);
@@ -24,16 +24,16 @@ export const HeaderProvider = (props) => {
24
24
  React.useEffect(() => {
25
25
  setVersion(props.version || '');
26
26
  }, [props.version]);
27
- return (_jsx(HeaderContext.Provider, { value: { appName, setVersion, setAppName, setLogo, setMenu, logo, menu, version, defaultPath, setDefaultPath }, children: props.children }));
27
+ return (_jsx(HeaderContext.Provider, { value: { appName, setVersion, setAppName, setLogo, setMenu, logo, menu, version, onClickLogo }, children: props.children }));
28
28
  };
29
29
  export const Header = forwardRef(({}, ref) => {
30
- const { appName, logo, menu, version, defaultPath } = useHeader();
30
+ const { appName, logo, menu, version, onClickLogo } = useHeader();
31
31
  const { colorMode } = useColorMode();
32
32
  const selectedLogo = logo[colorMode];
33
33
  const borderColors = { ...defaultSystem }._config.theme?.semanticTokens?.colors.border.DEFAULT.value;
34
34
  const borderColor = colorMode === 'light' ? borderColors._light : borderColors._dark;
35
35
  return (_jsxs(Grid, { id: 'header', width: '100%', position: 'relative', zIndex: 2, backgroundColor: colorMode === 'light' ? 'white' : 'black', borderBottom: `1px solid ${borderColor}`, templateColumns: {
36
36
  base: 'repeat(12, 1fr)',
37
- }, ref: ref, children: [_jsxs(GridItem, { colSpan: 6, pt: { base: '0', lg: '8px' }, pb: { base: '0', lg: '8px' }, children: [_jsx(Logo, { defaultPath: defaultPath, alt: appName, src: selectedLogo }), _jsx(Text, { position: 'absolute', fontSize: 'xx-small', bottom: 0, left: 0, ml: 1, color: 'gray.500', children: !!version && _jsxs("em", { children: ["v. ", version] }) })] }), _jsx(GridItem, { colSpan: 6, alignItems: 'center', justifyContent: 'flex-end', pr: 2, display: 'flex', children: menu })] }));
37
+ }, ref: ref, children: [_jsxs(GridItem, { colSpan: 6, pt: { base: '0', lg: '8px' }, pb: { base: '0', lg: '8px' }, children: [_jsx(Logo, { onClick: onClickLogo, alt: appName, src: selectedLogo }), _jsx(Text, { position: 'absolute', fontSize: 'xx-small', bottom: 0, left: 0, ml: 1, color: 'gray.500', children: !!version && _jsxs("em", { children: ["v. ", version] }) })] }), _jsx(GridItem, { colSpan: 6, alignItems: 'center', justifyContent: 'flex-end', pr: 2, display: 'flex', children: menu })] }));
38
38
  });
39
39
  Header.displayName = 'Header';
@@ -1,5 +1,5 @@
1
1
  import { ImageProps } from "@chakra-ui/react";
2
2
  export interface ILogoProps extends ImageProps {
3
- defaultPath?: string;
3
+ onClick?: () => void;
4
4
  }
5
5
  export declare const Logo: (props: ILogoProps) => import("react/jsx-runtime").JSX.Element;
@@ -2,6 +2,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Image, Link } from "@chakra-ui/react";
3
3
  export const Logo = (props) => {
4
4
  const imageProps = { ...props, defaultPath: undefined };
5
- const { defaultPath } = props;
6
- return (_jsx(Link, { href: defaultPath, style: { textDecoration: 'none' }, children: _jsx(Image, { height: { base: '40px', md: '60px' }, p: 2, ...imageProps }) }));
5
+ const { onClick } = props;
6
+ return (_jsx(Link, { href: '#', style: { textDecoration: 'none' }, onClick: onClick, children: _jsx(Image, { height: { base: '40px', md: '60px' }, p: 2, ...imageProps }) }));
7
7
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vrobots/storybook",
3
3
  "private": false,
4
- "version": "0.1.26",
4
+ "version": "0.1.28",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",