// react-routers components import Link from "next/link" // @mui material components import Card from "@mui/material/Card" import Divider from "@mui/material/Divider" import Tooltip from "@mui/material/Tooltip" import Icon from "@mui/material/Icon" // ThreeD Garden components import MDBox from "~/components/mui/MDBox" import MDTypography from "~/components/mui/MDTypography" // ThreeD Garden Base Styles import colors from "~/themes/theme-light/base/colors" import typography from "~/themes/theme-light/base/typography" // Declaring props types for ProfileInfoCard interface Props { title: string description: string info: { [key: string]: string } social: { [key: string]: any }[] action: { route: string tooltip: string } shadow?: boolean [key: string]: any } function ProfileInfoCard({ title, description, info, social, action, shadow, }: Props): JSX.Element { const labels: string[] = [] const values: string[] = [] const { socialMediaColors } = colors const { size } = typography // Convert this form `objectKey` of the object key in to this `object key` Object.keys(info).forEach((el) => { if (el.match(/[A-Z\s]+/)) { const uppercaseLetter = Array.from(el).find((i) => i.match(/[A-Z]+/)) const newElement = el.replace( uppercaseLetter, ` ${uppercaseLetter.toLowerCase()}` ) labels.push(newElement) } else { labels.push(el) } }) // Push the object values into the values array Object.values(info).forEach((el) => values.push(el)) // Render the card info items const renderItems = labels.map((label, key) => ( {label}:    {values[key]} )) // Render the card social media icons const renderSocial = social.map(({ link, icon, color }) => ( {icon} )) return ( {title} edit {description} {renderItems} social:   {renderSocial} ) } // Declaring default props for ProfileInfoCard ProfileInfoCard.defaultProps = { shadow: true, } export default ProfileInfoCard