Skip to content

Instantly share code, notes, and snippets.

@bietkul
Created February 14, 2019 22:08
Show Gist options
  • Save bietkul/9d1fefdfdae2df1595a5f66497b6537b to your computer and use it in GitHub Desktop.
Save bietkul/9d1fefdfdae2df1595a5f66497b6537b to your computer and use it in GitHub Desktop.
Container with Mixpanel
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