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 * as React from 'react' | |
interface Props {} | |
const MyComponent: React.FunctionComponent<Props> = () => ( | |
<div role='heading'>My First Component</div> | |
) | |
export default MyComponent |
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 MyComponent from './components/MyComponent' | |
export { MyComponent } |
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 * as React from 'react' | |
import { render } from '@testing-library/react' | |
import '@testing-library/jest-dom/extend-expect' | |
import { MyComponent } from '../../index' | |
test('Renders', async () => { | |
const { getByRole } = render(<MyComponent />) | |
expect(getByRole('heading')).toHaveTextContent('My First Component') | |
}) |
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 { configure } from '@storybook/react' | |
configure(require.context('../src', true, /\.stories\.tsx$/), module) |
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
const path = require('path') | |
const SRC_PATH = path.join(__dirname, '../src') | |
module.exports = ({ config }) => { | |
config.module.rules.push({ | |
test: /\.(ts|tsx)$/, | |
include: [SRC_PATH], | |
use: [ | |
{ | |
loader: require.resolve('awesome-typescript-loader'), |
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 * as React from 'react' | |
import MyComponent from './MyComponent' | |
export default { title: 'MyComponent' } | |
export const basic = () => <MyComponent /> |
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 * as React from 'react' | |
import { NextPage } from 'next' | |
interface Props {} | |
const Page: NextPage<Props> = () => ( | |
<div>Initial Page</div> | |
) | |
export default Page |
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 * as React from 'react' | |
import { NextPage } from 'next' | |
interface Props {} | |
const DashboardPage: NextPage<Props> = () => ( | |
<div>Dashboard</div> | |
) | |
export default DashboardPage |
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 * as React from 'react' | |
import createAuth0Client from '@auth0/auth0-spa-js' | |
import { useRouter } from 'next/router' | |
import { NextPage } from 'next' | |
const DEFAULT_REDIRECT_CALLBACK = () => | |
window.history.replaceState({}, document.title, window.location.pathname) | |
interface Auth0ProviderProps { | |
children: React.ReactNode |
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 * as React from 'react' | |
import App from 'next/app' | |
import Head from 'next/head' | |
import { Auth0Provider } from '../lib/auth0-spa' | |
export default class MyApp extends App { | |
render () { | |
const { Component, pageProps, router } = this.props | |
const onRedirectCallback = appState => { |