Skip to content

Commit 0470091

Browse files
Rename to .TS
1 parent 0ec1369 commit 0470091

23 files changed

+33
-23
lines changed

components/GoogleAnalytics.js renamed to components/GoogleAnalytics.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import isDevelopment from '../lib/isDevelopment'
44
/* options: { 'page_title' : 'homepage' } */
55
// See https://developers.google.com/analytics/devguides/collection/gtagjs
66
export const googlePageview = (path, options) => {
7-
const completeOptions = Object.assign({}, options, { 'page_path': path }) // 'page_title' : 'homepage'
7+
const completeOptions = Object.assign({}, options, { page_path: path }) // 'page_title' : 'homepage'
88
if (config.googleAnalyticsId) window.gtag('config', config.googleAnalyticsId, completeOptions)
9-
if (isDevelopment()) console.log(`Google pageview:`, { path, options: completeOptions })
9+
if (isDevelopment()) console.log('Google pageview:', { path, options: completeOptions })
1010
}
1111

1212
// options: { 'event_category' : 'bbb', 'event_label' : 'ccc' }
1313
// See https://developers.google.com/analytics/devguides/collection/gtagjs/events
1414
export const googleEvent = (action, options) => {
1515
if (config.googleAnalyticsId) window.gtag('event', action, options)
16-
if (isDevelopment()) console.log(`Google event:`, { action, options })
16+
if (isDevelopment()) console.log('Google event:', { action, options })
1717
}

components/Header.js renamed to components/Header.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ const AppIcon = () => (
2020
height: 30px;
2121
border-radius: 50%;
2222
}
23-
`}</style>
23+
`}
24+
</style>
2425
</a>
2526
</Link>
2627
)
@@ -48,6 +49,7 @@ export default ({ title = config.appName, children }) => (
4849
:global(main) {
4950
margin-top: 50px;
5051
}
51-
`}</style>
52+
`}
53+
</style>
5254
</header>
5355
)
File renamed without changes.
File renamed without changes.

components/articles/ArticleList.js renamed to components/articles/ArticleList.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ const ArticleList = () => {
5656
form {
5757
margin-top: 1em
5858
}
59-
`}</style>
59+
`}
60+
</style>
6061
</form>
6162
</>
6263
)

components/articles/ArticleListItem.js renamed to components/articles/ArticleListItem.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ const ArticleListItem = ({ article, index, inProgress = false }) => {
6262
.inProgress {
6363
opacity: 0.3;
6464
}
65-
`}</style>
65+
`}
66+
</style>
6667
</div>
6768
)
6869
}
File renamed without changes.

lib/formatDate.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

lib/formatDate.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default (dateObj: Date) => `${dateObj.getFullYear()}-${('0' + (dateObj.getMonth() + 1)).slice(-2)}-${('0' + dateObj.getDate()).slice(-2)}`
2+
3+
export const dateAsISO = (date: Date | string): string | undefined => (date !== null && date !== undefined) ? (new Date(date)).toISOString() : undefined
File renamed without changes.
File renamed without changes.
File renamed without changes.

pages/_document.js renamed to pages/_document.tsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,21 @@ export default class MyDocument extends Document {
1010
<html lang={config.locale.split('_')[0]}>
1111
<Head>
1212
{/* Global Site Tag (gtag.js) - Google Analytics */}
13-
{config.googleAnalyticsId ? (
14-
<>
15-
<script async src={`https://www.googletagmanager.com/gtag/js?id=${config.googleAnalyticsId}`} />
16-
<script
17-
dangerouslySetInnerHTML={{
18-
__html: `window.dataLayer = window.dataLayer || [];
13+
{config.googleAnalyticsId
14+
? (
15+
<>
16+
<script async src={`https://www.googletagmanager.com/gtag/js?id=${config.googleAnalyticsId}`} />
17+
<script
18+
dangerouslySetInnerHTML={{
19+
__html: `window.dataLayer = window.dataLayer || [];
1920
function gtag(){dataLayer.push(arguments);}
2021
gtag('js', new Date());
2122
gtag('config', '${config.googleAnalyticsId}');`
22-
}}
23-
/>
24-
</>
25-
) : null}
23+
}}
24+
/>
25+
</>
26+
)
27+
: null}
2628
</Head>
2729
<body>
2830
<Main />
File renamed without changes.

pages/articles/[article].js renamed to pages/articles/[article].tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ function ArticlePage ({ query, asPath }) {
1717
title={loading ? 'Loading...' : data.article.title}
1818
path={asPath}
1919
>
20-
{loading ? <div>Loading...</div> : (
21-
<ArticleDetails
22-
article={data.article}
23-
/>
24-
)}
20+
{loading
21+
? <div>Loading...</div>
22+
: (
23+
<ArticleDetails
24+
article={data.article}
25+
/>
26+
)}
2527

2628
<h2>Routing</h2>
2729
<p>Current query: <strong>{JSON.stringify(query)}</strong></p>
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)