Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit bfae45c

Browse files
committedJun 19, 2021
reveal component revamp
1 parent 20007be commit bfae45c

File tree

1 file changed

+57
-54
lines changed

1 file changed

+57
-54
lines changed
 

‎src/templates/reveal-post.js

Lines changed: 57 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,76 @@
11
import React from 'react'
22
import { Link, withPrefix, graphql } from 'gatsby'
3-
import Helmet from 'react-helmet'
43

54
import SEO from '../components/seo'
65

76
import 'bootstrap/dist/css/bootstrap.min.css'
87

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+
}
1115

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 (
1819
<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&amp;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>
4927
<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"
5336
>
54-
{tag}
37+
<img
38+
className="mb-0 mr-3"
39+
src={withPrefix('stack.png')}
40+
style={{ width: 32, height: 32, borderRadius: 40 }}
41+
/>
5542
</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&amp;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>
5760
</div>
58-
</div>
5961

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>
6770
</div>
6871
</div>
69-
</div>
70-
)
72+
)
73+
}
7174
}
7275

7376
export const pageQuery = graphql`

0 commit comments

Comments
 (0)
Please sign in to comment.