-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
124 changed files
with
2,512 additions
and
1,787 deletions.
There are no files selected for viewing
14 changes: 11 additions & 3 deletions
14
netlify/functions/create-payment-intent.js → netlify/functions/create-payment-intent.ts
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,32 @@ | ||
|
||
import React from 'react'; | ||
import { Routes, Route } from 'react-router-dom' | ||
import { Suspense } from './components/suspense/suspense'; | ||
import { useEffect } from 'react'; | ||
|
||
import { checkUserSession, setCurrentUser } from './store/user/user.action'; | ||
import { useDispatch } from 'react-redux'; | ||
import { onAuthStateListener, createUserDocFromAuth, getCurrentUser } from './util/firebase/firebase.utils'; | ||
import { fetchCategoriesStart } from './store/categories/category.reducer'; | ||
// import Home from "./routes/home/home.component" | ||
// import Navigation from './routes/navigation/navigation.component'; | ||
// import Auth from './routes/auth/auth' | ||
// import Shop from './routes/shop/shop.component'; | ||
// import Checkout from './routes/checkout/checkout' | ||
// import ContactPage from './routes/contact/contact'; | ||
const ContactPage = React.lazy(() => import('./routes/contact/contact')) | ||
const Home = React.lazy(() => import("./routes/home/home.component")) | ||
const Navigation = React.lazy(() => import('./routes/navigation/navigation.component')) | ||
const Auth = React.lazy(() => import('./routes/auth/auth')) | ||
const Shop = React.lazy(() => import('./routes/shop/shop.component')) | ||
const Checkout = React.lazy(() => import('./routes/checkout/checkout')) | ||
|
||
function App() { | ||
const dispatch = useDispatch() | ||
import { Routes, Route } from 'react-router-dom'; | ||
|
||
import Home from './routes/home/home.component'; | ||
import Navigation from './routes/navigation/navigation.component'; | ||
import Authentication from './routes/authentication/authentication.component'; | ||
import Shop from './routes/shop/shop.component'; | ||
import Checkout from './routes/checkout/checkout.component'; | ||
import { checkUserSession } from './store/user/user.action'; | ||
|
||
const App = () => { | ||
const dispatch = useDispatch(); | ||
|
||
useEffect(() => { | ||
dispatch(checkUserSession()) | ||
dispatch(fetchCategoriesStart()) | ||
}, []) | ||
dispatch(checkUserSession()); | ||
}, []); | ||
|
||
return ( | ||
<React.Suspense fallback={<Suspense />}> | ||
<Routes> | ||
<Route path='/' element={<Navigation />}> | ||
<Route index element={<Home />} /> | ||
<Route path='shop/*' element={<Shop />} /> | ||
<Route path='auth' element={<Auth />} /> | ||
<Route path='checkout' element={<Checkout />} /> | ||
<Route path='contact' element={<ContactPage />} /> | ||
</Route> | ||
</Routes> | ||
</React.Suspense> | ||
<Routes> | ||
<Route path='/' element={<Navigation />}> | ||
<Route index element={<Home />} /> | ||
<Route path='shop/*' element={<Shop />} /> | ||
<Route path='auth' element={<Authentication />} /> | ||
<Route path='checkout' element={<Checkout />} /> | ||
</Route> | ||
</Routes> | ||
); | ||
} | ||
}; | ||
|
||
export default App; |
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React, { FC, ButtonHTMLAttributes } from 'react'; | ||
|
||
import { | ||
BaseButton, | ||
GoogleSignInButton, | ||
InvertedButton, | ||
ButtonSpinner, | ||
} from './button.styles'; | ||
|
||
export enum BUTTON_TYPE_CLASSES { | ||
base = 'base', | ||
google = 'google-sign-in', | ||
inverted = 'inverted', | ||
} | ||
|
||
const getButton = (buttonType = BUTTON_TYPE_CLASSES.base): typeof BaseButton => { | ||
switch (buttonType) { | ||
case BUTTON_TYPE_CLASSES.base : | ||
return BaseButton | ||
case BUTTON_TYPE_CLASSES.google : | ||
return GoogleSignInButton | ||
case BUTTON_TYPE_CLASSES.inverted : | ||
return InvertedButton | ||
default : | ||
return BaseButton | ||
} | ||
} | ||
|
||
|
||
export type ButtonProps = { | ||
buttonType?: BUTTON_TYPE_CLASSES; | ||
isLoading?: boolean; | ||
} & ButtonHTMLAttributes<HTMLButtonElement>; | ||
|
||
const Button: FC<ButtonProps> = ({ | ||
children, | ||
buttonType, | ||
isLoading, | ||
...otherProps | ||
}) => { | ||
const CustomButton = getButton(buttonType); | ||
return ( | ||
<CustomButton disabled={isLoading} {...otherProps}> | ||
{isLoading ? <ButtonSpinner /> : children} | ||
</CustomButton> | ||
); | ||
}; | ||
|
||
export default Button; |
This file contains 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
Oops, something went wrong.