From c472359655c9c04dd778004ad1c12703cebdddf4 Mon Sep 17 00:00:00 2001 From: mehditorabiv Date: Mon, 2 Sep 2024 09:17:23 +0300 Subject: [PATCH 1/2] implement breadcrumb --- .eslintrc.cjs | 1 + src/components/shared/CustomBreadcrumb.tsx | 59 ++++++++++++++++ .../Identifiers/Attestation/Attestation.tsx | 69 +++++++++++-------- 3 files changed, 100 insertions(+), 29 deletions(-) create mode 100644 src/components/shared/CustomBreadcrumb.tsx diff --git a/.eslintrc.cjs b/.eslintrc.cjs index bca81c5..e8e5fc7 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -51,5 +51,6 @@ module.exports = { 'react/function-component-definition': 'off', 'react-hooks/exhaustive-deps': 'off', 'react/prop-types': 'off', + 'react/jsx-props-no-spreading': 'off', }, }; diff --git a/src/components/shared/CustomBreadcrumb.tsx b/src/components/shared/CustomBreadcrumb.tsx new file mode 100644 index 0000000..dda4dbb --- /dev/null +++ b/src/components/shared/CustomBreadcrumb.tsx @@ -0,0 +1,59 @@ +import * as React from 'react'; +import { SvgIconComponent } from '@mui/icons-material'; +import Breadcrumbs, { BreadcrumbsProps } from '@mui/material/Breadcrumbs'; +import Link from '@mui/material/Link'; +import Typography from '@mui/material/Typography'; + +interface BreadcrumbItem { + label: string; + href?: string; + icon?: SvgIconComponent; +} + +interface CustomBreadcrumbProps extends BreadcrumbsProps { + breadcrumbs: BreadcrumbItem[]; +} + +const CustomBreadcrumb: React.FC = ({ + breadcrumbs, + ...props +}) => { + return ( +
+ + {breadcrumbs.map((breadcrumb) => + breadcrumb.href ? ( + + {breadcrumb.icon && ( + + )} + {breadcrumb.label} + + ) : ( + + {breadcrumb.icon && ( + + )} + {breadcrumb.label} + + ) + )} + +
+ ); +}; + +export default CustomBreadcrumb; diff --git a/src/pages/Identifiers/Attestation/Attestation.tsx b/src/pages/Identifiers/Attestation/Attestation.tsx index 887c96c..edfc67c 100644 --- a/src/pages/Identifiers/Attestation/Attestation.tsx +++ b/src/pages/Identifiers/Attestation/Attestation.tsx @@ -5,6 +5,7 @@ import { useParams } from 'react-router-dom'; import StepOne from '../../../components/pages/attestations/StepOne'; import StepThree from '../../../components/pages/attestations/StepThree'; import StepTwo from '../../../components/pages/attestations/StepTwo'; +import CustomBreadcrumb from '../../../components/shared/CustomBreadcrumb'; import CustomStepper from '../../../components/shared/CustomStepper'; import { Provider } from '../../../enums'; import { AttestPayload } from '../../../interfaces'; @@ -30,36 +31,46 @@ export default function Attestation() { handleNextStep(); }; + const breadcrumbs = [ + { label: 'Identifiers', href: '/identifiers' }, + { label: 'Attestation' }, + ]; + return ( - - - Link Your Social Media Accounts - Attest your social media accounts by linking them to your wallet - address. This allows you to prove ownership over these accounts. - - + <> + + + + Link Your Social Media Accounts + Attest your social media accounts by linking them to your wallet + address. This allows you to prove ownership over these accounts. + + - {activeStep === 0 && ( - - )} - {activeStep === 1 && ( - - )} - {activeStep === 2 && } - + {activeStep === 0 && ( + + )} + {activeStep === 1 && ( + + )} + {activeStep === 2 && ( + + )} + + ); } From bd3d21ed985823c0476a908c1c38c3f2bb4ea6b4 Mon Sep 17 00:00:00 2001 From: mehditorabiv Date: Mon, 2 Sep 2024 09:44:34 +0300 Subject: [PATCH 2/2] fix xColumns --- src/components/shared/CustomTable.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/shared/CustomTable.tsx b/src/components/shared/CustomTable.tsx index 79bf71e..3b32428 100644 --- a/src/components/shared/CustomTable.tsx +++ b/src/components/shared/CustomTable.tsx @@ -9,6 +9,9 @@ import { TableRow, Typography, } from '@mui/material'; +import { FaDiscord, FaGoogle } from 'react-icons/fa'; + +import { capitalize } from '../../utils/helper'; import AccessControlButton from './AccessControlButton'; @@ -64,8 +67,14 @@ const CustomTable: React.FC> = ({ {xcolumns.map((platform, index) => (
- {platform.provider[0].toUpperCase()} - {platform.provider} + + {platform.provider === 'discord' ? ( + + ) : ( + + )} + + {capitalize(platform.provider)}
))}