Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/custom table #69

Merged
merged 2 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
};
59 changes: 59 additions & 0 deletions src/components/shared/CustomBreadcrumb.tsx
Original file line number Diff line number Diff line change
@@ -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<CustomBreadcrumbProps> = ({
breadcrumbs,
...props
}) => {
return (
<div role="presentation">
<Breadcrumbs aria-label="breadcrumb" separator=">" {...props}>
{breadcrumbs.map((breadcrumb) =>
breadcrumb.href ? (
<Link
key={breadcrumb.label}
underline="hover"
sx={{ display: 'flex', alignItems: 'center' }}
color="inherit"
href={breadcrumb.href}
>
{breadcrumb.icon && (
<breadcrumb.icon sx={{ mr: 0.5 }} fontSize="inherit" />
)}
{breadcrumb.label}
</Link>
) : (
<Typography
key={breadcrumb.label}
sx={{
color: 'text.primary',
display: 'flex',
alignItems: 'center',
}}
>
{breadcrumb.icon && (
<breadcrumb.icon sx={{ mr: 0.5 }} fontSize="inherit" />
)}
{breadcrumb.label}
</Typography>
)
)}
</Breadcrumbs>
</div>
);
};

export default CustomBreadcrumb;
13 changes: 11 additions & 2 deletions src/components/shared/CustomTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -64,8 +67,14 @@ const CustomTable: React.FC<CustomTableProps<AccessData>> = ({
{xcolumns.map((platform, index) => (
<TableCell key={index} align="center" sx={{ padding: 1 }}>
<div className="flex flex-row space-x-1.5 items-center justify-center">
<Avatar>{platform.provider[0].toUpperCase()}</Avatar>
<Typography>{platform.provider}</Typography>
<Avatar>
{platform.provider === 'discord' ? (
<FaDiscord size={24} />
) : (
<FaGoogle size={24} />
)}
</Avatar>
<Typography>{capitalize(platform.provider)}</Typography>
</div>
</TableCell>
))}
Expand Down
69 changes: 40 additions & 29 deletions src/pages/Identifiers/Attestation/Attestation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -30,36 +31,46 @@ export default function Attestation() {
handleNextStep();
};

const breadcrumbs = [
{ label: 'Identifiers', href: '/identifiers' },
{ label: 'Attestation' },
];

return (
<Paper
sx={{
height: 'calc(100vh - 100px)',
p: 2,
borderRadius: 4,
backgroundColor: 'white',
border: '1px solid rgba(0, 0, 0, 0.05)',
boxShadow: '0px 4px 4px rgba(0, 0, 0, 0.05)',
}}
variant="elevation"
elevation={0}
>
<Alert severity="info" sx={{ mb: 4 }}>
<AlertTitle>Link Your Social Media Accounts</AlertTitle>
Attest your social media accounts by linking them to your wallet
address. This allows you to prove ownership over these accounts.
</Alert>
<CustomStepper steps={steps} activeStep={activeStep} />
<>
<CustomBreadcrumb breadcrumbs={breadcrumbs} className="pb-3" />
<Paper
sx={{
height: 'calc(100vh - 140px)',
p: 2,
borderRadius: 4,
backgroundColor: 'white',
border: '1px solid rgba(0, 0, 0, 0.05)',
boxShadow: '0px 4px 4px rgba(0, 0, 0, 0.05)',
}}
variant="elevation"
elevation={0}
>
<Alert severity="info" sx={{ mb: 4 }}>
<AlertTitle>Link Your Social Media Accounts</AlertTitle>
Attest your social media accounts by linking them to your wallet
address. This allows you to prove ownership over these accounts.
</Alert>
<CustomStepper steps={steps} activeStep={activeStep} />

{activeStep === 0 && (
<StepOne provider={provider} handleNextStep={handleNextStep} />
)}
{activeStep === 1 && (
<StepTwo
provider={provider}
handlePrepareAttestation={handlePrepareAttestation}
/>
)}
{activeStep === 2 && <StepThree attestedSignutare={attestedSignutare} />}
</Paper>
{activeStep === 0 && (
<StepOne provider={provider} handleNextStep={handleNextStep} />
)}
{activeStep === 1 && (
<StepTwo
provider={provider}
handlePrepareAttestation={handlePrepareAttestation}
/>
)}
{activeStep === 2 && (
<StepThree attestedSignutare={attestedSignutare} />
)}
</Paper>
</>
);
}
Loading