Advertisement
c4pslock

templates/ui-ux-details.js

Dec 15th, 2022
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. import React from 'react'
  2. import { node } from 'prop-types'
  3. import { graphql } from 'gatsby'
  4. import { GatsbyImage } from 'gatsby-plugin-image'
  5. import { MDXRenderer } from 'gatsby-plugin-mdx'
  6. import Layout from '../components/Layout'
  7. import Wrapper from '../components/Wrapper'
  8.  
  9. // I am using MULTIPLE STYLESHEET MODULES for now but this can be simplified to one later.
  10. import * as styles from '../styles/ui-ux-details.module.scss'
  11.  
  12. // I am styling this details page as the BASE PAGE and then this page shall be
  13. // copied to other detail pages to avoid useless time-wasting.
  14.  
  15. export default function UiuxDetails({ data }) {
  16. const { body } = data.mdx
  17. const { title, date, role, technologies, featuredImg } = data.mdx.frontmatter
  18.  
  19. return (
  20. <Layout>
  21. <Wrapper>
  22. <div className={styles.details}>
  23. <div className={styles.header}>
  24. <h1>{title}</h1>
  25. <div className={styles.featured}>
  26. <GatsbyImage className={styles.image} image={featuredImg.childImageSharp.gatsbyImageData} alt="featured"/>
  27. </div>
  28.  
  29. <div className={styles.information}>
  30. <div className={styles.grid}>
  31. <div className={styles.date}>
  32. <h4>Date<span>{date}</span></h4>
  33. </div>
  34. <div className={styles.role}>
  35. <h4>Role<span>{role}</span></h4>
  36. </div>
  37. <div className={styles.technologies}>
  38. <h4>Technologies<span>{`${technologies}`}</span></h4>
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. <MDXRenderer>{body}</MDXRenderer>
  44. </div>
  45. </Wrapper>
  46. </Layout>
  47. )
  48. }
  49.  
  50. export const query = graphql`
  51. query UiuxDetails($slug: String) {
  52. mdx(frontmatter: {slug: {eq: $slug}}) {
  53. body
  54. frontmatter {
  55. title
  56. date(formatString: "YYYY")
  57. role
  58. technologies
  59. featuredImg {
  60. childImageSharp {
  61. gatsbyImageData(
  62. layout: FULL_WIDTH
  63. placeholder: BLURRED
  64. width: 1200
  65. blurredOptions: {width: 100}
  66. transformOptions: {cropFocus: CENTER}
  67. )
  68. }
  69. }
  70. }
  71. }
  72. }
  73. `
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement