From 43cd5987417e6a7f446dbcf166ea602c4c1c02f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Hern=C3=A1ndez=20Gaitan?= Date: Tue, 5 Jan 2021 23:05:32 -0600 Subject: [PATCH] state product, store product --- .eslintrc.json | 3 +- README.md | 2 + components/container/Header/products.js | 78 +++-- .../Header/{ => styles}/productsStyle.js | 34 +- components/container/section/catalogo.js | 2 +- components/device.js | 5 +- components/productList.js | 308 +++++++++--------- components/styles/productList.js | 8 +- pages/404.js | 10 +- pages/API/server.js | 52 --- pages/catalogo.js | 4 +- pages/index.js | 8 + pages/products.js | 13 +- pages/products/[brand]/[device].js | 57 ++++ pages/trends.js | 104 +++--- {pages/API => public/data}/index.json | 0 {pages/API => public/data}/products.json | 0 public/static/images/loading.gif | Bin 30952 -> 21870 bytes public/static/images/test.png | Bin 0 -> 1482 bytes store.js | 15 +- 20 files changed, 395 insertions(+), 308 deletions(-) rename components/container/Header/{ => styles}/productsStyle.js (98%) delete mode 100644 pages/API/server.js create mode 100644 pages/products/[brand]/[device].js rename {pages/API => public/data}/index.json (100%) rename {pages/API => public/data}/products.json (100%) create mode 100644 public/static/images/test.png diff --git a/.eslintrc.json b/.eslintrc.json index cd74fab..84502b5 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -27,7 +27,8 @@ "react/prop-types": "off", "react/react-in-jsx-scope": "off", "indent": ["error", 4], - "space-before-function-paren": "off" + "space-before-function-paren": "off", + "comma-dangle": "off" }, "ignorePatterns": ["build/*"] } diff --git a/README.md b/README.md index 472297d..2495b67 100644 --- a/README.md +++ b/README.md @@ -19,3 +19,5 @@ # Linter **npm run lint** + +# El sitio acaba de pasar de CRA a Nextjs, se continua solucionando bugs diff --git a/components/container/Header/products.js b/components/container/Header/products.js index 7755ba8..7eb021c 100644 --- a/components/container/Header/products.js +++ b/components/container/Header/products.js @@ -1,44 +1,46 @@ import React, { useState } from 'react' -import styles from './productsStyle' +import { useRouter } from 'next/router' import Link from 'next/link' +import styles from './styles/productsStyle' // import baseContext from 'context/descriptionContext' -function Producthead () { +function Producthead() { const [active, setActive] = useState(null) const [formActive, setFormActive] = useState('search') + const { device } = useRouter().query - function loadSideNav () { + function loadSideNav() { setActive(null) } // Ordenar por potencia, precio, camara, Más comprado, Marca en especifico, - function openMenu () { + function openMenu() { setActive('active') } - function getData () { + function getData() { console.log('xd') } - function toggleInput () { + function toggleInput() { console.log('click') formActive === 'search' ? setFormActive('search active') : setFormActive('search') } - function searchDevices (e) { + function searchDevices(e) { e.preventDefault() const formData = new FormData(e.currentTarget) getData(formData) } - function blurInput () { + function blurInput() { setFormActive('search') } - function onkeyDown (e) { + function onkeyDown(e) { if (e.keyCode === 27) { setFormActive('search') } @@ -71,61 +73,87 @@ function Producthead () { @@ -134,7 +162,7 @@ function Producthead () { -

Agua xd

+

{device}