Register page: coloured account-type cards with hover and arrow

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Samer Salameh 2026-11-12 15:33:56 +03:00
parent 25c79c4740
commit e41bcfa279
1 changed files with 43 additions and 21 deletions

View File

@ -1,6 +1,8 @@
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { Box, Card, CardActionArea, CardContent, Stack, Typography } from '@mui/material'; import { Avatar, Box, Card, CardActionArea, CardContent, Stack, Typography } from '@mui/material';
import { alpha } from '@mui/material/styles';
import ArrowForward from '@mui/icons-material/ArrowForward';
import ArrowBack from '@mui/icons-material/ArrowBack'; import ArrowBack from '@mui/icons-material/ArrowBack';
import BusinessOutlined from '@mui/icons-material/BusinessOutlined'; import BusinessOutlined from '@mui/icons-material/BusinessOutlined';
import BusinessCenterOutlined from '@mui/icons-material/BusinessCenterOutlined'; import BusinessCenterOutlined from '@mui/icons-material/BusinessCenterOutlined';
@ -13,12 +15,12 @@ import { Logo } from '../../components/Logo';
import { OtpDialog } from './OtpDialog'; import { OtpDialog } from './OtpDialog';
import type { OtpEntity } from '../../api/register'; import type { OtpEntity } from '../../api/register';
const CARDS: { entity: string; icon: typeof BusinessOutlined; desc: 'registerCompaniesDesc' | 'registerInvestorsDesc' | 'registerOtherStakeholdersDesc' | 'registerOwnersDesc' | 'registerFreezoneDesc'; otp?: boolean }[] = [ const CARDS: { entity: string; tint: string; icon: typeof BusinessOutlined; desc: 'registerCompaniesDesc' | 'registerInvestorsDesc' | 'registerOtherStakeholdersDesc' | 'registerOwnersDesc' | 'registerFreezoneDesc'; otp?: boolean }[] = [
{ entity: 'COMPANIES', icon: BusinessOutlined, desc: 'registerCompaniesDesc' }, { entity: 'COMPANIES', tint: '#2c98d4', icon: BusinessOutlined, desc: 'registerCompaniesDesc' },
{ entity: 'INVESTORS', icon: BusinessCenterOutlined, desc: 'registerInvestorsDesc' }, { entity: 'INVESTORS', tint: '#2e9e6b', icon: BusinessCenterOutlined, desc: 'registerInvestorsDesc' },
{ entity: 'OTHER_STAKEHOLDERS', icon: GroupsOutlined, desc: 'registerOtherStakeholdersDesc' }, { entity: 'OTHER_STAKEHOLDERS', tint: '#8a6fd1', icon: GroupsOutlined, desc: 'registerOtherStakeholdersDesc' },
{ entity: 'OWNERS', icon: PersonOutline, desc: 'registerOwnersDesc', otp: true }, { entity: 'OWNERS', tint: '#d9a441', icon: PersonOutline, desc: 'registerOwnersDesc', otp: true },
{ entity: 'FREEZONE_CLEARING_COMPANIES', icon: LocalShippingOutlined, desc: 'registerFreezoneDesc', otp: true }, { entity: 'FREEZONE_CLEARING_COMPANIES', tint: '#d9627a', icon: LocalShippingOutlined, desc: 'registerFreezoneDesc', otp: true },
]; ];
export function RegisterHub() { export function RegisterHub() {
@ -39,7 +41,14 @@ export function RegisterHub() {
}; };
return ( return (
<Box sx={{ minHeight: '100vh', bgcolor: 'background.default', py: { xs: 3, md: 6 }, px: 2 }}> <Box
sx={{
minHeight: '100vh',
bgcolor: 'background.default',
py: { xs: 3, md: 6 },
px: 2,
backgroundImage: (th) => `radial-gradient(circle at 85% -10%, ${alpha(th.palette.primary.main, 0.1)}, transparent 45%)`,
}}>
<Box sx={{ maxWidth: 980, mx: 'auto' }}> <Box sx={{ maxWidth: 980, mx: 'auto' }}>
<Stack <Stack
direction="row" direction="row"
@ -82,20 +91,33 @@ export function RegisterHub() {
maxWidth: 640 maxWidth: 640
}}>{ui('registerHubSubtitle')}</Typography> }}>{ui('registerHubSubtitle')}</Typography>
<Box sx={{ display: 'grid', gap: 2, gridTemplateColumns: { xs: '1fr', sm: 'repeat(2, 1fr)', md: 'repeat(3, 1fr)' } }}> <Box sx={{ display: 'grid', gap: 2.5, gridTemplateColumns: { xs: '1fr', sm: 'repeat(2, 1fr)', md: 'repeat(3, 1fr)' } }}>
{CARDS.map(({ entity, icon: Icon, desc, otp }) => ( {CARDS.map(({ entity, tint, icon: Icon, desc, otp }) => (
<Card key={entity} variant="outlined" sx={{ borderRadius: 3 }}> <Card
<CardActionArea onClick={() => pick(entity, otp)} sx={{ height: '100%', p: 0.5 }}> key={entity}
<CardContent> variant="outlined"
<Icon color="primary" sx={{ fontSize: 34, mb: 1.5 }} />
<Typography
sx={{ sx={{
fontWeight: 700, borderRadius: 4,
mb: 0.5 position: 'relative',
}}>{t(entity)}</Typography> overflow: 'hidden',
<Typography variant="body2" sx={{ borderTop: `4px solid ${tint}`,
color: "text.secondary" transition: 'transform .18s, box-shadow .18s, border-color .18s',
}}>{ui(desc)}</Typography> '&:hover': { transform: 'translateY(-4px)', boxShadow: `0 10px 28px ${alpha(tint, 0.25)}`, borderColor: tint },
'&:hover .go': { opacity: 1 },
}}>
{/* a large faint copy of the icon behind the text, like the dashboard cards */}
<Icon sx={{ position: 'absolute', insetInlineStart: -18, bottom: -22, fontSize: 120, color: tint, opacity: 0.08, pointerEvents: 'none' }} />
<CardActionArea onClick={() => pick(entity, otp)} sx={{ height: '100%', p: 0.5 }}>
<CardContent sx={{ position: 'relative' }}>
<Avatar sx={{ bgcolor: alpha(tint, 0.14), color: tint, width: 54, height: 54, mb: 2 }}>
<Icon sx={{ fontSize: 30 }} />
</Avatar>
<Typography sx={{ fontWeight: 800, fontSize: 17, mb: 0.75 }}>{t(entity)}</Typography>
<Typography variant="body2" sx={{ color: 'text.secondary', minHeight: 44 }}>{ui(desc)}</Typography>
<ArrowForward
className="go"
sx={(th) => ({ mt: 1.5, color: tint, opacity: 0.45, transition: 'opacity .18s', transform: th.direction === 'rtl' ? 'scaleX(-1)' : 'none' })}
/>
</CardContent> </CardContent>
</CardActionArea> </CardActionArea>
</Card> </Card>