Refactor project data structure, add internationalization support, and enhance UI components
- Updated project data files to improve formatting and consistency. - Introduced language support with English and Dutch translations. - Implemented language switcher and dark mode toggle in the header and footer. - Enhanced navigation components to utilize internationalized strings. - Refactored layout components to use Grid2 for better responsiveness. - Improved accessibility and usability across various components.
This commit is contained in:
@@ -1,37 +1,48 @@
|
||||
import React from "react";
|
||||
import {
|
||||
Accordion,
|
||||
AccordionSummary,
|
||||
AccordionDetails,
|
||||
Typography,
|
||||
Accordion,
|
||||
AccordionSummary,
|
||||
AccordionDetails,
|
||||
Typography,
|
||||
} from "@mui/material";
|
||||
|
||||
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
|
||||
|
||||
const BlogAccordion = ({ blogContent }) => {
|
||||
return blogContent.map(({ title, description }) => (
|
||||
<Accordion
|
||||
// defaultExpanded
|
||||
// slotProps={{ unmountOnExit: true }}
|
||||
key={title}
|
||||
sx={{ background: "transparent" }}
|
||||
>
|
||||
<AccordionSummary
|
||||
expandIcon={<ExpandMoreIcon />}
|
||||
aria-controls="panel1a-content"
|
||||
id="panel1a-header"
|
||||
>
|
||||
<Typography variant="h5">{title}</Typography>
|
||||
</AccordionSummary>
|
||||
<AccordionDetails>
|
||||
{description.map((lineContent, idx) => (
|
||||
<Typography key={idx} paragraph>
|
||||
{lineContent}
|
||||
</Typography>
|
||||
))}
|
||||
</AccordionDetails>
|
||||
</Accordion>
|
||||
));
|
||||
// normalize blogContent to an array to avoid `map` errors
|
||||
const items = Array.isArray(blogContent)
|
||||
? blogContent
|
||||
: blogContent
|
||||
? [blogContent]
|
||||
: [];
|
||||
|
||||
if (items.length === 0) return null;
|
||||
|
||||
return items.map(({ title, description }, itemIdx) => {
|
||||
const lines = Array.isArray(description)
|
||||
? description
|
||||
: description
|
||||
? [description]
|
||||
: [];
|
||||
|
||||
return (
|
||||
<Accordion key={title ?? itemIdx}>
|
||||
<AccordionSummary
|
||||
expandIcon={<ExpandMoreIcon />}
|
||||
aria-controls={`panel-${itemIdx}-content`}
|
||||
id={`panel-${itemIdx}-header`}>
|
||||
<Typography variant="h5">{title}</Typography>
|
||||
</AccordionSummary>
|
||||
<AccordionDetails>
|
||||
{lines.map((lineContent, idx) => (
|
||||
<Typography key={`${itemIdx}-${idx}`} paragraph>
|
||||
{lineContent}
|
||||
</Typography>
|
||||
))}
|
||||
</AccordionDetails>
|
||||
</Accordion>
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export default BlogAccordion;
|
||||
|
||||
Reference in New Issue
Block a user