|
1 | 1 | import React from 'react'
|
2 | 2 | import { Link, withPrefix, graphql } from 'gatsby'
|
3 |
| -import Helmet from 'react-helmet' |
4 | 3 |
|
5 | 4 | import SEO from '../components/seo'
|
6 | 5 |
|
7 | 6 | import 'bootstrap/dist/css/bootstrap.min.css'
|
8 | 7 |
|
9 |
| -export default function RevealPostTemplate({ data, location }) { |
10 |
| - const reveal = data.markdownRemark |
| 8 | +export default class RevealPostTemplate extends React.Component { |
| 9 | + componentDidMount() { |
| 10 | + const script = document.createElement('script') |
| 11 | + script.src = withPrefix('reveal-activate.js') |
| 12 | + script.async = true |
| 13 | + document.body.appendChild(script) |
| 14 | + } |
11 | 15 |
|
12 |
| - return ( |
13 |
| - <div style={{ height: 'inherit' }}> |
14 |
| - <SEO |
15 |
| - title={reveal.frontmatter.title} |
16 |
| - description={reveal.frontmatter.seo} |
17 |
| - /> |
| 16 | + render() { |
| 17 | + const reveal = this.props.data.markdownRemark |
| 18 | + return ( |
18 | 19 | <div style={{ height: 'inherit' }}>
|
19 |
| - <Helmet> |
20 |
| - <script src={withPrefix('reveal-activate.js')} /> |
21 |
| - </Helmet> |
22 |
| - |
23 |
| - <div className="reveal-tags"> |
24 |
| - <div> |
25 |
| - <Link |
26 |
| - key="stackcheats" |
27 |
| - style={{ |
28 |
| - boxShadow: `none`, |
29 |
| - textDecoration: `none`, |
30 |
| - color: `inherit`, |
31 |
| - }} |
32 |
| - href={`/`} |
33 |
| - target="_blank" |
34 |
| - > |
35 |
| - <img |
36 |
| - className="mb-0 mr-3" |
37 |
| - src={withPrefix('stack.png')} |
38 |
| - style={{ width: 32, height: 32, borderRadius: 40 }} |
39 |
| - /> |
40 |
| - </Link> |
41 |
| - <a href="https://github.com/athiththan11"> |
42 |
| - <img |
43 |
| - className="mb-0 mr-3" |
44 |
| - src="https://avatars3.githubusercontent.com/u/29927177?s=460&v=4" |
45 |
| - style={{ width: 32, height: 32, borderRadius: 40 }} |
46 |
| - /> |
47 |
| - </a> |
48 |
| - {reveal.frontmatter.tags.map(tag => ( |
| 20 | + <SEO |
| 21 | + title={reveal.frontmatter.title} |
| 22 | + description={reveal.frontmatter.seo} |
| 23 | + /> |
| 24 | + <div style={{ height: 'inherit' }}> |
| 25 | + <div className="reveal-tags"> |
| 26 | + <div> |
49 | 27 | <Link
|
50 |
| - key={tag} |
51 |
| - className="badge badge-primary font-weight-normal" |
52 |
| - to={`/tags/${tag}/`} |
| 28 | + key="stackcheats" |
| 29 | + style={{ |
| 30 | + boxShadow: `none`, |
| 31 | + textDecoration: `none`, |
| 32 | + color: `inherit`, |
| 33 | + }} |
| 34 | + href={`/`} |
| 35 | + target="_blank" |
53 | 36 | >
|
54 |
| - {tag} |
| 37 | + <img |
| 38 | + className="mb-0 mr-3" |
| 39 | + src={withPrefix('stack.png')} |
| 40 | + style={{ width: 32, height: 32, borderRadius: 40 }} |
| 41 | + /> |
55 | 42 | </Link>
|
56 |
| - ))} |
| 43 | + <a href="https://github.com/athiththan11"> |
| 44 | + <img |
| 45 | + className="mb-0 mr-3" |
| 46 | + src="https://avatars3.githubusercontent.com/u/29927177?s=460&v=4" |
| 47 | + style={{ width: 32, height: 32, borderRadius: 40 }} |
| 48 | + /> |
| 49 | + </a> |
| 50 | + {reveal.frontmatter.tags.map(tag => ( |
| 51 | + <Link |
| 52 | + key={tag} |
| 53 | + className="badge badge-primary font-weight-normal" |
| 54 | + to={`/tags/${tag}/`} |
| 55 | + > |
| 56 | + {tag} |
| 57 | + </Link> |
| 58 | + ))} |
| 59 | + </div> |
57 | 60 | </div>
|
58 |
| - </div> |
59 | 61 |
|
60 |
| - <div className="reveal" style={{ height: 'inherit' }}> |
61 |
| - <div |
62 |
| - className="slides" |
63 |
| - dangerouslySetInnerHTML={{ |
64 |
| - __html: reveal.html, |
65 |
| - }} |
66 |
| - ></div> |
| 62 | + <div className="reveal" style={{ height: 'inherit' }}> |
| 63 | + <div |
| 64 | + className="slides" |
| 65 | + dangerouslySetInnerHTML={{ |
| 66 | + __html: reveal.html, |
| 67 | + }} |
| 68 | + ></div> |
| 69 | + </div> |
67 | 70 | </div>
|
68 | 71 | </div>
|
69 |
| - </div> |
70 |
| - ) |
| 72 | + ) |
| 73 | + } |
71 | 74 | }
|
72 | 75 |
|
73 | 76 | export const pageQuery = graphql`
|
|
0 commit comments