Advertisement
dfghgfhplkjbv

src/components/Ad/Ad.js

Feb 27th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.96 KB | None | 0 0
  1. import React, { Component } from 'react'
  2. import { AppContext } from 'src/components/Layout/Layout'
  3. import PropTypes from 'prop-types'
  4. import Swiper from 'react-id-swiper'
  5. import classNames from 'classnames'
  6.  
  7. import styles from './Ad.module.scss'
  8.  
  9. const promoContent = [
  10. 'У вас есть стартап или идея стартапа?',
  11. 'Вам нужно проверить гипотезу или создать MVP?',
  12. 'Вам нужна помощь в разработке?',
  13. 'Вам нужна помощь в поиске инвестиций?',
  14. 'Обращайтесь в нашу лабораторию и мы вам поможем',
  15. ]
  16.  
  17. const promoContentEn = [
  18. 'Do you have a startup or startup idea?',
  19. 'Need to test a hypothesis or create a MVP?',
  20. 'Do you need a help in development?',
  21. 'Do you need a help in investment search?',
  22. 'Сontact our laboratory and we will help',
  23. ]
  24.  
  25. class Ad extends Component {
  26. createContent = (lang) => {
  27. if (lang === 'en') {
  28. return promoContentEn
  29. } else {
  30. return promoContent
  31. }
  32. }
  33.  
  34. render() {
  35. const { isInSingleJob } = this.props
  36. const params = {
  37. slidesPerView: 1,
  38. loop: true,
  39. // custom styles in the end of src/styles/_swiper.sccs
  40. containerClass: 'custom-container',
  41. effect: 'fade',
  42. autoplay: {
  43. delay: 3000,
  44. },
  45. pagination: {
  46. el: '.swiper-pagination.custom-swiper-pagination',
  47. clickable: true,
  48. renderBullet: (index, className) => {
  49. return '<span class="' + className + '">' + (index + 1) + '</span>'
  50. },
  51. },
  52. }
  53.  
  54. return (
  55. <AppContext.Consumer>
  56. {(locale) => {
  57. return (
  58. <article
  59. className={classNames(styles.root, {
  60. [styles.isInSingleJob]: isInSingleJob,
  61. })}
  62. >
  63. <a
  64. rel="noopener noreferrer"
  65. href="https://startupscaleup.io/"
  66. target="_blank"
  67. className={styles.wrapperLink}
  68. >
  69. <Swiper {...params}>
  70. {this.createContent(locale || this.props.locale).map((item, index) => (
  71. <div className={styles.slide} key={index}>
  72. {item}
  73. </div>
  74. ))}
  75. </Swiper>
  76. </a>
  77. <div className={styles.title}>
  78. <span>startupscaleup</span>
  79. </div>
  80. </article>
  81. )
  82. }}
  83. </AppContext.Consumer>
  84. )
  85. }
  86. }
  87.  
  88. Ad.propTypes = {
  89. slidesPerView: PropTypes.number,
  90. loop: PropTypes.bool,
  91. containerClass: PropTypes.string,
  92. effect: PropTypes.string,
  93. autoplay: PropTypes.shape({
  94. delay: PropTypes.number,
  95. }),
  96. pagination: PropTypes.shape({
  97. el: PropTypes.string,
  98. clickable: PropTypes.bool,
  99. renderBullet: PropTypes.func,
  100. }),
  101. }
  102.  
  103. export default Ad
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement