-
Notifications
You must be signed in to change notification settings - Fork 849
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
39 adding the next.js frontend app to the code base
- Loading branch information
Showing
138 changed files
with
13,564 additions
and
8 deletions.
There are no files selected for viewing
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
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
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,24 @@ | ||
{ | ||
"extends": ["plugin:react/recommended", "plugin:@typescript-eslint/recommended", "next/core-web-vitals"], | ||
"plugins": ["@typescript-eslint"], | ||
"root": true, | ||
"globals": {}, | ||
"rules": { | ||
"react-hooks/exhaustive-deps": "warn", | ||
"no-unused-vars": "error", | ||
"max-len": [ | ||
"error", | ||
{ | ||
"code": 150, | ||
"ignoreComments": true, | ||
"ignoreTrailingComments": true, | ||
"ignoreUrls": true, | ||
"ignoreStrings": true, | ||
"ignoreTemplateLiterals": true | ||
} | ||
] | ||
}, | ||
"parser": "@typescript-eslint/parser", | ||
"env": {}, | ||
"overrides": [] | ||
} |
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,35 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
/.next/ | ||
/out/ | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
.pnpm-debug.log* | ||
|
||
# local env files | ||
.env*.local | ||
|
||
# vercel | ||
.vercel | ||
|
||
# typescript | ||
*.tsbuildinfo |
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,6 @@ | ||
.idea | ||
.git | ||
build | ||
dist | ||
.husky | ||
node_modules |
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,15 @@ | ||
{ | ||
"importOrderSeparation": true, | ||
"importOrderSortSpecifiers": true, | ||
"singleQuote": true, | ||
"arrowParens": "avoid", | ||
"bracketSpacing": true, | ||
"semi": true, | ||
"trailingComma": "es5", | ||
"printWidth": 120, | ||
"jsxBracketSameLine": false, | ||
"proseWrap": "always", | ||
"quoteProps": "as-needed", | ||
"tabWidth": 2, | ||
"useTabs": false | ||
} |
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,34 @@ | ||
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). | ||
|
||
## Getting Started | ||
|
||
First, run the development server: | ||
|
||
```bash | ||
npm run dev | ||
# or | ||
yarn dev | ||
``` | ||
|
||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. | ||
|
||
You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file. | ||
|
||
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`. | ||
|
||
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages. | ||
|
||
## Learn More | ||
|
||
To learn more about Next.js, take a look at the following resources: | ||
|
||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. | ||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. | ||
|
||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! | ||
|
||
## Deploy on Vercel | ||
|
||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. | ||
|
||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. |
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,14 @@ | ||
import styled from 'styled-components'; | ||
import RouterLink from 'next/link'; | ||
|
||
export const Ad = styled.section` | ||
position: relative; | ||
background-color: #ff9a9b; | ||
font-size: 24px; | ||
text-align: center; | ||
padding: 48px; | ||
`; | ||
|
||
export const Link = styled(RouterLink)` | ||
color: black; | ||
`; |
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,16 @@ | ||
import { useAd } from '../../providers/Ad.provider'; | ||
import * as S from './Ad.styled'; | ||
|
||
const Ad = () => { | ||
const { | ||
adList: [{ text, redirectUrl } = { text: '', redirectUrl: '' }], | ||
} = useAd(); | ||
|
||
return ( | ||
<S.Ad> | ||
<S.Link href={redirectUrl}>{text}</S.Link> | ||
</S.Ad> | ||
); | ||
}; | ||
|
||
export default Ad; |
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 @@ | ||
export { default } from './Ad'; |
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,22 @@ | ||
import styled, { css } from 'styled-components'; | ||
|
||
const Button = styled.button<{ $type?: 'primary' | 'secondary' }>` | ||
background-color: #ce0631; | ||
color: white; | ||
display: inline-block; | ||
border: solid 1px #ce0631; | ||
padding: 8px 16px; | ||
outline: none; | ||
font-size: 14px; | ||
border-radius: 22px; | ||
cursor: pointer; | ||
${({ $type = 'primary' }) => | ||
$type === 'secondary' && | ||
css` | ||
background: none; | ||
color: #ce0631; | ||
`}; | ||
`; | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import Link from 'next/link'; | ||
import styled from 'styled-components'; | ||
|
||
export const CartIcon = styled(Link).attrs({ | ||
as: 'a', | ||
})` | ||
position: relative; | ||
display: block; | ||
margin-left: 25px; | ||
display: flex; | ||
flex-flow: column; | ||
align-items: center; | ||
justify-content: center; | ||
`; | ||
|
||
export const Icon = styled.img` | ||
width: 20px; | ||
height: 20px; | ||
margin-bottom: 3px; | ||
`; | ||
|
||
export const ItemsCount = styled.span` | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
position: absolute; | ||
top: 24px; | ||
left: 11px; | ||
width: 16px; | ||
height: 16px; | ||
font-size: 11px; | ||
border-radius: 4px 4px 0 4px; | ||
color: white; | ||
background-color: #853b5c; | ||
`; |
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,19 @@ | ||
import { useCart } from '../../providers/Cart.provider'; | ||
import * as S from './CartIcon.styled'; | ||
|
||
const CartIcon = () => { | ||
const { | ||
cart: { items }, | ||
} = useCart(); | ||
|
||
return ( | ||
<S.CartIcon href="/cart"> | ||
<> | ||
<S.Icon src="/icons/Hipster_CartIcon.svg" alt="Cart icon" title="Cart" /> | ||
{!!items.length && <S.ItemsCount>{items.length}</S.ItemsCount>} | ||
</> | ||
</S.CartIcon> | ||
); | ||
}; | ||
|
||
export default CartIcon; |
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 @@ | ||
export { default } from './CartIcon'; |
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,36 @@ | ||
import Link from 'next/link'; | ||
import { Product } from '../../protos/demo'; | ||
import ProductPrice from '../ProductPrice'; | ||
import * as S from './CartItems.styled'; | ||
|
||
interface IProps { | ||
product: Product; | ||
quantity: number; | ||
} | ||
|
||
const CartItem = ({ | ||
product: { id, name, picture, priceUsd = { units: 0, nanos: 0, currencyCode: 'USD' } }, | ||
quantity, | ||
}: IProps) => { | ||
return ( | ||
<S.CartItem> | ||
<Link href={`/product/${id}`}> | ||
<S.CartItemImage alt={name} src={picture} /> | ||
</Link> | ||
<S.CartItemDetails> | ||
<div> | ||
<h5>{name}</h5> | ||
<p>SKU #{id}</p> | ||
</div> | ||
<S.PriceContainer> | ||
<p>Quantity: {quantity}</p> | ||
<p> | ||
<ProductPrice price={priceUsd} /> | ||
</p> | ||
</S.PriceContainer> | ||
</S.CartItemDetails> | ||
</S.CartItem> | ||
); | ||
}; | ||
|
||
export default CartItem; |
Oops, something went wrong.