Skip to content
Open
Changes from 1 commit
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
149 changes: 82 additions & 67 deletions src/pages/projects.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import { Container } from '@/components/Container';
import { Banner } from '@/components/Banner';
import { useRouter } from 'next/router';
import Image from 'next/image';
import projects from '@/helper/projects'
import projects from '@/helper/projects';
import Link from 'next/link';

function LinkIcon(props) {
return (
<svg viewBox="0 0 24 24" aria-hidden="true" {...props}>
Expand All @@ -22,77 +24,90 @@ function LinkIcon(props) {
)
}

// Define the Cards component here
const Cards = () => {
const router = useRouter();



return (
<Grid container spacing={4} sx={{ paddingTop: '40px', justifyContent: 'center' }}>
{projects.map((project, index) => (
<Grid item xs={12} sm={6} md={4} key={index}>
<MuiCard
className='dark:bg-[#2A2A2A] dark:border-white'
sx={{
height: 400,
borderRadius: 2,
border: '1px solid',
borderColor: '#3c982c',
boxShadow: '0px 4px 4px #00000040',
backdropFilter: 'blur(4px) brightness(100%)',
display: 'flex',
flexDirection: 'column',
}}
>
<CardContent sx={{ flexGrow: 1, textAlign: 'center' }}>
<Image
src={project.logo}
alt={`${project.title} image`}
width={80}
height={80}
style={{ margin: '0 auto 16px', objectFit: 'contain' }}
/>
<Typography
variant="h5"
className="mt-6 font-mono text-green-600 dark:text-yellow-400"
sx={{
fontFamily: 'Nunito-Bold',
color: '#3c982c',
textAlign: 'center',
}}
>
{project.name}
</Typography>
{projects.map((project, index) => {
const projectUrl = (project.link && project.link.url) ? project.link.url : '#';
const linkLabel = (project.link && project.link.label) ? project.link.label : 'View';

<Typography
variant="body1"
className="text-zinc-600 dark:text-zinc-400 text-lg font-mono leading-7 text-center"
sx={{
fontFamily: 'Nunito-Light',
color: 'black',
mt: 2,
overflow: 'hidden',
textOverflow: 'ellipsis',
display: '-webkit-box',
WebkitBoxOrient: 'vertical',
WebkitLineClamp: 4,
}}
>
{project.description}
</Typography>
</CardContent>
<CardActions sx={{ justifyContent: 'center' }}>
<p className="relative z-10 mt-6 flex text-md font-semibold font-mono text-zinc-600 transition group-hover:text-[#00843D] dark:group-hover:text-yellow-400 dark:text-zinc-200">
<LinkIcon className="h-6 w-6 flex-none scale-110" />
<span className="ml-2">{project.link.label}</span>
</p>
</CardActions>
</MuiCard>
</Grid>
))
}
</Grid >
return (
<Grid item xs={12} sm={6} md={4} key={index}>
<Link href={projectUrl} passHref legacyBehavior>
<a target="_blank" rel="noopener noreferrer" style={{ textDecoration: 'none', display: 'block', height: '100%' }}>
<MuiCard
className='dark:bg-[#2A2A2A] dark:border-white group'
sx={{
height: 400,
borderRadius: 2,
border: '1px solid',
borderColor: '#3c982c',
boxShadow: '0px 4px 4px #00000040',
backdropFilter: 'blur(4px) brightness(100%)',
display: 'flex',
flexDirection: 'column',
transition: 'all 0.3s ease-in-out',
cursor: 'pointer',
':hover': {
transform: 'translateY(-8px)',
boxShadow: '0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)',
borderColor: '#facc15',
backgroundColor: '#FEFCE8',
}
}}
>
<CardContent sx={{ flexGrow: 1, textAlign: 'center' }}>
<Image
src={project.logo}
alt={`${project.title} image`}
width={80}
height={80}
style={{ margin: '0 auto 16px', objectFit: 'contain' }}
/>
Comment on lines 71 to 78
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Fix incorrect property in alt text.

Line 64 uses project.title for the alt text, but the project data structure uses project.name. This will result in alt text like "undefined image", breaking accessibility for screen readers.

🔎 Proposed fix
                    <Image
                      src={project.logo}
-                      alt={`${project.title} image`}
+                      alt={`${project.name} logo`}
                      width={80}
                      height={80}
                      style={{ margin: '0 auto 16px', objectFit: 'contain' }}
                    />

Note: Changed "image" to "logo" for more accurate description.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<Image
src={project.logo}
alt={`${project.title} image`}
width={80}
height={80}
style={{ margin: '0 auto 16px', objectFit: 'contain' }}
/>
<Image
src={project.logo}
alt={`${project.name} logo`}
width={80}
height={80}
style={{ margin: '0 auto 16px', objectFit: 'contain' }}
/>
🤖 Prompt for AI Agents
In src/pages/projects.jsx around lines 62 to 68, the Image alt prop uses
project.title which doesn't exist on the project object; replace it with
project.name and update the description from "image" to "logo" so the alt reads
`${project.name} logo`, ensuring correct accessibility text.

<Typography
variant="h5"
className="mt-6 font-mono text-green-600 dark:text-yellow-400"
sx={{
fontFamily: 'Nunito-Bold',
color: '#3c982c',
textAlign: 'center',
}}
>
{project.name}
</Typography>

<Typography
variant="body1"
className="text-zinc-600 dark:text-zinc-400 text-lg font-mono leading-7 text-center"
sx={{
fontFamily: 'Nunito-Light',
color: 'black',
mt: 2,
overflow: 'hidden',
textOverflow: 'ellipsis',
display: '-webkit-box',
WebkitBoxOrient: 'vertical',
WebkitLineClamp: 4,
}}
>
{project.description}
</Typography>
</CardContent>
<CardActions sx={{ justifyContent: 'center' }}>
<p className="relative z-10 mt-6 flex text-md font-semibold font-mono text-zinc-600 transition-colors group-hover:text-[#00843D] dark:group-hover:text-yellow-400 dark:text-zinc-200">
<LinkIcon className="h-6 w-6 flex-none scale-110" />
<span className="ml-2">{linkLabel}</span>
</p>
</CardActions>
</MuiCard>
</a>
</Link>
</Grid>
);
})}
</Grid>
);
};

Expand Down Expand Up @@ -152,4 +167,4 @@ export default function Projects() {
</div>
</>
);
}
}