Skip to content

Commit

Permalink
Convert tags code to TypeScript
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronamm committed Jan 6, 2022
1 parent 7e27867 commit ea814df
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 15 deletions.
4 changes: 3 additions & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
"ignore": [
"minimal-portfolio-example"
]
}
5 changes: 5 additions & 0 deletions .changeset/violet-comics-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@dotnetthailand/gatsby-theme-minimal-portfolio": patch
---

Convert existing code to TypeScript
2 changes: 2 additions & 0 deletions @dotnetthailand/gatsby-theme-minimal-portfolio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
Reusable Gatsby Theme for minimal-portfolio

> Edit this project is only when you want to contribute to the project.
https://www.npmjs.com/org/dotnetthailand
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ exports.createPages = async ({ graphql, actions }, { config }) => {
// https://www.gatsbyjs.com/docs/adding-tags-and-categories-to-blog-posts/
// Extract tag data from query
const tags = markdownQueryResult.data.tags.group
const tagTemplate = require.resolve('./src/templates/tags.js')
const tagTemplate = require.resolve('./src/templates/tags.tsx')
// Make tag pages
tags.forEach(tag => {
createPage({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import React, { useContext } from "react"
import PropTypes from "prop-types"
import { Helmet } from "react-helmet";
import Layout from "../layout/PageLayout";
import React from 'react'
import { Helmet } from 'react-helmet';
import Layout from '../layout/PageLayout';
// Utilities
import kebabCase from "lodash/kebabCase"
import kebabCase from 'lodash/kebabCase'

// Components
import { Link, graphql } from "gatsby"
import { Link, graphql } from 'gatsby'

const TagsPage = ({
data: {
Expand All @@ -19,7 +18,7 @@ const TagsPage = ({

return (
<Layout>
<div className="about-container">
<div className='about-container'>
<Helmet title={title} />
<div>
<h1>Tags</h1>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import React, { useContext } from "react"
import PropTypes from "prop-types"
import { Helmet } from "react-helmet";
import Layout from "../layout/PageLayout";
import ConfigContext from "../context/ConfigContext";

// Components
import { Link, graphql } from "gatsby"

const Tags = ({ pageContext, data }) => {
const config = useContext(ConfigContext);
const { tag } = pageContext
const { edges, totalCount } = data.allMarkdownRemark
const tagHeader = `${totalCount} ${totalCount === 1 ? "activity" : "activities"} tagged with "${tag}"`
Expand Down
3 changes: 2 additions & 1 deletion @dotnetthailand/gatsby-theme-minimal-portfolio/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"noUnusedParameters": true,
"removeComments": false,
"preserveConstEnums": true,
"allowJs": true
"allowJs": true,
"noImplicitAny": false,
},
"include": ["./src/**/*"]
}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,7 @@ NOTE: You can also disable the pagination by setting the `postsPerPage: 0`. In t
- [ ] Migrate to TS
[ ] Set up JS Lint to remove unused variables
[ ] Fix error when clicking tag
space to select
# https://www.npmjs.com/settings/dotnetthailand/packages
4 changes: 2 additions & 2 deletions minimal-portfolio-example/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ const config = require('./SiteConfig');
module.exports = {
plugins: [
{
resolve: "@dotnet-thailand/gatsby-theme-minimal-portfolio",
resolve: "@dotnetthailand/gatsby-theme-minimal-portfolio",
options: {
config: config
},
},
],
}
}

0 comments on commit ea814df

Please sign in to comment.