Browse Source

styles: design update

master
Amit Roy 6 months ago
parent
commit
f3eda25d02
7 changed files with 87 additions and 16 deletions
  1. +1
    -1
      src/app/(dashboard)/home/page.tsx
  2. +3
    -0
      src/app/globals.scss
  3. +1
    -1
      src/components/reviewModal/ReviewModal.tsx
  4. +46
    -1
      src/components/table/TanStackTable.module.scss
  5. +31
    -6
      src/components/table/TanStackTable.tsx
  6. +2
    -2
      src/components/titleHeader/titleHeader.tsx
  7. +3
    -5
      src/components/wrapper/dashboardWrapper.tsx

+ 1
- 1
src/app/(dashboard)/home/page.tsx View File

@ -15,7 +15,7 @@ const HomePage = async () => {
sx={{ boxShadow: "none", borderRadius: "12px", marginBlockStart: 2 }} sx={{ boxShadow: "none", borderRadius: "12px", marginBlockStart: 2 }}
> >
<CardHeader <CardHeader
title="Projects"
title="Products"
fontWeight={"bold"} fontWeight={"bold"}
sx={{ borderBlockEnd: "1px solid var(--primary_light)" }} sx={{ borderBlockEnd: "1px solid var(--primary_light)" }}
/> />


+ 3
- 0
src/app/globals.scss View File

@ -31,6 +31,9 @@
--input-border-default: #e0e3e7; --input-border-default: #e0e3e7;
--input-border-hover: #b2bac2; --input-border-hover: #b2bac2;
--clr_table_border: #eeeeee;
--clr_table_cell_border: #e0e0e0;
--dashboard-bg: #eef2f6; /* #EEF2F6 */ --dashboard-bg: #eef2f6; /* #EEF2F6 */
// ========== Font Family ========== // ========== Font Family ==========


+ 1
- 1
src/components/reviewModal/ReviewModal.tsx View File

@ -73,7 +73,7 @@ const ReviewModal = ({
<Stack <Stack
spacing={2} spacing={2}
direction={"column"} direction={"column"}
sx={{ maxHeight: "350px", overflow: "auto" }}
sx={{ maxHeight: "370px", overflow: "auto" }}
> >
{reviewModalData.map((review: ReviewModalData, index: number) => ( {reviewModalData.map((review: ReviewModalData, index: number) => (
<ReviewModalContent key={index} data={review} /> <ReviewModalContent key={index} data={review} />


+ 46
- 1
src/components/table/TanStackTable.module.scss View File

@ -1,15 +1,51 @@
@use "@/theme/sass/helper" as *; @use "@/theme/sass/helper" as *;
.sort {
@include displayFlex(row, center, flex-start);
gap: rem(4);
}
.clamp_2 {
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.responsive_table { .responsive_table {
width: 100%; width: 100%;
max-height: rem(400);
overflow: auto;
border: 1px solid var(--clr_table_border);
.table { .table {
width: 100%; width: 100%;
border-collapse: collapse;
thead { thead {
tr { tr {
th { th {
text-align: start; text-align: start;
padding-inline: rem(10); padding-inline: rem(10);
padding-block: rem(4); padding-block: rem(4);
min-height: rem(40);
height: rem(40);
cursor: pointer;
color: var(--primary_text_clr);
font-weight: var(--fw_medium);
min-width: rem(100);
border-bottom: 1px solid var(--clr_table_cell_border);
background: var(--bg_white);
position: sticky;
z-index: 1;
top: 0;
&:first-child {
min-width: max-content;
}
&:last-child {
min-width: max-content;
text-align: center;
}
&:nth-of-type(6),
&:nth-of-type(2),
&:nth-of-type(3) {
min-width: rem(152);
}
} }
} }
} }
@ -20,6 +56,15 @@
padding-inline: rem(10); padding-inline: rem(10);
padding-block: rem(4); padding-block: rem(4);
min-height: rem(40); min-height: rem(40);
border-bottom: 1px solid var(--clr_table_cell_border);
border-right: 1px solid var(--clr_table_cell_border);
&:last-child {
text-align: center;
border-right: none;
}
}
&:nth-of-type(odd) {
background: var(--clr_gray_100);
} }
} }
} }


+ 31
- 6
src/components/table/TanStackTable.tsx View File

@ -5,10 +5,16 @@ import {
getCoreRowModel, getCoreRowModel,
flexRender, flexRender,
} from "@tanstack/react-table"; } from "@tanstack/react-table";
import global from "../../../src/theme/global/global.module.scss";
import global from "/src/theme/global/global.module.scss";
import styles from "./TanStackTable.module.scss"; import styles from "./TanStackTable.module.scss";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import ReviewModal from "../reviewModal/ReviewModal"; import ReviewModal from "../reviewModal/ReviewModal";
import ArrowDropUpIcon from "@mui/icons-material/ArrowDropUp";
import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
import HeightIcon from "@mui/icons-material/Height";
import RemoveRedEyeIcon from "@mui/icons-material/RemoveRedEye";
import { IconButton, Tooltip } from "@mui/material";
import { grey } from "@mui/material/colors";
const TanStackTable = ({ data }: any) => { const TanStackTable = ({ data }: any) => {
const [tableData, setTableData] = useState([]); const [tableData, setTableData] = useState([]);
@ -34,8 +40,15 @@ const TanStackTable = ({ data }: any) => {
const columns: any = [ const columns: any = [
{ {
header: ( header: (
<div onClick={() => handleSort("id")}>
ID {sortOrder === "asc" ? "↑" : sortOrder === "desc" ? "↓" : ""}
<div className={styles.sort} onClick={() => handleSort("id")}>
ID{" "}
{sortOrder === "asc" ? (
<ArrowDropUpIcon sx={{ color: grey[300] }} />
) : sortOrder === "desc" ? (
<ArrowDropDownIcon sx={{ color: grey[300] }} />
) : (
<HeightIcon sx={{ color: grey[300] }} />
)}
</div> </div>
), ),
accessorKey: "id", accessorKey: "id",
@ -47,6 +60,13 @@ const TanStackTable = ({ data }: any) => {
{ {
header: "Description", header: "Description",
accessorKey: "description", accessorKey: "description",
cell: ({ row }: any) => (
<>
<Tooltip title={row.original.description}>
<p className={styles.clamp_2}>{row.original.description}</p>
</Tooltip>
</>
),
}, },
{ {
header: "Category", header: "Category",
@ -82,9 +102,14 @@ const TanStackTable = ({ data }: any) => {
cell: ({ row }: any) => ( cell: ({ row }: any) => (
<> <>
{/* {row.original.reviews.length} Reviews */} {/* {row.original.reviews.length} Reviews */}
<button onClick={() => handleButtonClick(row.original)}>
View Reviews ({row.original.reviews.length})
</button>
<IconButton
aria-label="log out"
size="medium"
color="primary"
onClick={() => handleButtonClick(row.original)}
>
<RemoveRedEyeIcon fontSize="small" />
</IconButton>
</> </>
), ),
}, },


+ 2
- 2
src/components/titleHeader/titleHeader.tsx View File

@ -26,7 +26,7 @@ const TitleHeader = () => {
}} }}
> >
<Typography variant="h6" color="text.primary" fontWeight={"bold"}> <Typography variant="h6" color="text.primary" fontWeight={"bold"}>
Projects
Products
</Typography> </Typography>
<Breadcrumbs aria-label="breadcrumb"> <Breadcrumbs aria-label="breadcrumb">
<Link <Link
@ -51,7 +51,7 @@ const TitleHeader = () => {
color="inherit" color="inherit"
href="/material-ui/getting-started/installation/" href="/material-ui/getting-started/installation/"
> >
Project Table
Product Table
</Link> </Link>
</Breadcrumbs> </Breadcrumbs>
</CardContent> </CardContent>


+ 3
- 5
src/components/wrapper/dashboardWrapper.tsx View File

@ -103,7 +103,7 @@ export default function DashboardWrapper(props: Props) {
</Toolbar> </Toolbar>
{/* <Divider /> */} {/* <Divider /> */}
<CssList sx={{ padding: "0", paddingInline: "18px" }}> <CssList sx={{ padding: "0", paddingInline: "18px" }}>
{["Project Table"].map((text, index) => (
{["Product Table"].map((text, index) => (
<ListItem <ListItem
key={text} key={text}
disablePadding disablePadding
@ -151,9 +151,7 @@ export default function DashboardWrapper(props: Props) {
> >
<MenuIcon /> <MenuIcon />
</IconButton> </IconButton>
<Typography variant="h6" noWrap component="div">
Responsive drawer
</Typography>
<Typography variant="h6" noWrap component="div"></Typography>
</Box> </Box>
<Box display={"flex"} alignItems={"center"} gap={1}> <Box display={"flex"} alignItems={"center"} gap={1}>
<Box <Box
@ -236,7 +234,7 @@ export default function DashboardWrapper(props: Props) {
sx={{ sx={{
flexGrow: 1, flexGrow: 1,
p: 3, p: 3,
width: { md: `calc(100% - ${drawerWidth}px)` },
width: { xs: "100%", md: `calc(100% - ${drawerWidth}px)` },
}} }}
> >
<Toolbar /> <Toolbar />


Loading…
Cancel
Save