dfghgfhplkjbv

src/components/Jobs/Jobs.js

Feb 22nd, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.85 KB | None | 0 0
  1. import React, { Component } from 'react'
  2. import classNames from 'classnames'
  3. import { Link } from 'gatsby'
  4. import posed, { PoseGroup } from 'react-pose'
  5. import shuffle from 'src/shuffle'
  6. import styles from './Jobs.module.scss'
  7. import { width } from 'window-size'
  8. // import vector from 'src/img/Vector.png'
  9.  
  10. const Item = posed.div({
  11. flip: {
  12. scale: 1,
  13. transition: {
  14. scale: {
  15. type: 'spring',
  16. velocity: 3,
  17. },
  18. default: {
  19. type: 'spring',
  20. },
  21. },
  22. // transition: { type: 'spring', stiffness: 100 },
  23. },
  24. })
  25.  
  26. class Jobs extends Component {
  27. state = {
  28. preparedOffers: this.props.offers.filter(({ node: slug }) => slug !== '_').slice(0, 4),
  29. }
  30.  
  31. handleTagClick = (tagTitle) => {
  32. this.setState(
  33. {
  34. preparedOffers: this.props.offers
  35. .filter(
  36. ({
  37. node: {
  38. tag: { title },
  39. },
  40. }) => title === tagTitle,
  41. )
  42. .slice(0, 4),
  43. },
  44. () =>
  45. this.setState({
  46. preparedOffers: shuffle(
  47. this.props.offers
  48. .filter(
  49. ({
  50. node: {
  51. tag: { title },
  52. },
  53. }) => title === tagTitle,
  54. )
  55. .slice(0, 4),
  56. ),
  57. }),
  58. )
  59. }
  60.  
  61. render() {
  62. const { preparedOffers } = this.state
  63. const { className, jobTags } = this.props
  64. return (
  65. <div className={classNames(className, styles.root)}>
  66. <section className={styles.container}>
  67. <header className={styles.header}>
  68. <h1>JOBS</h1>
  69. </header>
  70. <div className={styles.blocksContainer}>
  71. <div className={styles.tagsContainer}>
  72. <div className={styles.jobsTitle}>
  73. <h2>Tags:</h2>
  74. </div>
  75. <div className={styles.buttonsContainer}>
  76. {jobTags.map(({ node }) => (
  77. <button className={styles.button} key={node.id} onClick={() => this.handleTagClick(node.title)}>
  78. {node.title}
  79. </button>
  80. ))}
  81. </div>
  82. <div className={styles.gemsContainer}>
  83. <div className={styles.innerContainer}>
  84. <p className={styles.gems}>
  85. Like these<br /> gems?
  86. </p>
  87. <Link to="/jobs" className={styles.allJobs}>
  88. View all jobs
  89. </Link>
  90. </div>
  91. </div>
  92. </div>
  93. <div className={styles.vacanciesContainer}>
  94. <PoseGroup>
  95. {preparedOffers.map(({ node: { id, slug, description, tag: { title }, companyLogo: { url } } }) => (
  96. <Item key={id} className={styles.ololo}>
  97. <Link to={`/job/${slug}`} className={styles.jobOffer} key={id}>
  98. <div className={styles.headerVacancy}>
  99. <p>{title}</p>
  100. <div className={styles.box}>
  101. <img src={url} alt="" />
  102. </div>
  103. <div className={styles.description}>
  104. <p>{description.length >= 70 ? `${description.substring(0, 70)}...` : description}</p>
  105. </div>
  106. <div className={styles.bottomLine}>
  107. <p>BOX</p>
  108. {/* <img src={vector} className={styles.vector} alt="" ></img> */}
  109. </div>
  110. </div>
  111. </Link>
  112. </Item>
  113. ))}
  114. </PoseGroup>
  115. </div>
  116. </div>
  117. </section>
  118. </div>
  119. )
  120. }
  121. }
  122.  
  123. export default Jobs
Advertisement
Add Comment
Please, Sign In to add comment