Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 

323 рядки
6.9 KiB

  1. /** @jsxRuntime classic */
  2. /** @jsx jsx */
  3. import { useRef, useState, useEffect } from 'react';
  4. import { jsx, Box, Container, Image } from 'theme-ui';
  5. import SwiperCore, { Navigation, Pagination } from 'swiper';
  6. import { Swiper, SwiperSlide } from 'swiper/react';
  7. import SectionHeading from 'components/section-heading';
  8. import TeamMember from 'components/cards/team-member';
  9. import avatar1 from 'assets/images/team/member1.png';
  10. import avatar2 from 'assets/images/team/member2.png';
  11. import avatar3 from 'assets/images/team/member3.png';
  12. import avatar4 from 'assets/images/team/member4.png';
  13. import arrowRight from 'assets/images/icons/arrow-right.png';
  14. SwiperCore.use([Navigation, Pagination]);
  15. const data = [
  16. {
  17. id: 1,
  18. avatar: avatar1,
  19. name: 'Emmalee Mclain',
  20. designation: 'Product Designer',
  21. socialLinks: [
  22. {
  23. name: 'twitter',
  24. link: 'http://twitter.com',
  25. },
  26. {
  27. name: 'github',
  28. link: 'http://github.com',
  29. },
  30. {
  31. name: 'dribbble',
  32. link: 'http://dribbble.com',
  33. },
  34. ],
  35. },
  36. {
  37. id: 2,
  38. avatar: avatar2,
  39. name: 'Daisy Morgan',
  40. designation: 'Lead developer',
  41. socialLinks: [
  42. {
  43. name: 'twitter',
  44. link: 'http://twitter.com',
  45. },
  46. {
  47. name: 'dribbble',
  48. link: 'http://dribbble.com',
  49. },
  50. ],
  51. },
  52. {
  53. id: 3,
  54. avatar: avatar3,
  55. name: 'Ariyanna Hicks',
  56. designation: 'Experience Designer',
  57. socialLinks: [
  58. {
  59. name: 'twitter',
  60. link: 'http://twitter.com',
  61. },
  62. {
  63. name: 'github',
  64. link: 'http://github.com',
  65. },
  66. ],
  67. },
  68. {
  69. id: 4,
  70. avatar: avatar4,
  71. name: 'Yamilet Hooker',
  72. designation: 'User interface designer',
  73. socialLinks: [
  74. {
  75. name: 'twitter',
  76. link: 'http://twitter.com',
  77. },
  78. {
  79. name: 'github',
  80. link: 'http://github.com',
  81. },
  82. {
  83. name: 'dribbble',
  84. link: 'http://dribbble.com',
  85. },
  86. ],
  87. },
  88. {
  89. id: 5,
  90. avatar: avatar1,
  91. name: 'Emmalee Mclain',
  92. designation: 'Product Designer',
  93. socialLinks: [
  94. {
  95. name: 'twitter',
  96. link: 'http://twitter.com',
  97. },
  98. {
  99. name: 'github',
  100. link: 'http://github.com',
  101. },
  102. {
  103. name: 'dribbble',
  104. link: 'http://dribbble.com',
  105. },
  106. ],
  107. },
  108. {
  109. id: 6,
  110. avatar: avatar2,
  111. name: 'Daisy Morgan',
  112. designation: 'Lead developer',
  113. socialLinks: [
  114. {
  115. name: 'twitter',
  116. link: 'http://twitter.com',
  117. },
  118. {
  119. name: 'dribbble',
  120. link: 'http://dribbble.com',
  121. },
  122. ],
  123. },
  124. {
  125. id: 7,
  126. avatar: avatar3,
  127. name: 'Ariyanna Hicks',
  128. designation: 'Experience Designer',
  129. socialLinks: [
  130. {
  131. name: 'twitter',
  132. link: 'http://twitter.com',
  133. },
  134. {
  135. name: 'github',
  136. link: 'http://github.com',
  137. },
  138. ],
  139. },
  140. {
  141. id: 8,
  142. avatar: avatar4,
  143. name: 'Yamilet Hooker',
  144. designation: 'User interface designer',
  145. socialLinks: [
  146. {
  147. name: 'twitter',
  148. link: 'http://twitter.com',
  149. },
  150. {
  151. name: 'github',
  152. link: 'http://github.com',
  153. },
  154. {
  155. name: 'dribbble',
  156. link: 'http://dribbble.com',
  157. },
  158. ],
  159. },
  160. ];
  161. const OurTeam = () => {
  162. const swiperRef = useRef(null);
  163. const containerRef = useRef(null);
  164. const [currentIndex, setCurrentIndex] = useState(0);
  165. const [containerOffset, setContainerOffset] = useState({
  166. left: null,
  167. top: null,
  168. });
  169. const isEnd = swiperRef?.current?.swiper?.isEnd;
  170. const handlePrev = () => {
  171. swiperRef?.current?.swiper?.slidePrev();
  172. setInterval(() => {
  173. setCurrentIndex(swiperRef?.current?.swiper?.activeIndex);
  174. }, 100);
  175. clearInterval();
  176. };
  177. const handleNext = () => {
  178. swiperRef?.current?.swiper?.slideNext();
  179. setInterval(() => {
  180. setCurrentIndex(swiperRef?.current?.swiper?.activeIndex);
  181. }, 100);
  182. clearInterval();
  183. };
  184. useEffect(() => {
  185. setContainerOffset({
  186. left: containerRef.current.offsetLeft,
  187. top: containerRef.current.offsetTop,
  188. });
  189. }, [containerRef]);
  190. const breakpoints = {
  191. 0: {
  192. slidesPerView: 1,
  193. spaceBetween: 0,
  194. },
  195. 768: {
  196. slidesPerView: 3,
  197. spaceBetween: 30,
  198. },
  199. 1024: {
  200. slidesPerView: 4,
  201. spaceBetween: 30,
  202. },
  203. 1601: {
  204. slidesPerView: 5,
  205. spaceBetween: 30,
  206. },
  207. };
  208. return (
  209. <Box as="section" id="team" sx={styles.section}>
  210. <Container ref={containerRef}>
  211. <SectionHeading
  212. sx={styles.heading}
  213. title="Thamrin Group Founder"
  214. // description="Build an incredible workplace and grow your business with Gusto’s all-in-one platform with amazing contents."
  215. />
  216. </Container>
  217. <Box
  218. sx={{
  219. ml: currentIndex === 0 ? containerOffset?.left : 0,
  220. ...styles.teamWrapper,
  221. }}
  222. >
  223. {currentIndex !== 0 && (
  224. <button
  225. onClick={handlePrev}
  226. className="swiper-arrow swiper-arrow-left"
  227. >
  228. <Image src={arrowRight} alt="arrow left" />
  229. </button>
  230. )}
  231. {!isEnd && (
  232. <button
  233. className="swiper-arrow swiper-arrow-right"
  234. onClick={handleNext}
  235. >
  236. <Image src={arrowRight} alt="arrow right" />
  237. </button>
  238. )}
  239. <Swiper
  240. ref={swiperRef}
  241. spaceBetween={30}
  242. watchSlidesVisibility={true}
  243. slidesPerView={5}
  244. breakpoints={breakpoints}
  245. >
  246. {data?.map((item) => (
  247. <SwiperSlide key={item.id}>
  248. <TeamMember member={item} />
  249. </SwiperSlide>
  250. ))}
  251. </Swiper>
  252. </Box>
  253. </Box>
  254. );
  255. };
  256. export default OurTeam;
  257. const styles = {
  258. section: {
  259. pt: [11],
  260. pb: [11, null, null, 12, null, 14],
  261. },
  262. heading: {
  263. p: {
  264. maxWidth: 500,
  265. m: '10px auto 0',
  266. },
  267. },
  268. teamWrapper: {
  269. position: 'relative',
  270. pl: [6],
  271. pr: [6, null, null, 0],
  272. transition: '0.3s ease-in-out 0s',
  273. '.swiper-arrow': {
  274. backgroundColor: '#fff',
  275. border: 0,
  276. cursor: 'pointer',
  277. padding: 0,
  278. display: 'flex',
  279. width: [30, null, null, null, 40, 60],
  280. height: [30, null, null, null, 40, 60],
  281. alignItems: 'center',
  282. justifyContent: 'center',
  283. boxShadow: '0px 7px 14px rgba(25, 60, 101, 0.06)',
  284. borderRadius: '50%',
  285. position: 'absolute',
  286. zIndex: 2,
  287. top: 'calc(50% - 40px)',
  288. transform: 'translateY(-50%)',
  289. outline: 0,
  290. img: {
  291. maxWidth: [8, 10, null, null, '100%'],
  292. },
  293. },
  294. '.swiper-arrow-left': {
  295. left: [3, null, null, null, 20, 50],
  296. img: {
  297. transform: 'rotate(180deg)',
  298. marginLeft: '-4px',
  299. },
  300. },
  301. '.swiper-arrow-right': {
  302. right: [3, null, null, null, 20, 50],
  303. img: {
  304. marginRight: '-4px',
  305. },
  306. },
  307. },
  308. };