Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chakra v1 upgrade #129

Open
wants to merge 5 commits into
base: production
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/about/aboutUsSection.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box, Text, List, ListItem } from '@chakra-ui/core'
import { Box, Text, List, ListItem } from '@chakra-ui/react'

import Section from '../common/section'
import UnderlinedHeading from '../common/underlinedHeading'
Expand Down
2 changes: 1 addition & 1 deletion components/about/contactForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
Textarea,
Alert,
AlertIcon
} from '@chakra-ui/core'
} from '@chakra-ui/react'

import { useState } from 'react'
import PropTypes from 'prop-types'
Expand Down
2 changes: 1 addition & 1 deletion components/about/contactSection.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box, Text } from '@chakra-ui/core'
import { Box, Text } from '@chakra-ui/react'
import { useState } from 'react'

import Section from '../common/section'
Expand Down
12 changes: 8 additions & 4 deletions components/common/authProcess.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { useState } from 'react'
import React, { useState } from 'react'

import {
Box,
Flex,
Text,
Icon,
Input,
Heading,
FormControl,
FormLabel
} from '@chakra-ui/core'
} from '@chakra-ui/react'

import { useForm } from 'react-hook-form'

Expand All @@ -23,6 +22,7 @@ import ErrorMessage from './errorMessage'
import GitHubLoginButton from './githubButton'

import styles from './authProcess.module.scss'
import CustomIconWrapper from './customIconWrapper'

