Created
February 14, 2019 22:08
-
-
Save bietkul/9d1fefdfdae2df1595a5f66497b6537b to your computer and use it in GitHub Desktop.
Container with Mixpanel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Head from 'next/head'; | |
| import React from 'react'; | |
| import { css } from '@emotion/core'; | |
| import { | |
| node, string, oneOfType, object | |
| } from 'prop-types'; | |
| import { ReactiveBase } from '@appbaseio/reactivesearch'; | |
| import mixpanel from 'mixpanel-browser'; | |
| import { MixpanelProvider } from 'react-mixpanel'; | |
| import { Layout } from 'antd'; | |
| const layoutCls = css` | |
| background: #152530; | |
| color: #fff; | |
| font-family: Lato; | |
| `; | |
| // Initialize mixpanel | |
| mixpanel.init("YOUR_TOKEN"); | |
| const Container = ({ children, title = "Movies Store" }) => ( | |
| <Layout css={layoutCls} className="layout"> | |
| <Head> | |
| <title>{title}</title> | |
| </Head> | |
| <MixpanelProvider mixpanel={mixpanel}> | |
| <ReactiveBase | |
| app="YOUR_APP_NAME" // Your app name for e.g movies-store-app | |
| credentials="YOUR_APP_CREDENTIALS" // API credentials | |
| theme={{ | |
| typography: { | |
| fontFamily: "Lato" | |
| } | |
| }} | |
| analytics | |
| > | |
| {children} | |
| </ReactiveBase> | |
| </MixpanelProvider> | |
| </Layout> | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment