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 { isValidEmail } from 'lib/email' | |
describe('isValidEmail', () => { | |
it('valid email', () => { | |
expect(isValidEmail('[email protected]')).toBe(true) | |
}) | |
it('invalid email', () => { | |
expect(isValidEmail('johndoegmail.com')).toBe(false) | |
}) |
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 re = /[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/ | |
export const isValidEmail = (email: string): boolean => re.test(email) |
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 React from 'react' | |
import { ComponentMeta } from '@storybook/react' | |
import { SubscribeHero } from './SubscribeHero' | |
import { action } from '@storybook/addon-actions' | |
import { Container } from '@material-ui/core' | |
export default { | |
title: 'Components/SubscribeHero', | |
component: SubscribeHero, | |
decorators: [ |
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 { Box, Button, CircularProgress, Grid, TextField, Typography } from '@material-ui/core' | |
import MailOutlineIcon from '@material-ui/icons/MailOutline' | |
export interface SubscribeHeroProps { | |
onSubmit: (email: string) => void | |
isSubscribing?: boolean | |
hasError?: boolean | |
} |
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' | |
import { Box, Button, Container, Grid, Typography } from '@material-ui/core' | |
import MailOutlineIcon from '@material-ui/icons/MailOutline' | |
const IndexPage: NextPage = () => { | |
return ( | |
<Container maxWidth='lg'> | |
<Box py={3}> | |
<Grid container> |
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 Document, { Html, Head, Main, NextScript } from 'next/document' | |
import { ServerStyleSheets } from '@material-ui/core/styles' | |
export default class MySaaSDocument extends Document { | |
render() { | |
return ( | |
<Html lang='en'> | |
<Head> | |
<link |
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 Head from 'next/head' | |
import CssBaseline from '@material-ui/core/CssBaseline' | |
export default function MySaaSApp({ Component, pageProps }) { | |
React.useEffect(() => { | |
const jssStyles = document.querySelector('#jss-server-side') | |
if (jssStyles) { | |
jssStyles.parentElement.removeChild(jssStyles) | |
} |
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' | |
const IndexPage: NextPage = () => { | |
return <div>Hello SaaS</div> | |
} | |
export default IndexPage |
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
;(function () { | |
var w = window | |
var mc = w.mortgage_calculator | |
if (typeof mc === 'object') { | |
mc.renderMortgageCalculator(document.getElementById('root')) | |
} else { | |
var d = document | |
var l = function () { | |
var s = d.createElement('script') | |
s.type = 'text/javascript' |
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
!function(){var e=window,t=e.mortgage_calculator;if("object"==typeof t)t.renderMortgageCalculator(document.getElementById("root"));else{var a=document,o=function(){var t=a.createElement("script");t.type="text/javascript",t.async=!0,t.src="mortgage-calculator.js";var o=a.getElementsByTagName("script")[0];o.parentNode.insertBefore(t,o),t.onload=(()=>{e.mortgage_calculator.renderMortgageCalculator(document.getElementById("root"))})};"complete"===document.readyState?o():e.attachEvent?e.attachEvent("onload",o):e.addEventListener("load",o,!1)}}(); |