const AuthProcess = ({
process,
Expand Down Expand Up @@ -192,7 +192,11 @@ const AuthProcess = ({
justify='space-between'
aria-live='polite'
>
<Icon name={icon} size='6rem' marginBottom='1.5rem' />
<CustomIconWrapper
icon={icon}
boxSize='6rem'
marginBottom='1.5rem'
/>
<Heading
as='h1'
fontSize='2rem'
Expand Down
10 changes: 5 additions & 5 deletions components/common/banner.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
Flex,
Icon,
CloseButton
} from '@chakra-ui/core'
} from '@chakra-ui/react'
import CustomIconWrapper from './customIconWrapper'

const Banner = ({ icon, children, onCloseClick }) => {
return (
Expand All @@ -20,9 +20,9 @@ const Banner = ({ icon, children, onCloseClick }) => {
borderColor='ocean'
borderBottom='1px'
>
<Icon
name={icon}
size={{ base: '2rem', md: '3rem' }}
<CustomIconWrapper
icon={icon}
boxSize={{ base: '2rem', md: '3rem' }}
marginRight={{ base: 0, md: '1.5rem' }}
marginBottom={{ base: '1.5rem', md: 0 }}
/>
Expand Down
2 changes: 1 addition & 1 deletion components/common/button.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
Button
} from '@chakra-ui/core'
} from '@chakra-ui/react'

const FBButton = (props) => {
return (
Expand Down
2 changes: 1 addition & 1 deletion components/common/card.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// White card with a box shadow used for forms, select plans, install instuctions, etc.
import { Box } from '@chakra-ui/core'
import { Box } from '@chakra-ui/react'
import PropTypes from 'prop-types'

const shadowSizes = {
Expand Down
17 changes: 17 additions & 0 deletions components/common/customIconWrapper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { createIcon } from '@chakra-ui/icons'
import React from 'react'

import icons from '../../public/icons'

const CustomIconWrapper = ({ icon, ...props }) => {
if (!icon || !icons[icon]) {
return null
}

return React.createElement(
createIcon(icons[icon]),
props
)
}

export default CustomIconWrapper
2 changes: 1 addition & 1 deletion components/common/divider.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box } from '@chakra-ui/core'
import { Box } from '@chakra-ui/react'

const Divider = (props) => (
<Box
Expand Down
4 changes: 2 additions & 2 deletions components/common/errorMessage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Alert, AlertIcon } from '@chakra-ui/core'
import { Alert, AlertIcon } from '@chakra-ui/react'

const ErrorMessage = ({ msg, iconSize, children, ...props }) => (
<Alert
Expand All @@ -15,7 +15,7 @@ const ErrorMessage = ({ msg, iconSize, children, ...props }) => (
>
<AlertIcon
color='#b9423a'
size={iconSize || '1.5rem'}
boxSize={iconSize || '1.5rem'}
marginBottom={{ base: '1rem', md: 0 }}
/>
<span>
Expand Down
2 changes: 1 addition & 1 deletion components/common/faqHeading.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Heading } from '@chakra-ui/core'
import { Heading } from '@chakra-ui/react'

// used for FAQ and How it Works page
const FAQHeading = ({ children, ...props }) => (
Expand Down
2 changes: 1 addition & 1 deletion components/common/fbButton.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Button } from '@chakra-ui/core'
import { Button } from '@chakra-ui/react'
import { defaultProps } from '../../utils/defaultBtnProps'
import PropTypes from 'prop-types'

Expand Down
2 changes: 1 addition & 1 deletion components/common/fbTextInput.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Input } from '@chakra-ui/core'
import { Input } from '@chakra-ui/react'

const FBTextInput = ({ id, type, register, ...props }) => (
<Input
Expand Down
2 changes: 1 addition & 1 deletion components/common/footer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { useAuth } from '../../utils/useAuth'

import { Flex, List, ListItem, Text, Box } from '@chakra-ui/core'
import { Flex, List, ListItem, Text, Box } from '@chakra-ui/react'

import TextLink from './textLink'
import styles from './footer.module.scss'
Expand Down
2 changes: 1 addition & 1 deletion components/common/githubButton.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Button, Image, Link } from '@chakra-ui/core'
import { Button, Image, Link } from '@chakra-ui/react'
import { defaultProps } from '../../utils/defaultBtnProps'
import { useLocalStorage } from '../../utils/useLocalStorage'
import { localStorageGHStateKey } from '../../utils/constants'
Expand Down
30 changes: 18 additions & 12 deletions components/common/header/authNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,20 @@ import {
useTheme,
Box,
Button,
Icon,
Menu,
MenuButton,
MenuList,
MenuItem
} from '@chakra-ui/core'
} from '@chakra-ui/react'
import CustomIconWrapper from '../customIconWrapper'
import {
ChevronDownIcon,
ChevronUpIcon,
QuestionIcon,
InfoIcon,
SettingsIcon,
UnlockIcon
} from '@chakra-ui/icons'

const AuthNav = ({ user, onLogout }) => {
const router = useRouter()
Expand Down Expand Up @@ -76,11 +84,9 @@ const AuthNav = ({ user, onLogout }) => {
>
{user.email.charAt(0)}
</Box>
<Icon
name={isExpanded ? 'chevron-up' : 'chevron-down'}
marginLeft='.5rem'
size='1.5rem'
/>
{isExpanded
? <ChevronUpIcon marginLeft='0.5rem' boxSize='1.5rem' />
: <ChevronDownIcon marginLeft='0.5rem' boxSize='1.5rem' />}
</MenuButton>
<MenuList backgroundColor='lightRock'>
<MenuItem
Expand All @@ -91,7 +97,7 @@ const AuthNav = ({ user, onLogout }) => {
<Link href='/dashboard'>
<a>
<Box as='span' display='flex' alignItems='center'>
<Icon name='home' marginRight='.5rem' />
<CustomIconWrapper icon='home' marginRight='.5rem' />
<span>Dashboard</span>
</Box>
</a>
Expand All @@ -105,7 +111,7 @@ const AuthNav = ({ user, onLogout }) => {
<Link href='/faq'>
<a>
<Box as='span' display='flex' alignItems='center'>
<Icon name='question' marginRight='.5rem' />
<QuestionIcon marginRight='.5rem' />
<span>FAQ</span>
</Box>
</a>
Expand All @@ -119,7 +125,7 @@ const AuthNav = ({ user, onLogout }) => {
<Link href='/how-it-works'>
<a>
<Box as='span' display='flex' alignItems='center'>
<Icon name='info' marginRight='.5rem' />
<InfoIcon marginRight='.5rem' />
<span>How it works</span>
</Box>
</a>
Expand All @@ -133,7 +139,7 @@ const AuthNav = ({ user, onLogout }) => {
<Link href='/user/settings'>
<a>
<Box as='span' display='flex' alignItems='center'>
<Icon name='settings' marginRight='.5rem' />
<SettingsIcon marginRight='.5rem' />
<span>Settings</span>
</Box>
</a>
Expand All @@ -147,7 +153,7 @@ const AuthNav = ({ user, onLogout }) => {
<Link href='/'>
<a>
<Box as='span' display='flex' alignItems='center'>
<Icon name='unlock' marginRight='.5rem' />
<UnlockIcon marginRight='.5rem' />
<span>Log out</span>
</Box>
</a>
Expand Down
2 changes: 1 addition & 1 deletion components/common/header/header.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useRouter } from 'next/router'
import { useAuth } from '../../../utils/useAuth'

import { Box, Flex } from '@chakra-ui/core'
import { Box, Flex } from '@chakra-ui/react'

import LinkBtn from '../linkBtn'
import TextLink from '../textLink'
Expand Down
2 changes: 1 addition & 1 deletion components/common/header/logo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Link as ChakraLink, Box } from '@chakra-ui/core'
import { Link as ChakraLink, Box } from '@chakra-ui/react'
import Link from 'next/link'
import FullLogo from './fullLogo'
import FBLogoLetters from './logoLetters'
Expand Down
2 changes: 1 addition & 1 deletion components/common/header/logoLetters.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Flex } from '@chakra-ui/core'
import { Flex } from '@chakra-ui/react'
import PropTypes from 'prop-types'

const FBLogoLetters = ({ id, ...props }) => {
Expand Down
10 changes: 5 additions & 5 deletions components/common/linkBtn.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { PseudoBox } from '@chakra-ui/core'
import { Box } from '@chakra-ui/react'
import { defaultProps } from '../../utils/defaultBtnProps'
import PropTypes from 'prop-types'

const LinkBtn = ({ children, external, ...props }) => (
<>
{!external ? (
<PseudoBox as='a' display='inline-block' {...props}>
<Box as='a' display='inline-block' {...props}>
{children}
</PseudoBox>
</Box>
) : (
<PseudoBox as='a' target='_blank' display='inline-block' {...props}>
<Box as='a' target='_blank' display='inline-block' {...props}>
{children}
</PseudoBox>
</Box>
)}
</>
)
Expand Down
6 changes: 3 additions & 3 deletions components/common/pageWrapper.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PseudoBox, Flex } from '@chakra-ui/core'
import { Box, Flex } from '@chakra-ui/react'

import PropTypes from 'prop-types'
import FBHead from './head'
Expand All @@ -21,7 +21,7 @@ const PageWrapper = (props) => (
<SkipLink />
<Flex direction='column' minH='100vh'>
<Header />
<PseudoBox
<Box
as='main'
id='main-content'
tabIndex='-1'
Expand All @@ -34,7 +34,7 @@ const PageWrapper = (props) => (
}}
>
{props.children}
</PseudoBox>
</Box>
<Footer />
</Flex>
</>
Expand Down
2 changes: 1 addition & 1 deletion components/common/section.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box } from '@chakra-ui/core'
import { Box } from '@chakra-ui/react'

const Section = ({ backgroundColor, children, ...props }) => (
<Box
Expand Down
13 changes: 7 additions & 6 deletions components/common/stepper.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Box, Text, PseudoBox, List, ListItem, Icon } from '@chakra-ui/core'
import { Box, Text, List, ListItem } from '@chakra-ui/react'
import PropTypes from 'prop-types'
import CustomIconWrapper from './customIconWrapper'

const iconHeight = 2
const bgHeight = 0.25
Expand All @@ -20,9 +21,9 @@ const barBg = {
const Step = ({ step, i, currentStep }) => (
<ListItem textAlign='center' fontSize='0.875rem'>
<>
<Icon
name={step.iconName}
size={`${iconHeight}rem`}
<CustomIconWrapper
icon={step.iconName}
boxSize={`${iconHeight}rem`}
marginBottom='1rem'
/>
<Text aria-current={i + 1 === currentStep ? 'step' : 'false'}>
Expand All @@ -41,7 +42,7 @@ const Step = ({ step, i, currentStep }) => (
)

const Stepper = ({ steps, currentStep = 2 }) => (
<PseudoBox
<Box
display='flex'
justifyItems='center'
position='relative'
Expand Down Expand Up @@ -71,7 +72,7 @@ const Stepper = ({ steps, currentStep = 2 }) => (
<Step key={i} step={stepData} i={i} currentStep={currentStep} />
))}
</List>
</PseudoBox>
</Box>
)

Stepper.propTypes = {
Expand Down
2 changes: 1 addition & 1 deletion components/common/stepperSection.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Flex } from '@chakra-ui/core'
import { Flex } from '@chakra-ui/react'
import PropTypes from 'prop-types'

import Stepper from '../common/stepper'
Expand Down
2 changes: 1 addition & 1 deletion components/common/subheading.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Text } from '@chakra-ui/core'
import { Text } from '@chakra-ui/react'

// This is the large text in each section that sits below the underlined section title
const Subheading = ({ align, children, ...props }) => (
Expand Down
2 changes: 1 addition & 1 deletion components/common/textLink.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Link as ChakraLink } from '@chakra-ui/core'
import { Link as ChakraLink } from '@chakra-ui/react'
import Link from 'next/link'
import PropTypes from 'prop-types'

Expand Down
Loading