// ** React Imports import { ChangeEvent, useState } from 'react' // ** Next Import import Link from 'next/link' // ** MUI Imports import Box from '@mui/material/Box' import Grid from '@mui/material/Grid' import Button from '@mui/material/Button' import Divider from '@mui/material/Divider' import Typography from '@mui/material/Typography' import CardContent from '@mui/material/CardContent' import { Theme, useTheme } from '@mui/material/styles' import useMediaQuery from '@mui/material/useMediaQuery' // ** Type Imports import { CustomRadioBasicData, CustomRadioIconsData, CustomRadioIconsProps } from 'src/@core/components/custom-radio/types' // ** Custom Components Imports import CustomChip from 'src/@core/components/mui/chip' import CustomRadioBasic from 'src/@core/components/custom-radio/basic' import CustomRadioIcons from 'src/@core/components/custom-radio/icons' import Image from 'next/image' interface IconType { icon: CustomRadioIconsProps['icon'] iconProps: CustomRadioIconsProps['iconProps'] } const data: CustomRadioBasicData[] = [ { value: 'home', isSelected: true, title: 'John Doe (Default)', meta: , content: ( 4135 Parkway Street, Los Angeles, CA, 90017. Mobile : 1234567890 Cash / Card on delivery available `${theme.spacing(3, 0, 4)} !important` }} /> { e.preventDefault() e.stopPropagation() }} > Edit { e.preventDefault() e.stopPropagation() }} > Remove ) }, { value: 'office', title: 'ACME Inc.', meta: , content: ( 87 Hoffman Avenue, New York, NY, 10016. Mobile : 1234567890 Cash / Card on delivery available `${theme.spacing(3, 0, 4)} !important` }} /> { e.preventDefault() e.stopPropagation() }} > Edit { e.preventDefault() e.stopPropagation() }} > Remove ) } ] const dataIcons: CustomRadioIconsData[] = [ { isSelected: true, value: 'standard', title: 'Standard', content: ( <> Get your product in 1 Week. > ) }, { value: 'express', title: 'Express', content: ( <> Get your product in 3-4 days. > ) }, { value: 'overnight', title: 'Overnight', content: ( <> Get your product in 1 day. > ) } ] const StepAddress = ({ handleNext }: { handleNext: () => void }) => { const initialBasicSelected: string = data.filter(item => item.isSelected)[ data.filter(item => item.isSelected).length - 1 ].value const initialIconSelected: string = dataIcons.filter(item => item.isSelected)[ dataIcons.filter(item => item.isSelected).length - 1 ].value // ** States const [selectedIconRadio, setSelectedIconRadio] = useState(initialIconSelected) const [selectedBasicRadio, setSelectedBasicRadio] = useState(initialBasicSelected) // ** Hook const theme = useTheme() const breakpointMD = useMediaQuery((theme: Theme) => theme.breakpoints.between('sm', 'lg')) const icons: IconType[] = [ { icon: 'mdi:account-outline', iconProps: { fontSize: '2rem', style: { marginBottom: 4 }, color: theme.palette.text.secondary } }, { icon: 'mdi:crown-outline', iconProps: { fontSize: '2rem', style: { marginBottom: 4 }, color: theme.palette.text.secondary } }, { icon: 'mdi:rocket-launch-outline', iconProps: { fontSize: '2rem', style: { marginBottom: 4 }, color: theme.palette.text.secondary } } ] const handleBasicRadioChange = (prop: string | ChangeEvent) => { if (typeof prop === 'string') { setSelectedBasicRadio(prop) } else { setSelectedBasicRadio((prop.target as HTMLInputElement).value) } } const handleIconRadioChange = (prop: string | ChangeEvent) => { if (typeof prop === 'string') { setSelectedIconRadio(prop) } else { setSelectedIconRadio((prop.target as HTMLInputElement).value) } } return ( Select your preferable address {data.map((item, index) => ( ))} Add new address Choose Delivery Speed {dataIcons.map((item, index) => ( ))} `1px solid ${theme.palette.divider}` }}> Estimated Delivery Date Google - Google Home - White 18th Nov 2021 Apple iPhone 11 (64GB, Black) 20th Nov 2021 Price Details Order Total $1198.00 Delivery Charges $5.00 `${theme.spacing(3.5)} !important` }}> Total $1198.00 Place Order ) } export default StepAddress