ContactPage.jsx 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. import * as React from 'react';
  2. import PropTypes from 'prop-types';
  3. import Tabs from '@mui/material/Tabs';
  4. import Tab from '@mui/material/Tab';
  5. import Typography from '@mui/material/Typography';
  6. import Box from '@mui/material/Box';
  7. import Header from "../components/Header";
  8. import Breadcrumbs from "../components/Breadcrumbs";
  9. import Footer from "../components/Footer";
  10. import {useState} from "react";
  11. import {Container, Grid, useMediaQuery} from "@mui/material";
  12. import FacebookIcon from "@mui/icons-material/Facebook";
  13. import InstagramIcon from "@mui/icons-material/Instagram";
  14. import TwitterIcon from "@mui/icons-material/Twitter";
  15. import YouTubeIcon from "@mui/icons-material/YouTube";
  16. import Social from "../components/SocialLink";
  17. import GoogleMap from "../components/GoogleMap";
  18. const defaultAddress = {
  19. 'NEW YORK': {
  20. phones: ['212-371-8500', '212-371-8555'],
  21. address: '9 East 40th Street, 3rd Floor, New York City',
  22. email: ['newyork@gmail.com'],
  23. "social networks": [
  24. {icon: FacebookIcon, url: 'https://www.facebook.com/'},
  25. {icon: InstagramIcon, url: 'https://www.instagram.com/'},
  26. {icon: TwitterIcon, url: 'https://twitter.com/home'},
  27. {icon: YouTubeIcon, url: 'https://www.youtube.com/'},
  28. ],
  29. coordinates: {
  30. lat: 40.751936,
  31. lng: -73.981081
  32. }
  33. },
  34. 'TOKYO':{
  35. phones: ['212-371-8500', '212-371-8555'],
  36. address: 'Япония, 〒162-0044 Tokyo, Shinjuku City, Kikuicho, 20−110 エヌエフ喜久井町',
  37. email: ['tokyo@gmail.com'],
  38. "social networks": [
  39. {icon: FacebookIcon, url: 'https://www.facebook.com/'},
  40. {icon: InstagramIcon, url: 'https://www.instagram.com/'},
  41. {icon: TwitterIcon, url: 'https://twitter.com/home'},
  42. {icon: YouTubeIcon, url: 'https://www.youtube.com/'},
  43. ],
  44. coordinates: {
  45. lat: 35.704015,
  46. lng: 139.721445
  47. }
  48. },
  49. 'LONDON':{
  50. phones: ['212-371-8500', '212-371-8555'],
  51. address: 'Randolph St, London NW1 0TL, Great Britain',
  52. email: ['london@gmail.com'],
  53. "social networks": [
  54. {icon: FacebookIcon, url: 'https://www.facebook.com/'},
  55. {icon: InstagramIcon, url: 'https://www.instagram.com/'},
  56. {icon: TwitterIcon, url: 'https://twitter.com/home'},
  57. {icon: YouTubeIcon, url: 'https://www.youtube.com/'},
  58. ],
  59. coordinates: {
  60. lat: 51.541663,
  61. lng: -0.136698
  62. }
  63. },
  64. 'PARIS':{
  65. phones: ['212-371-8500', '212-371-8555'],
  66. address: '22 Pass. Hébrard, 75010 Paris, France',
  67. email: ['paris@gmail.com'],
  68. "social networks": [
  69. {icon: FacebookIcon, url: 'https://www.facebook.com/'},
  70. {icon: InstagramIcon, url: 'https://www.instagram.com/'},
  71. {icon: TwitterIcon, url: 'https://twitter.com/home'},
  72. {icon: YouTubeIcon, url: 'https://www.youtube.com/'},
  73. ],
  74. coordinates: {
  75. lat: 48.873213,
  76. lng: 2.373185
  77. }
  78. },
  79. }
  80. function TabPanel(props) {
  81. const { children, value, index, ...other } = props;
  82. return (
  83. <div
  84. role="tabpanel"
  85. hidden={value !== index}
  86. id={`simple-tabpanel-${index}`}
  87. aria-labelledby={`simple-tab-${index}`}
  88. {...other}
  89. >
  90. {value === index && (
  91. <Box sx={{ p: 3 }}>
  92. <Typography>{children}</Typography>
  93. </Box>
  94. )}
  95. </div>
  96. );
  97. }
  98. TabPanel.propTypes = {
  99. children: PropTypes.node,
  100. index: PropTypes.number.isRequired,
  101. value: PropTypes.number.isRequired,
  102. };
  103. function a11yProps(index) {
  104. return {
  105. id: `simple-tab-${index}`,
  106. 'aria-controls': `simple-tabpanel-${index}`,
  107. };
  108. }
  109. const AddressItem = ({item}) => {
  110. return (
  111. <>
  112. <Grid padding='50px 40px !important' item xs={12} md={6}>
  113. <Typography
  114. variant="h5"
  115. letterSpacing="2px"
  116. marginBottom='40px'
  117. >
  118. {item[0].toString()}
  119. </Typography>
  120. <Grid color="#616161" container spacing={2}>
  121. <Grid marginBottom='30px' item xs={12} sm={6}>
  122. <Typography
  123. fontSize='13px'
  124. fontWeight='300'
  125. marginBottom='15px'
  126. >
  127. PHONES
  128. </Typography>
  129. {item[1].phones.map(i => <Typography lineHeight='1.7em' fontWeight='400' variant="body1">{i.toString()}</Typography>)}
  130. </Grid>
  131. <Grid marginBottom='30px' item xs={12} sm={6}>
  132. <Typography
  133. fontSize='13px'
  134. fontWeight='300'
  135. marginBottom='15px'
  136. >
  137. ADDRESS
  138. </Typography>
  139. <Typography lineHeight='1.7em' fontWeight='400' variant="body1">{item[1].address}</Typography>
  140. </Grid>
  141. <Grid marginBottom='30px' item xs={12} sm={6}>
  142. <Typography
  143. fontSize='13px'
  144. fontWeight='300'
  145. marginBottom='15px'
  146. >
  147. EMAIL
  148. </Typography>
  149. {item[1].email.map(i => <Typography lineHeight='1.7em' fontWeight='400' variant="body1">{i.toString()}</Typography>)}
  150. </Grid>
  151. <Grid marginBottom='30px' item xs={12} sm={6}>
  152. <Typography
  153. fontSize='13px'
  154. fontWeight='300'
  155. marginBottom='15px'
  156. >
  157. SOCIAL NETWORKS
  158. </Typography>
  159. {(item[1]["social networks"] || []).map(item =>
  160. <Social Icon={item.icon} link={item.url}/>
  161. )}
  162. </Grid>
  163. </Grid>
  164. </Grid>
  165. </>
  166. )
  167. }
  168. const Contact = ({address=defaultAddress}) => {
  169. const matches = useMediaQuery('(max-width:768px)');
  170. const matches2 = useMediaQuery('(max-width:420px)');
  171. const [value, setValue] = useState(0);
  172. const handleChange = (event, newValue) => {
  173. setValue(newValue);
  174. };
  175. return (
  176. <>
  177. <Header/>
  178. <Breadcrumbs links={['contact']}/>
  179. <main style={{backgroundColor: "#f3f3f3", padding: matches ? "20px 0" : "50px 0"}}>
  180. <Container maxWidth="lg">
  181. <Box sx={{ width: '100%' }}>
  182. <Box sx={{ color: "#616161" }}>
  183. <Tabs
  184. value={value}
  185. onChange={handleChange}
  186. aria-label="contact"
  187. textColor="inherit"
  188. variant={matches2 ? "scrollable" : "standard"}
  189. TabIndicatorProps={{style: {background:'#616161', height: '1px'}}}
  190. sx={{fontWeight: 300, marginBottom: '30px'}}
  191. centered
  192. >
  193. {Object.keys(address).map((value, index) => {
  194. return <Tab sx={{borderBottom: '1px solid #dedede'}} label={value.toString()} {...a11yProps(index)} />
  195. })}
  196. </Tabs>
  197. </Box>
  198. {Object.entries(address).map((item, index) => {
  199. return (
  200. <TabPanel value={value} index={index}>
  201. <Grid sx={{backgroundColor: '#fff', padding: '0px 0px', marginLeft: '-10px'}} container spacing={2}>
  202. <AddressItem key={index} item={item} />
  203. <Grid sx={{padding: '0px 0px !important', position: 'relative', height: matches ? '300px': '500px'}} item xs={12} md={6}>
  204. <GoogleMap lat={item[1].coordinates.lat} lng={item[1].coordinates.lng} key={index} />
  205. </Grid>
  206. </Grid>
  207. </TabPanel>
  208. )
  209. })}
  210. </Box>
  211. </Container>
  212. </main>
  213. <Footer/>
  214. </>
  215. )
  216. }
  217. export default Contact