@campxdev/react-blueprint 0.1.35 → 0.1.37

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@campxdev/react-blueprint",
3
- "version": "0.1.35",
3
+ "version": "0.1.37",
4
4
  "main": "./export.ts",
5
5
  "private": false,
6
6
  "dependencies": {
@@ -14,6 +14,14 @@
14
14
  "axios": "^1.7.2",
15
15
  "framer-motion": "^11.2.9",
16
16
  "js-cookie": "^3.0.5",
17
+ "@testing-library/jest-dom": "^5.14.1",
18
+ "@testing-library/react": "^13.0.0",
19
+ "@testing-library/user-event": "^13.2.1",
20
+ "@types/jest": "^27.0.1",
21
+ "@types/node": "^16.7.13",
22
+ "@types/react": "^18.0.0",
23
+ "@types/react-dom": "^18.3.0",
24
+ "@types/react-router-dom": "^5.3.3",
17
25
  "lodash": "^4.17.21",
18
26
  "pullstate": "^1.24.0",
19
27
  "react": "^18.3.1",
@@ -66,9 +74,6 @@
66
74
  "@storybook/react-webpack5": "^8.1.5",
67
75
  "@storybook/test": "^8.1.5",
68
76
  "@types/js-cookie": "^3.0.5",
69
- "@types/react": "^18.0.0",
70
- "@types/react-dom": "^18.3.0",
71
- "@types/react-router-dom": "^5.3.3",
72
77
  "eslint-plugin-storybook": "^0.8.0",
73
78
  "prop-types": "^15.8.1",
74
79
  "storybook": "^8.1.5",
@@ -1,5 +1,4 @@
1
- import { Chip } from "@mui/material";
2
- import { styled } from "@mui/material/styles";
1
+ import { Chip, styled } from "@mui/material";
3
2
  import { Typography } from "../../DataDisplay/Typography/Typography";
4
3
  import { Icons } from "../../export";
5
4
 
@@ -1,13 +1,10 @@
1
- import { Box, Divider, IconButton, Stack } from "@mui/material";
1
+ import { Stack } from "@mui/material";
2
2
  import { ReactNode } from "react";
3
- import { StyledHeader } from "./styles/styles";
4
- import { CampxIcon } from "../../Assets/Icons/IconComponents/CampxIcon";
5
- import { Typography } from "../../DataDisplay/Typography/Typography";
6
- import UserBox from "./AppHeaderActions/UserBox";
7
3
  import { HelpIcon } from "../../Assets/Icons/IconComponents/HelpIcon";
8
- import { AdministratorIcon } from "../../Assets/Icons/IconComponents/AdministratorIcon";
9
- import { TicketsIcon } from "../../Assets/Icons/IconComponents/TicketsIcon";
4
+ import { Typography } from "../../DataDisplay/Typography/Typography";
10
5
  import { StyledIconButton } from "../../Navigation/DropDownMenu/styles";
6
+ import UserBox from "./AppHeaderActions/UserBox";
7
+ import { StyledHeader } from "./styles/styles";
11
8
 
12
9
  export interface AppHeaderProps {
13
10
  actions?: ReactNode[];
@@ -6,15 +6,8 @@ const sidebarWidth = { collapsed: "60px", expanded: "240px" };
6
6
  export const StyledHeader = styled("header")(
7
7
  ({ theme, collapsed }: { theme?: any; collapsed: boolean }) => ({
8
8
  display: "flex",
9
- position: "fixed",
10
9
  flexDirection: "row",
11
10
  alignItems: "center",
12
- width:
13
- "calc(100% - 12px - " +
14
- (collapsed ? sidebarWidth.collapsed : sidebarWidth.expanded) +
15
- ")",
16
- top: "12px",
17
- left: collapsed ? sidebarWidth.collapsed : sidebarWidth.expanded,
18
11
  height: "60px",
19
12
  backgroundColor: theme.palette.background.paper,
20
13
  justifyContent: "space-between",
@@ -0,0 +1,42 @@
1
+ import { Grid, Stack, useTheme } from "@mui/material";
2
+ import { useState } from "react";
3
+ import { FloatingSidebar, Icons } from "../../export";
4
+ import { AppHeader } from "../AppHeader/AppHeader";
5
+
6
+ export const AppLayout = () => {
7
+ const theme = useTheme();
8
+ const [collapsed, setCollapsed] = useState(false);
9
+ const menu = [
10
+ { name: "Home", path: "/home", icon: Icons.DashBoardIcon },
11
+ { name: "Self Service Portal", path: "/item2" },
12
+ { name: "hrms", path: "/hrms" },
13
+ ];
14
+ return (
15
+ <Grid
16
+ container
17
+ spacing={3}
18
+ sx={{
19
+ backgroundColor: theme.palette.surface.defaultBackground,
20
+ minHeight: "80vh",
21
+ }}
22
+ >
23
+ <Grid item xs={collapsed ? 1 : 3}>
24
+ <FloatingSidebar
25
+ menu={menu}
26
+ collapsed={collapsed}
27
+ setCollapsed={setCollapsed}
28
+ />
29
+ </Grid>
30
+ <Grid item xs={collapsed ? 11 : 9}>
31
+ <Stack>
32
+ <AppHeader
33
+ clientName="Anurag University"
34
+ userFullName="Srikanth Yellapragada"
35
+ actions={[]}
36
+ collapsed={true}
37
+ />
38
+ </Stack>
39
+ </Grid>
40
+ </Grid>
41
+ );
42
+ };
@@ -1,13 +1,12 @@
1
- import React, { useState } from "react";
2
- import { IconButton, ListItemIcon } from "@mui/material";
3
- import { RightIcon } from "../../Assets/Icons/IconComponents/RightIcon";
4
- import { LeftIcon } from "../../Assets/Icons/IconComponents/LeftIcon";
5
- import { createSidebarStyles } from "./styles";
1
+ import { IconButton } from "@mui/material";
6
2
  import { useMatch, useResolvedPath } from "react-router-dom";
7
- import { Icons } from "../../export";
8
- import { Typography } from "../../DataDisplay/Typography/Typography";
9
- import { CampxIcon } from "../../Assets/Icons/IconComponents/CampxIcon";
10
3
  import { CampxFullLogoIcon } from "../../Assets/Icons/IconComponents/CampxFullLogoIcon";
4
+ import { CampxIcon } from "../../Assets/Icons/IconComponents/CampxIcon";
5
+ import { LeftIcon } from "../../Assets/Icons/IconComponents/LeftIcon";
6
+ import { RightIcon } from "../../Assets/Icons/IconComponents/RightIcon";
7
+ import { Typography } from "../../DataDisplay/Typography/Typography";
8
+ import { Icons } from "../../export";
9
+ import { createSidebarStyles } from "./styles";
11
10
 
12
11
  export interface MenuItemProps {
13
12
  name: string;
@@ -17,8 +16,15 @@ export interface MenuItemProps {
17
16
  iconType?: string;
18
17
  }
19
18
 
20
- export const FloatingSidebar = ({ menu }: { menu: MenuItemProps[] }) => {
21
- const [collapsed, setCollapsed] = useState(false);
19
+ export const FloatingSidebar = ({
20
+ menu,
21
+ collapsed,
22
+ setCollapsed,
23
+ }: {
24
+ menu: MenuItemProps[];
25
+ collapsed: boolean;
26
+ setCollapsed: any;
27
+ }) => {
22
28
  const {
23
29
  StyledSidebarContainer,
24
30
  StyledLogoArea,
@@ -10,16 +10,10 @@ import { Link } from "react-router-dom";
10
10
 
11
11
  export const createSidebarStyles = (collapsed: boolean) => {
12
12
  const StyledSidebarContainer = styled(Stack)(({ theme }) => {
13
- console.log(theme);
14
13
  return {
15
14
  height: "100vh",
16
15
  width: collapsed ? "60px" : "240px",
17
16
  backgroundColor: theme.palette.surface.defaultBackground,
18
- position: "fixed",
19
- left: "12px",
20
- top: "12px",
21
- bottom: "12px",
22
- zIndex: 1000,
23
17
  };
24
18
  });
25
19
 
@@ -0,0 +1,31 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import { AppLayout } from "../../components/Layout/AppLayout/AppLayout";
3
+
4
+
5
+ // Define the default export with Meta type including the component type
6
+ const meta: Meta<typeof AppLayout> = {
7
+ title: "Layout/AppLayout",
8
+ component: AppLayout,
9
+ tags: ["autodocs"],
10
+ argTypes: {
11
+ actions: {
12
+ control: "object",
13
+ description: "Custom actions to be displayed.",
14
+ },
15
+ },
16
+ };
17
+
18
+ export default meta;
19
+ type Story = StoryObj<typeof AppLayout>;
20
+
21
+ // Primary story
22
+ export const Primary: Story = {
23
+ render: (args: any) => (
24
+
25
+ <AppLayout {...args} />
26
+
27
+ ),
28
+ args: {
29
+
30
+ },
31
+ };
package/src/App.test.tsx DELETED
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- import { render, screen } from '@testing-library/react';
3
- import App from './App';
4
-
5
- test('renders learn react link', () => {
6
- render(<App />);
7
- const linkElement = screen.getByText(/learn react/i);
8
- expect(linkElement).toBeInTheDocument();
9
- });