Skip to content

Commit

Permalink
fix ga
Browse files Browse the repository at this point in the history
  • Loading branch information
Rocky Wu committed Sep 10, 2019
1 parent 16e850d commit ae0d5e0
Show file tree
Hide file tree
Showing 5 changed files with 283 additions and 196 deletions.
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -16,11 +16,11 @@
"author": "Rocky Wu <rwu823@gmail.com>",
"license": "MIT",
"devDependencies": {
"@mdx-js/react": "^1.3.1",
"@next/mdx": "^9.0.4",
"@mdx-js/react": "^1.4.5",
"@next/mdx": "^9.0.5",
"@ts-mono/base": "rwu823/ts-mono#base/latest",
"@ts-mono/dev-react": "rwu823/ts-mono#dev-react",
"next": "^9.0.4",
"next": "^9.0.5",
"npm-run-all": "^4.1.5",
"prop-types": "^15.7.2",
"react": "^16.9.0",
Expand Down
22 changes: 12 additions & 10 deletions pages/_app.tsx
@@ -1,13 +1,16 @@
import React from 'react'
import styled, { css } from 'styled-components'
import NextApp, { Container, AppContext } from 'next/app'
import NextApp, { AppContext } from 'next/app'

import GlobalStyles from '@ts-mono/dev-react/components/GlobalStyles'
import { mdxRenders } from '@ts-mono/dev-react/components/mdx-renders'
import GlobalStateProvider from '@ts-mono/dev-react/components/GlobalStateProvider'
import GA from '@ts-mono/dev-react/share/GA'

const { MDXProvider } = require('@mdx-js/react')

const ga = new GA('UA-4476856-23', { debug: true })

const Main = styled.div`
${(_p: {}) => css`
max-width: 800px;
Expand All @@ -28,18 +31,17 @@ class App extends NextApp {

render() {
const { Component, pageProps } = this.props
ga.pageView()

return (
<Container>
<MDXProvider components={mdxRenders}>
<GlobalStyles />
<MDXProvider components={mdxRenders}>
<Main>
<GlobalStateProvider initState={{}}>
<Component {...pageProps} />
</GlobalStateProvider>
</Main>
</MDXProvider>
</Container>
<Main>
<GlobalStateProvider initState={{}}>
<Component {...pageProps} />
</GlobalStateProvider>
</Main>
</MDXProvider>
)
}
}
Expand Down
4 changes: 0 additions & 4 deletions pages/_document.tsx
Expand Up @@ -43,10 +43,6 @@ class MyDocument extends Document {
href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
rel="stylesheet"
/>
<script
async
src="https://www.googletagmanager.com/gtag/js?id=UA-4476856-23"
/>
</Head>
<body>
<Main />
Expand Down
10 changes: 4 additions & 6 deletions pages/index.tsx
Expand Up @@ -4,7 +4,6 @@ import Head from 'next/head'

import styled, { css } from 'styled-components'
import { CodeBlock } from '@ts-mono/dev-react/components/Markdown/'
import GA from '@ts-mono/dev-react/share/GA'

import Ripples, { createRipples } from '../src'

Expand All @@ -23,6 +22,10 @@ const Main = styled.div`
width: 700px;
margin: 0 auto;
.mdx-code-block {
margin-bottom: 1em;
}
h2 {
margin-top: 2em;
}
Expand Down Expand Up @@ -64,11 +67,6 @@ const Badges = styled.div`
type Props = {}

const App: NextPage<Props> = () => {
React.useEffect(() => {
const ga = new GA('UA-4476856-23')
ga.pageView()
}, [])

return (
<div>
<Head>
Expand Down

0 comments on commit ae0d5e0

Please sign in to comment.