@campxdev/react-blueprint 0.1.38 → 0.1.40

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.38",
3
+ "version": "0.1.40",
4
4
  "main": "./export.ts",
5
5
  "private": false,
6
6
  "dependencies": {
package/src/App.tsx CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./App.css";
2
- import { AppHeader, AppsMenu } from "./components/export";
2
+ import { AppHeader } from "./components/export";
3
3
  import Providers from "./contexts/Providers";
4
4
 
5
5
  function App() {
@@ -8,7 +8,6 @@ function App() {
8
8
  <AppHeader
9
9
  clientName="Anurag University"
10
10
  actions={[<p>asdjflsf</p>]}
11
- appsMenu={<AppsMenu apps={["exams", "square", "admin"]} />}
12
11
  userFullName="Srikanth Yellapragada"
13
12
  collapsed={false}
14
13
  />
@@ -1,19 +1,17 @@
1
1
  import { Box, styled } from "@mui/material";
2
2
  import { Link } from "react-router-dom";
3
3
 
4
- const sidebarWidth = { collapsed: "60px", expanded: "240px" };
5
-
6
4
  export const StyledHeader = styled("header")(
7
- ({ theme, collapsed }: { theme?: any; collapsed: boolean }) => ({
5
+ ({ theme }: { theme?: any; collapsed: boolean }) => ({
8
6
  display: "flex",
9
7
  flexDirection: "row",
10
8
  alignItems: "center",
11
9
  height: "60px",
10
+ width: "100%",
12
11
  backgroundColor: theme.palette.background.paper,
13
12
  justifyContent: "space-between",
14
13
  padding: "0 32px",
15
14
  borderRadius: "8px",
16
- marginTop: "12px",
17
15
  })
18
16
  );
19
17
 
@@ -65,7 +65,7 @@ export const Sidebar = ({
65
65
  };
66
66
 
67
67
  return (
68
- <StyledSidebarContainer direction="column" spacing={2}>
68
+ <StyledSidebarContainer direction="column" spacing="12px">
69
69
  <StyledLogoArea collapsed={collapsed}>
70
70
  {collapsed ? <CampxIcon /> : <CampxFullLogoIcon />}
71
71
  </StyledLogoArea>
@@ -11,10 +11,9 @@ import { Link } from "react-router-dom";
11
11
  export const createSidebarStyles = (collapsed: boolean) => {
12
12
  const StyledSidebarContainer = styled(Stack)(({ theme }) => {
13
13
  return {
14
- height: "100vh",
15
- marginLeft: "12px",
16
- marginTop: "12px",
14
+ height: "calc(100vh - 24px)",
17
15
  width: collapsed ? "60px" : "240px",
16
+ margin: "12px",
18
17
  backgroundColor: theme.palette.surface.defaultBackground,
19
18
  };
20
19
  });
@@ -41,10 +40,8 @@ export const createSidebarStyles = (collapsed: boolean) => {
41
40
  display: "flex",
42
41
  alignItems: "center",
43
42
  justifyContent: "center",
44
- padding: theme.spacing(2),
45
43
  borderRadius: "8px",
46
44
  backgroundColor: theme.palette.surface.paperBackground,
47
- transition: "max-height 0.3s ease-out",
48
45
  height: "60px",
49
46
  }));
50
47
  interface StyledListItemProps {
@@ -3,7 +3,5 @@ export * from "./DataDisplay/export";
3
3
  export * from "./Input/export";
4
4
  export * from "./Layout/AppHeader/AppHeader";
5
5
 
6
- export * from "./Layout/AppHeader/AppsMenu";
7
- export * from "./Layout/PageContent/PageContent";
8
- export * from "./Navigation/exports";
9
6
  export * from "./Feedback/exports";
7
+ export * from "./Navigation/exports";
@@ -1,10 +1,10 @@
1
1
  import { Meta, StoryObj } from "@storybook/react";
2
- import { AppsMenu } from "../../components/export";
2
+
3
+ import { Box } from "@mui/material";
3
4
  import {
4
5
  AppHeader,
5
6
  AppHeaderProps,
6
7
  } from "../../components/Layout/AppHeader/AppHeader";
7
- import { Box } from "@mui/material";
8
8
 
9
9
  // Define the default export with Meta type including the component type
10
10
  const meta: Meta<typeof AppHeader> = {
@@ -1,11 +1,11 @@
1
- import { Meta, StoryObj } from "@storybook/react";
2
1
  import { Box } from "@mui/material";
3
- import { FloatingSidebar, Icons } from "../../components/export";
2
+ import { Meta, StoryObj } from "@storybook/react";
3
+ import { Icons, Sidebar } from "../../components/export";
4
4
 
5
- // Define the default export with Meta type including the component type
6
- const meta: Meta<typeof FloatingSidebar> = {
5
+ // Define the default export Sidebar Meta type including the component type
6
+ const meta: Meta<typeof Sidebar> = {
7
7
  title: "Navigation/FloatingSidebar",
8
- component: FloatingSidebar,
8
+ component: Sidebar,
9
9
  decorators: [
10
10
  (Story) => (
11
11
  <Box
@@ -28,11 +28,11 @@ const meta: Meta<typeof FloatingSidebar> = {
28
28
  };
29
29
 
30
30
  export default meta;
31
- type Story = StoryObj<typeof FloatingSidebar>;
31
+ type Story = StoryObj<typeof Sidebar>;
32
32
 
33
33
  // Primary story
34
34
  export const Primary: Story = {
35
- render: (args) => <FloatingSidebar {...args} />,
35
+ render: (args) => <Sidebar {...args} />,
36
36
  args: {
37
37
  menu: [
38
38
  { name: "Home", path: "/home", icon: Icons.DashBoardIcon },
@@ -1,6 +1,6 @@
1
1
  import { Box } from "@mui/material";
2
2
  import { Meta, StoryObj } from "@storybook/react";
3
- import { PageContent } from "../../components/Layout/PageContent/PageContent";
3
+
4
4
  import {
5
5
  TabsContainer,
6
6
  TabsContainerProps,
@@ -24,11 +24,7 @@ type Story = StoryObj<typeof TabsContainer>;
24
24
 
25
25
  // Primary story
26
26
  export const Primary: Story = {
27
- render: (args: TabsContainerProps) => (
28
- <PageContent sx={{ padding: "0px" }}>
29
- <TabsContainer {...args} />{" "}
30
- </PageContent>
31
- ),
27
+ render: (args: TabsContainerProps) => <TabsContainer {...args} />,
32
28
  args: {
33
29
  tabs: [
34
30
  {
@@ -1,159 +0,0 @@
1
- import AppsOutageIcon from "@mui/icons-material/AppsOutage";
2
- import { Box, IconButton, Link, Menu, Typography, styled } from "@mui/material";
3
- import { useState } from "react";
4
- import { applications } from "../../../utils/applications";
5
- import { institutionKey, urlTenantKey } from "../../../utils/constants";
6
- import { Icons } from "../../export";
7
-
8
- export const AppsMenu = ({ apps }: { apps: string[] }) => {
9
- const [anchorEl, setAnchorEl] = useState<any>(null);
10
- const open = Boolean(anchorEl);
11
- const applicationList = applications?.filter((item) =>
12
- apps.includes(item.key)
13
- );
14
-
15
- const handleClick = (event: any) => {
16
- setAnchorEl(event.currentTarget);
17
- };
18
-
19
- const handleClose = () => {
20
- setAnchorEl(null);
21
- };
22
-
23
- return (
24
- <>
25
- <StyledIconButton onClick={handleClick}>
26
- <Icons.AppsIcon />
27
- </StyledIconButton>
28
- <Menu
29
- transitionDuration={150}
30
- elevation={2}
31
- id="basic-menu"
32
- anchorEl={anchorEl}
33
- open={open}
34
- onClose={handleClose}
35
- anchorOrigin={{
36
- vertical: "bottom",
37
- horizontal: "left",
38
- }}
39
- transformOrigin={{
40
- vertical: "top",
41
- horizontal: "left",
42
- }}
43
- TransitionProps={{
44
- unmountOnExit: false,
45
- }}
46
- sx={{
47
- "& .MuiPaper-root": {
48
- "&>:last-child": {
49
- paddingBottom: "0px",
50
- },
51
- },
52
- }}
53
- >
54
- {applicationList.length !== 0 ? (
55
- <>
56
- <Box sx={{ padding: "0.3rem 1rem" }}>
57
- <Typography variant="body2">Switch to</Typography>
58
- </Box>
59
- <Box>
60
- {applicationList.map((item, index) => {
61
- return (
62
- <Link
63
- href={item.path + `/${urlTenantKey}/${institutionKey}`}
64
- key={index}
65
- >
66
- <StyledMenuItemContainer
67
- key={index}
68
- onClick={() => {
69
- window.location.href = item.path;
70
- handleClose();
71
- }}
72
- >
73
- <MenuItem item={item} />
74
- </StyledMenuItemContainer>
75
- </Link>
76
- );
77
- })}
78
- </Box>
79
- </>
80
- ) : (
81
- <StyledNoAppContainer>
82
- <AppsOutageIcon sx={{ width: "40px", height: "40px" }} />
83
- <Typography variant="body2">
84
- No Application have been assigned
85
- </Typography>
86
- </StyledNoAppContainer>
87
- )}
88
- </Menu>
89
- </>
90
- );
91
- };
92
-
93
- const MenuItem = ({ item }: any) => {
94
- return (
95
- <StyledMenuItem>
96
- <StyledImageBox>
97
- <img
98
- src={item.icon}
99
- style={{ width: "20px", height: "20px" }}
100
- alt="icon"
101
- />
102
- </StyledImageBox>
103
- <Box>
104
- <Typography variant="subtitle2">{item?.title}</Typography>
105
- <Typography variant="caption">{item?.description}</Typography>
106
- </Box>
107
- </StyledMenuItem>
108
- );
109
- };
110
-
111
- const StyledIconButton = styled(IconButton)(({ theme }) => ({
112
- padding: "18px",
113
- backgroundColor: "black",
114
- display: "flex",
115
- alignItems: "center",
116
- justifyContent: "center",
117
- borderRadius: "0px",
118
- height: "60px",
119
- width: "60px",
120
- border: `1px solid ${theme.palette.background.default}`,
121
- }));
122
-
123
- const StyledMenuItemContainer = styled(Box)(({ theme }) => ({
124
- cursor: "pointer",
125
- padding: "5px 0px",
126
- }));
127
-
128
- const StyledMenuItem = styled(Box)({
129
- height: "68px",
130
- width: "380px",
131
- padding: "40px 20px",
132
- transition: "background ease 0.3s",
133
- "&:hover": {
134
- background: "rgba(0, 0, 0, 0.03)",
135
- },
136
- display: "flex",
137
- alignItems: "center",
138
- gap: "20px",
139
- });
140
-
141
- const StyledImageBox = styled(Box)(() => ({
142
- height: "40px",
143
- width: "40px",
144
- boxShadow: "0px 5px 5px 0px rgba(48, 62, 99,0.1) ",
145
- display: "flex",
146
- alignItems: "center",
147
- justifyContent: "center",
148
- borderRadius: "5px",
149
- }));
150
-
151
- const StyledNoAppContainer = styled(Box)({
152
- width: "300px",
153
- height: "300px",
154
- display: "flex",
155
- alignItems: "center",
156
- flexDirection: "column",
157
- justifyContent: "center",
158
- gap: "10px",
159
- });
@@ -1,32 +0,0 @@
1
- import { Box, styled } from "@mui/material";
2
-
3
- export const StyledContainer = styled(Box)(({ theme }) => ({
4
- width: "100%",
5
- height: "calc(100vh - 120px)",
6
- overflowY: "auto",
7
- backgroundColor: theme.palette.background.paper,
8
- borderRadius: "5px",
9
- "&::-webkit-scrollbar": {
10
- width: "0.4em",
11
- height: "0.4em",
12
- },
13
- "&::-webkit-scrollbar-thumb": {
14
- backgroundColor: "rgba(0, 0, 0, 0.2)",
15
- borderRadius: "3px",
16
- },
17
- "@media (max-width: 1024px)": {
18
- marginLeft: 0,
19
- },
20
- padding: "20px",
21
- marginTop: "10px",
22
- }));
23
-
24
- export const PageContent = ({
25
- children,
26
- sx,
27
- }: {
28
- children: React.ReactNode;
29
- sx?: any;
30
- }) => {
31
- return <StyledContainer sx={sx}> {children}</StyledContainer>;
32
- };
@@ -1,26 +0,0 @@
1
- import { Meta, StoryObj } from "@storybook/react";
2
- import { PageContent } from "../../components/Layout/PageContent/PageContent";
3
-
4
- // Define the default export with Meta type including the component type
5
- const meta: Meta<typeof PageContent> = {
6
- title: "Layout/PageContent",
7
- component: PageContent,
8
- tags: ["autodocs"],
9
- argTypes: {
10
- children: {
11
- control: "object",
12
- description: "The content of the component",
13
- },
14
- },
15
- };
16
-
17
- export default meta;
18
- type Story = StoryObj<typeof PageContent>;
19
-
20
- // Primary story
21
- export const Primary: Story = {
22
- render: (args: any) => <PageContent {...args} />,
23
- args: {
24
- children: <>Tickets</>,
25
- },
26
- };