ver mais
diff --git a/src/components/productItem/style.js b/src/components/productItem/style.js
index 42de8a55..93d5249a 100644
--- a/src/components/productItem/style.js
+++ b/src/components/productItem/style.js
@@ -2,13 +2,13 @@ import styled from "styled-components";
export const Container = styled.div`
+ display: flex;
+ justify-content: center;
+ flex: 1 1 6rem;
border: 0.1px solid #B2B2B2;
border-radius: 10px;
max-width: 12rem;
- display: flex;
- justify-content: center;
padding: 0.6rem;
- flex: 1 1 12rem;
margin: 10px 10px;
img{
@@ -17,6 +17,8 @@ export const Container = styled.div`
}
div{
+ text-align: center;
+ max-width: 100%;
&:hover{
product_name{
@@ -35,35 +37,34 @@ export const Container = styled.div`
text-overflow: ellipsis;
text-align: left;
line-height: 1.5em;
+ min-height: 3rem;
margin: 0.5rem 0;
text-decoration: none;
&:hover{
text-decoration: underline;
}
- }
-
+ }
}
p{
+ margin-top: 0.8rem;
+ text-align: left;
opacity: 0.8;
}
div_see_more {
- margin-top: 0.8rem;
width: 100%;
+ margin-top: 0.8rem;
padding-top: 0.5rem;
border-top: 0.1px solid #B2B2B2;
- text-align: center;
+ justify-content: center;
a{
- margin-top: 4rem;
text-decoration: none;
opacity: 0.8;
}
}
-
-
}
@@ -74,6 +75,11 @@ export const Container = styled.div`
img{
max-width: 5rem;
}
+
+ a{
+ font-size: 12px;
+ max-width: 7rem;
+ }
}
}
`;
\ No newline at end of file
diff --git a/src/components/sectionProducts/index.jsx b/src/components/sectionProducts/index.jsx
index 8ad0ade4..9fe638c6 100644
--- a/src/components/sectionProducts/index.jsx
+++ b/src/components/sectionProducts/index.jsx
@@ -1,20 +1,25 @@
import { ProductItem } from "../productItem"
import { Container } from "./style"
-const SectionProducts = () => {
+
+
+const SectionProducts = (props) => {
+ console.log(props.products)
return (
-
-
-
-
-
-
-
-
-
-
-
-
+ {
+ props.products.map((product) => {
+ console.log(product)
+ return (
+
+ )
+ })
+
+ }
)
diff --git a/src/components/sectionProducts/style.js b/src/components/sectionProducts/style.js
index 3384d87f..f2416230 100644
--- a/src/components/sectionProducts/style.js
+++ b/src/components/sectionProducts/style.js
@@ -2,7 +2,8 @@ import styled from "styled-components";
export const Container = styled.section`
display: flex;
- margin-top: 4rem;
+ margin-top: 3rem;
flex-wrap: wrap;
max-width: 120rem;
+ justify-content: center;
`;
\ No newline at end of file
diff --git a/src/mocks/products.json b/src/mocks/products.json
new file mode 100644
index 00000000..73d2fb8c
--- /dev/null
+++ b/src/mocks/products.json
@@ -0,0 +1,1145 @@
+{
+ "products": [
+ {
+ "description": "ACUCAR",
+ "gtin": 7896032503052,
+ "width": null,
+ "height": null,
+ "length": null,
+ "net_weight": null,
+ "gross_weight": null,
+ "created_at": "2014-04-24T11:07:34.000-03:00",
+ "updated_at": "2023-01-13T05:11:00.000-03:00",
+ "release_date": null,
+ "price": null,
+ "avg_price": null,
+ "max_price": 0.0,
+ "min_price": 0.0,
+ "gtins": [
+ {
+ "gtin": 7896032503052,
+ "commercial_unit": {
+ "type_packaging": "Unidade",
+ "quantity_packaging": 1,
+ "ballast": null,
+ "layer": null
+ }
+ }
+ ],
+ "origin": "COSMOS",
+ "barcode_image": "https://api.cosmos.bluesoft.com.br/products/barcode/FD73D264032FFA1239BF3911ACFC7B75.png",
+ "gpc": {
+ "code": "10000043",
+ "description": "Açúcar / Substitutos do Açúcar (Não perecível)"
+ },
+ "ncm": {
+ "code": "17011300",
+ "description": "Açúcar de cana mencionado na Nota de subposição 2 do presente Capítulo",
+ "full_description": "Açúcares e produtos de confeitaria - Açúcares de cana ou de beterraba e sacarose quimicamente pura, no estado sólido. - Açúcares brutos sem adição de aromatizantes ou de corantes: - Açúcar de cana mencionado na Nota de subposição 2 do presente Capítulo",
+ "ex": null
+ }
+ },
+ {
+ "description": "ACUCAR CONF.BRETZKE",
+ "gtin": 7896072002034,
+ "width": 0.0,
+ "height": 0.0,
+ "length": 0.0,
+ "net_weight": null,
+ "gross_weight": null,
+ "created_at": "2015-01-14T22:00:00.000-02:00",
+ "updated_at": "2022-05-25T15:37:44.000-03:00",
+ "release_date": null,
+ "price": null,
+ "avg_price": null,
+ "max_price": 0.0,
+ "min_price": 0.0,
+ "gtins": [
+ {
+ "gtin": 7896072002034,
+ "commercial_unit": {
+ "type_packaging": "Unidade",
+ "quantity_packaging": 1,
+ "ballast": null,
+ "layer": null
+ }
+ }
+ ],
+ "origin": "COSMOS",
+ "barcode_image": "https://api.cosmos.bluesoft.com.br/products/barcode/19EEEBBB3169A054D7C74546BA26B7CB.png",
+ "gpc": {
+ "code": "10000043",
+ "description": "Açúcar / Substitutos do Açúcar (Não perecível)"
+ },
+ "ncm": {
+ "code": "17019100",
+ "description": "Adicionados de aromatizantes ou de corantes",
+ "full_description": "Açúcares e produtos de confeitaria - Açúcares de cana ou de beterraba e sacarose quimicamente pura, no estado sólido. - Outros: - Adicionados de aromatizantes ou de corantes",
+ "ex": null
+ }
+ },
+ {
+ "description": "ACUCAR CONFEITARIA",
+ "gtin": 7896087100114,
+ "width": 0.0,
+ "height": 0.0,
+ "length": 0.0,
+ "net_weight": 1,
+ "gross_weight": 1,
+ "created_at": "2016-03-18T16:38:30.000-03:00",
+ "updated_at": "2022-05-04T09:09:31.000-03:00",
+ "release_date": null,
+ "price": null,
+ "avg_price": null,
+ "max_price": 0.0,
+ "min_price": 0.0,
+ "gtins": [
+ {
+ "gtin": 7896087100114,
+ "commercial_unit": {
+ "type_packaging": "Kilo",
+ "quantity_packaging": 1,
+ "ballast": null,
+ "layer": null
+ }
+ }
+ ],
+ "origin": "COSMOS",
+ "barcode_image": "https://api.cosmos.bluesoft.com.br/products/barcode/4D990B3D711BA29A606480778F8228F4.png",
+ "ncm": {
+ "code": "17049090",
+ "description": "Outros",
+ "full_description": "Açúcares e produtos de confeitaria - Produtos de confeitaria, sem cacau (incluído o chocolate branco) - Outros - Outros",
+ "ex": null
+ }
+ },
+ {
+ "description": "ACUCAR REF.DOLCE",
+ "gtin": 7896060102210,
+ "thumbnail": "https://cdn-cosmos.bluesoft.com.br/products/7896060102210",
+ "width": null,
+ "height": null,
+ "length": null,
+ "net_weight": null,
+ "gross_weight": null,
+ "created_at": "2014-04-24T11:07:34.000-03:00",
+ "updated_at": "2023-01-15T19:01:18.000-03:00",
+ "release_date": null,
+ "price": null,
+ "avg_price": null,
+ "max_price": 0.0,
+ "min_price": 0.0,
+ "gtins": [
+ {
+ "gtin": 7896060102210,
+ "commercial_unit": {
+ "type_packaging": "Unidade",
+ "quantity_packaging": 1,
+ "ballast": null,
+ "layer": null
+ }
+ }
+ ],
+ "origin": "COSMOS",
+ "barcode_image": "https://api.cosmos.bluesoft.com.br/products/barcode/269A8C98918E68E651F2F60EBC1CB389.png",
+ "gpc": {
+ "code": "10000043",
+ "description": "Açúcar / Substitutos do Açúcar (Não perecível)"
+ },
+ "ncm": {
+ "code": "17019900",
+ "description": "Outros",
+ "full_description": "Açúcares e produtos de confeitaria - Açúcares de cana ou de beterraba e sacarose quimicamente pura, no estado sólido. - Outros: - Outros",
+ "ex": null
+ }
+ },
+ {
+ "description": "PACOCA S ACUCAR",
+ "gtin": 7898379440755,
+ "width": null,
+ "height": null,
+ "length": null,
+ "net_weight": null,
+ "gross_weight": null,
+ "created_at": "2016-01-19T14:03:12.000-02:00",
+ "updated_at": "2022-05-04T09:09:11.000-03:00",
+ "release_date": null,
+ "price": null,
+ "avg_price": null,
+ "max_price": 0.0,
+ "min_price": 0.0,
+ "gtins": [
+ {
+ "gtin": 7898379440755,
+ "commercial_unit": {
+ "type_packaging": "Unidade",
+ "quantity_packaging": 1,
+ "ballast": null,
+ "layer": null
+ }
+ }
+ ],
+ "origin": "COSMOS",
+ "barcode_image": "https://api.cosmos.bluesoft.com.br/products/barcode/156D76A9D4EEE4064B2A32129099FE5E.png",
+ "ncm": {
+ "code": "20071000",
+ "description": "Preparações homogeneizadas",
+ "full_description": "Preparações de produtos hortícolas, de frutas ou de outras partes de plantas - Doces, geleias, marmelades, purês e pastas de fruta, obtidos por cozimento, mesmo com adição de açúcar ou de outros edulcorantes. - Preparações homogeneizadas",
+ "ex": null
+ }
+ },
+ {
+ "description": "AÇUCAR TOPÇUCAR",
+ "gtin": 7898932776154,
+ "width": null,
+ "height": null,
+ "length": null,
+ "net_weight": null,
+ "gross_weight": null,
+ "created_at": "2018-07-24T15:25:32.000-03:00",
+ "updated_at": "2023-01-03T14:12:55.000-03:00",
+ "release_date": null,
+ "price": null,
+ "avg_price": null,
+ "max_price": 0.0,
+ "min_price": 0.0,
+ "gtins": [
+ {
+ "gtin": 7898932776154,
+ "commercial_unit": {
+ "type_packaging": "Unidade",
+ "quantity_packaging": 1,
+ "ballast": null,
+ "layer": null
+ }
+ }
+ ],
+ "origin": "COSMOS",
+ "barcode_image": "https://api.cosmos.bluesoft.com.br/products/barcode/4C0A555761F3EFB6D7E83F9792AA7603.png",
+ "brand": {
+ "name": "TOPÇÚCAR",
+ "picture": "/assets/brand-placeholder-7080174fbd24025783105a607811edad.png"
+ },
+ "ncm": {
+ "code": "17019900",
+ "description": "Outros",
+ "full_description": "Açúcares e produtos de confeitaria - Açúcares de cana ou de beterraba e sacarose quimicamente pura, no estado sólido. - Outros: - Outros",
+ "ex": null
+ }
+ },
+ {
+ "description": "ACUCAR MASCAVO",
+ "gtin": 7898954007137,
+ "width": null,
+ "height": null,
+ "length": null,
+ "net_weight": null,
+ "gross_weight": null,
+ "created_at": "2016-03-25T15:31:51.000-03:00",
+ "updated_at": "2022-12-20T18:09:42.000-03:00",
+ "release_date": null,
+ "price": null,
+ "avg_price": null,
+ "max_price": 0.0,
+ "min_price": 0.0,
+ "gtins": [
+ {
+ "gtin": 7898954007137,
+ "commercial_unit": {
+ "type_packaging": "Unidade",
+ "quantity_packaging": 1,
+ "ballast": null,
+ "layer": null
+ }
+ }
+ ],
+ "origin": "COSMOS",
+ "barcode_image": "https://api.cosmos.bluesoft.com.br/products/barcode/BD7BF11E714FE43194662C8D9E79E67E.png",
+ "ncm": {
+ "code": "17019900",
+ "description": "Outros",
+ "full_description": "Açúcares e produtos de confeitaria - Açúcares de cana ou de beterraba e sacarose quimicamente pura, no estado sólido. - Outros: - Outros",
+ "ex": null
+ }
+ },
+ {
+ "description": "PACOCA S ACUCAR",
+ "gtin": 7898268910178,
+ "thumbnail": "https://cdn-cosmos.bluesoft.com.br/products/7898268910178",
+ "width": 0.0,
+ "height": 0.0,
+ "length": 0.0,
+ "net_weight": null,
+ "gross_weight": null,
+ "created_at": "2014-04-24T11:07:34.000-03:00",
+ "updated_at": "2023-01-13T03:08:38.000-03:00",
+ "release_date": null,
+ "price": null,
+ "avg_price": null,
+ "max_price": 0.0,
+ "min_price": 0.0,
+ "gtins": [
+ {
+ "gtin": 7898268910178,
+ "commercial_unit": {
+ "type_packaging": "Unidade",
+ "quantity_packaging": 1,
+ "ballast": null,
+ "layer": null
+ }
+ }
+ ],
+ "origin": "COSMOS",
+ "barcode_image": "https://api.cosmos.bluesoft.com.br/products/barcode/9B49B15812B649CD5A9724A30FAE687F.png",
+ "brand": {
+ "name": "AIRON",
+ "picture": "/assets/brand-placeholder-7080174fbd24025783105a607811edad.png"
+ },
+ "ncm": {
+ "code": "20079990",
+ "description": "Outros",
+ "full_description": "Preparações de produtos hortícolas, de frutas ou de outras partes de plantas - Doces, geleias, marmelades, purês e pastas de fruta, obtidos por cozimento, mesmo com adição de açúcar ou de outros edulcorantes. - Outros: - Outros - Outros",
+ "ex": null
+ },
+ "cest": {
+ "id": 2138,
+ "code": "1709400",
+ "description": "Doces, geléias, “marmelades”, purês e pastas de frutas, obtidos por cozimento, com ou sem adição de açúcar ou de outros edulcorantes, em embalagens de conteúdo inferior ou igual a 1 kg, exceto as embalagens individuais de conteúdo inferior ou igual a 10 g",
+ "parent_id": 1671
+ }
+ },
+ {
+ "description": "BISCOITO.CHAMPANHE COM ACUCAR",
+ "gtin": 7891962005324,
+ "thumbnail": "https://cdn-cosmos.bluesoft.com.br/products/7891962005324",
+ "width": null,
+ "height": null,
+ "length": null,
+ "net_weight": null,
+ "gross_weight": null,
+ "created_at": "2016-01-19T14:17:35.000-02:00",
+ "updated_at": "2023-01-12T12:04:01.000-03:00",
+ "release_date": null,
+ "price": null,
+ "avg_price": null,
+ "max_price": 0.0,
+ "min_price": 0.0,
+ "gtins": [
+ {
+ "gtin": 7891962005324,
+ "commercial_unit": {
+ "type_packaging": "Unidade",
+ "quantity_packaging": 1,
+ "ballast": null,
+ "layer": null
+ }
+ },
+ {
+ "gtin": 17891962005321,
+ "commercial_unit": {
+ "type_packaging": "Unidade",
+ "quantity_packaging": 1,
+ "ballast": 0,
+ "layer": 0
+ }
+ }
+ ],
+ "origin": "COSMOS",
+ "barcode_image": "https://api.cosmos.bluesoft.com.br/products/barcode/0390DB751B70B5E4AAD1C519FB35DB27.png",
+ "brand": {
+ "name": "BAUDUCCO",
+ "picture": "https://cdn-cosmos.bluesoft.com.br/brands/brand_bauducco"
+ },
+ "gpc": {
+ "code": "10000161",
+ "description": "Biscoitos / Bolachas (Não perecíveis)"
+ },
+ "ncm": {
+ "code": "19053100",
+ "description": "Bolachas e biscoitos, adicionados de edulcorantes",
+ "full_description": "Preparações à base de cereais, farinhas, amidos, féculas ou de leite; produtos de pastelaria - Produtos de padaria, pastelaria ou da indústria de bolachas e biscoitos, mesmo adicionados de cacau; hóstias, cápsulas vazias para medicamentos, obreias, pastas secas de farinha, amido ou fécula, em folhas, e produtos semelhantes. - Bolachas e biscoitos, adicionados de edulcorantes; waffles e wafers: - Bolachas e biscoitos, adicionados de edulcorantes",
+ "ex": null
+ }
+ },
+ {
+ "description": "ACUCAR GUIMARAES",
+ "gtin": 7896775178135,
+ "thumbnail": "https://cdn-cosmos.bluesoft.com.br/products/7896775178135",
+ "width": null,
+ "height": null,
+ "length": null,
+ "net_weight": null,
+ "gross_weight": null,
+ "created_at": "2014-04-24T11:07:34.000-03:00",
+ "updated_at": "2023-01-13T05:49:28.000-03:00",
+ "release_date": null,
+ "price": null,
+ "avg_price": null,
+ "max_price": 0.0,
+ "min_price": 0.0,
+ "gtins": [
+ {
+ "gtin": 7896775178135,
+ "commercial_unit": {
+ "type_packaging": "Unidade",
+ "quantity_packaging": 1,
+ "ballast": null,
+ "layer": null
+ }
+ },
+ {
+ "gtin": 17896775178132,
+ "commercial_unit": {
+ "type_packaging": "Caixa",
+ "quantity_packaging": 30,
+ "ballast": 7,
+ "layer": 7
+ }
+ }
+ ],
+ "origin": "COSMOS",
+ "barcode_image": "https://api.cosmos.bluesoft.com.br/products/barcode/E4A553F9D83C2F261F1279321C4C2980.png",
+ "brand": {
+ "name": "GUIMARAES",
+ "picture": "/assets/brand-placeholder-7080174fbd24025783105a607811edad.png"
+ },
+ "gpc": {
+ "code": "10000043",
+ "description": "Açúcar / Substitutos do Açúcar (Não perecível)"
+ },
+ "ncm": {
+ "code": "17011400",
+ "description": "Outros açúcares de cana",
+ "full_description": "Açúcares e produtos de confeitaria - Açúcares de cana ou de beterraba e sacarose quimicamente pura, no estado sólido. - Açúcares brutos sem adição de aromatizantes ou de corantes: - Outros açúcares de cana",
+ "ex": null
+ }
+ },
+ {
+ "description": "AÇUCAR PICININ",
+ "gtin": 7896864400222,
+ "width": null,
+ "height": null,
+ "length": null,
+ "net_weight": null,
+ "gross_weight": null,
+ "created_at": "2014-04-24T11:07:34.000-03:00",
+ "updated_at": "2022-06-22T08:37:22.000-03:00",
+ "release_date": null,
+ "price": null,
+ "avg_price": null,
+ "max_price": 0.0,
+ "min_price": 0.0,
+ "gtins": [
+ {
+ "gtin": 7896864400222,
+ "commercial_unit": {
+ "type_packaging": "Unidade",
+ "quantity_packaging": 1,
+ "ballast": null,
+ "layer": null
+ }
+ }
+ ],
+ "origin": "COSMOS",
+ "barcode_image": "https://api.cosmos.bluesoft.com.br/products/barcode/9CE708CA04D66D35FF379D56CCB4AAB3.png",
+ "brand": {
+ "name": "PICININ",
+ "picture": "/assets/brand-placeholder-7080174fbd24025783105a607811edad.png"
+ },
+ "gpc": {
+ "code": "10000043",
+ "description": "Açúcar / Substitutos do Açúcar (Não perecível)"
+ },
+ "ncm": {
+ "code": "17019900",
+ "description": "Outros",
+ "full_description": "Açúcares e produtos de confeitaria - Açúcares de cana ou de beterraba e sacarose quimicamente pura, no estado sólido. - Outros: - Outros",
+ "ex": null
+ }
+ },
+ {
+ "description": "ACUCAR CONFEITEIRO",
+ "gtin": 7897077808287,
+ "width": 0.0,
+ "height": 0.0,
+ "length": 0.0,
+ "net_weight": 1,
+ "gross_weight": 1,
+ "created_at": "2014-04-24T11:07:34.000-03:00",
+ "updated_at": "2023-01-14T01:00:36.000-03:00",
+ "release_date": null,
+ "price": null,
+ "avg_price": null,
+ "max_price": 0.0,
+ "min_price": 0.0,
+ "gtins": [
+ {
+ "gtin": 7897077808287,
+ "commercial_unit": {
+ "type_packaging": "Fardo",
+ "quantity_packaging": 1,
+ "ballast": null,
+ "layer": null
+ }
+ }
+ ],
+ "origin": "COSMOS",
+ "barcode_image": "https://api.cosmos.bluesoft.com.br/products/barcode/02E20FA0ACC2BAF50655016FAA71E030.png",
+ "gpc": {
+ "code": "10000043",
+ "description": "Açúcar / Substitutos do Açúcar (Não perecível)"
+ },
+ "ncm": {
+ "code": "17011300",
+ "description": "Açúcar de cana mencionado na Nota de subposição 2 do presente Capítulo",
+ "full_description": "Açúcares e produtos de confeitaria - Açúcares de cana ou de beterraba e sacarose quimicamente pura, no estado sólido. - Açúcares brutos sem adição de aromatizantes ou de corantes: - Açúcar de cana mencionado na Nota de subposição 2 do presente Capítulo",
+ "ex": null
+ }
+ },
+ {
+ "description": "AÇUCAR CRISTAL 1KG",
+ "gtin": 7898042070029,
+ "width": 0.0,
+ "height": 0.0,
+ "length": 0.0,
+ "net_weight": 0,
+ "gross_weight": 0,
+ "created_at": "2016-04-06T01:18:46.000-03:00",
+ "updated_at": "2022-11-26T11:08:38.000-03:00",
+ "release_date": null,
+ "price": null,
+ "avg_price": null,
+ "max_price": 0.0,
+ "min_price": 0.0,
+ "gtins": [
+ {
+ "gtin": 7898042070029,
+ "commercial_unit": {
+ "type_packaging": "Unidade",
+ "quantity_packaging": 1,
+ "ballast": null,
+ "layer": null
+ }
+ }
+ ],
+ "origin": "COSMOS",
+ "barcode_image": "https://api.cosmos.bluesoft.com.br/products/barcode/BAC1922C01DFD56A5537925F49DF98BD.png",
+ "ncm": {
+ "code": "17011100",
+ "description": "De cana",
+ "full_description": "Açúcares e produtos de confeitaria - Açúcares de cana ou de beterraba e sacarose quimicamente pura, no estado sólido - Açúcares em bruto, sem adição de aromatizantes ou de corantes: - De cana",
+ "ex": null
+ }
+ },
+ {
+ "description": "AÇUCAR CRISTAL 2KG",
+ "gtin": 7898355600142,
+ "width": 0.0,
+ "height": 0.0,
+ "length": 0.0,
+ "net_weight": 0,
+ "gross_weight": 0,
+ "created_at": "2016-04-06T01:36:15.000-03:00",
+ "updated_at": "2022-08-04T13:24:00.000-03:00",
+ "release_date": null,
+ "price": null,
+ "avg_price": null,
+ "max_price": 0.0,
+ "min_price": 0.0,
+ "gtins": [
+ {
+ "gtin": 7898355600142,
+ "commercial_unit": {
+ "type_packaging": "Unidade",
+ "quantity_packaging": 1,
+ "ballast": null,
+ "layer": null
+ }
+ }
+ ],
+ "origin": "COSMOS",
+ "barcode_image": "https://api.cosmos.bluesoft.com.br/products/barcode/7A36EFA4C1C59AE4DE5D44543D2138AF.png",
+ "ncm": {
+ "code": "17011100",
+ "description": "De cana",
+ "full_description": "Açúcares e produtos de confeitaria - Açúcares de cana ou de beterraba e sacarose quimicamente pura, no estado sólido - Açúcares em bruto, sem adição de aromatizantes ou de corantes: - De cana",
+ "ex": null
+ }
+ },
+ {
+ "description": "CHICLE LIXX S / AÇUCAR .",
+ "gtin": 7896321007193,
+ "width": 0.0,
+ "height": 0.0,
+ "length": 0.0,
+ "net_weight": null,
+ "gross_weight": null,
+ "created_at": "2017-06-13T14:39:58.000-03:00",
+ "updated_at": "2021-04-08T14:09:32.000-03:00",
+ "release_date": null,
+ "price": null,
+ "avg_price": null,
+ "max_price": 0.0,
+ "min_price": 0.0,
+ "gtins": [
+ {
+ "gtin": 7896321007193,
+ "commercial_unit": {
+ "type_packaging": "Unidade",
+ "quantity_packaging": 1,
+ "ballast": null,
+ "layer": null
+ }
+ }
+ ],
+ "origin": "COSMOS",
+ "barcode_image": "https://api.cosmos.bluesoft.com.br/products/barcode/5E7C5F36FAC8B713E73437C079390071.png",
+ "brand": {
+ "name": "LIXX",
+ "picture": "/assets/brand-placeholder-7080174fbd24025783105a607811edad.png"
+ },
+ "ncm": {
+ "code": "17041000",
+ "description": "Gomas de mascar (Pastilhas elásticas*), mesmo revestidas de açúcar",
+ "full_description": "Açúcares e produtos de confeitaria - Produtos de confeitaria sem cacau (incluindo o chocolate branco). - Gomas de mascar (Pastilhas elásticas*), mesmo revestidas de açúcar",
+ "ex": null
+ }
+ },
+ {
+ "description": "ACUCAR MASCAVO 350G",
+ "gtin": 7898957516070,
+ "thumbnail": "https://cdn-cosmos.bluesoft.com.br/products/7898957516070",
+ "width": 0.0,
+ "height": 0.0,
+ "length": 0.0,
+ "net_weight": null,
+ "gross_weight": null,
+ "created_at": "2016-06-07T15:56:47.000-03:00",
+ "updated_at": "2023-01-14T01:00:46.000-03:00",
+ "release_date": null,
+ "price": null,
+ "avg_price": null,
+ "max_price": 0.0,
+ "min_price": 0.0,
+ "gtins": [
+ {
+ "gtin": 7898957516070,
+ "commercial_unit": {
+ "type_packaging": "Unidade",
+ "quantity_packaging": 1,
+ "ballast": null,
+ "layer": null
+ }
+ }
+ ],
+ "origin": "COSMOS",
+ "barcode_image": "https://api.cosmos.bluesoft.com.br/products/barcode/BA1590FC4D090B0F4E40997738B66EEB.png",
+ "brand": {
+ "name": "CHOCOLATE VERDE",
+ "picture": "/assets/brand-placeholder-7080174fbd24025783105a607811edad.png"
+ },
+ "ncm": {
+ "code": "17019900",
+ "description": "Outros",
+ "full_description": "Açúcares e produtos de confeitaria - Açúcares de cana ou de beterraba e sacarose quimicamente pura, no estado sólido. - Outros: - Outros",
+ "ex": null
+ },
+ "cest": {
+ "id": 2148,
+ "code": "1709900",
+ "description": "Açúcar refinado, em embalagens de conteúdo inferior ou igual a 2 kg, exceto as embalagens contendo envelopes individualizados (sachês) de conteúdo inferior ou igual a 10 g",
+ "parent_id": 1671
+ }
+ },
+ {
+ "description": "ACUCAR FEST.CONFEITEIRO 1KG",
+ "gtin": 7898264510051,
+ "width": 0.0,
+ "height": 0.0,
+ "length": 0.0,
+ "net_weight": 1,
+ "gross_weight": 1,
+ "created_at": "2016-04-06T00:58:07.000-03:00",
+ "updated_at": "2022-08-04T12:10:08.000-03:00",
+ "release_date": null,
+ "price": null,
+ "avg_price": null,
+ "max_price": 0.0,
+ "min_price": 0.0,
+ "gtins": [
+ {
+ "gtin": 7898264510051,
+ "commercial_unit": {
+ "type_packaging": "Unidade",
+ "quantity_packaging": 1,
+ "ballast": null,
+ "layer": null
+ }
+ }
+ ],
+ "origin": "COSMOS",
+ "barcode_image": "https://api.cosmos.bluesoft.com.br/products/barcode/184BD2B02C56A7EC6587FC66E5F47A0C.png",
+ "ncm": {
+ "code": "17019900",
+ "description": "Outros",
+ "full_description": "Açúcares e produtos de confeitaria - Açúcares de cana ou de beterraba e sacarose quimicamente pura, no estado sólido. - Outros: - Outros",
+ "ex": null
+ }
+ },
+ {
+ "description": "AÇUCAR CRISTAL 1KG",
+ "gtin": 7896576200202,
+ "width": 0.0,
+ "height": 0.0,
+ "length": 0.0,
+ "net_weight": 0,
+ "gross_weight": 0,
+ "created_at": "2016-04-06T01:19:09.000-03:00",
+ "updated_at": "2022-11-26T11:10:07.000-03:00",
+ "release_date": null,
+ "price": null,
+ "avg_price": null,
+ "max_price": 0.0,
+ "min_price": 0.0,
+ "gtins": [
+ {
+ "gtin": 7896576200202,
+ "commercial_unit": {
+ "type_packaging": "Unidade",
+ "quantity_packaging": 1,
+ "ballast": null,
+ "layer": null
+ }
+ }
+ ],
+ "origin": "COSMOS",
+ "barcode_image": "https://api.cosmos.bluesoft.com.br/products/barcode/08203CF8014F0597F1EEF2790ACC912F.png",
+ "ncm": {
+ "code": "17011100",
+ "description": "De cana",
+ "full_description": "Açúcares e produtos de confeitaria - Açúcares de cana ou de beterraba e sacarose quimicamente pura, no estado sólido - Açúcares em bruto, sem adição de aromatizantes ou de corantes: - De cana",
+ "ex": null
+ }
+ },
+ {
+ "description": "AÇUCAR CRISTAL 1KG",
+ "gtin": 7898994105343,
+ "width": 0.0,
+ "height": 0.0,
+ "length": 0.0,
+ "net_weight": 0,
+ "gross_weight": 0,
+ "created_at": "2016-04-06T01:19:11.000-03:00",
+ "updated_at": "2022-07-05T11:04:43.000-03:00",
+ "release_date": null,
+ "price": null,
+ "avg_price": null,
+ "max_price": 0.0,
+ "min_price": 0.0,
+ "gtins": [
+ {
+ "gtin": 7898994105343,
+ "commercial_unit": {
+ "type_packaging": "Unidade",
+ "quantity_packaging": 1,
+ "ballast": null,
+ "layer": null
+ }
+ }
+ ],
+ "origin": "COSMOS",
+ "barcode_image": "https://api.cosmos.bluesoft.com.br/products/barcode/E6E75AC8F64F649DD2402CBA553D3B46.png",
+ "ncm": {
+ "code": "17011100",
+ "description": "De cana",
+ "full_description": "Açúcares e produtos de confeitaria - Açúcares de cana ou de beterraba e sacarose quimicamente pura, no estado sólido - Açúcares em bruto, sem adição de aromatizantes ou de corantes: - De cana",
+ "ex": null
+ }
+ },
+ {
+ "description": "AÇUCAR CRISTAL 5KG",
+ "gtin": 7898903262051,
+ "width": 0.0,
+ "height": 0.0,
+ "length": 0.0,
+ "net_weight": 0,
+ "gross_weight": 0,
+ "created_at": "2016-04-06T01:23:01.000-03:00",
+ "updated_at": "2022-12-11T14:02:58.000-03:00",
+ "release_date": null,
+ "price": null,
+ "avg_price": null,
+ "max_price": 0.0,
+ "min_price": 0.0,
+ "gtins": [
+ {
+ "gtin": 7898903262051,
+ "commercial_unit": {
+ "type_packaging": "Unidade",
+ "quantity_packaging": 1,
+ "ballast": null,
+ "layer": null
+ }
+ }
+ ],
+ "origin": "COSMOS",
+ "barcode_image": "https://api.cosmos.bluesoft.com.br/products/barcode/11228394632641B28025A773F023259C.png",
+ "ncm": {
+ "code": "17011100",
+ "description": "De cana",
+ "full_description": "Açúcares e produtos de confeitaria - Açúcares de cana ou de beterraba e sacarose quimicamente pura, no estado sólido - Açúcares em bruto, sem adição de aromatizantes ou de corantes: - De cana",
+ "ex": null
+ }
+ },
+ {
+ "description": "AÇUCAR CRISTAL 2KG",
+ "gtin": 7898938738026,
+ "width": 0.0,
+ "height": 0.0,
+ "length": 0.0,
+ "net_weight": 0,
+ "gross_weight": 0,
+ "created_at": "2016-04-06T01:30:34.000-03:00",
+ "updated_at": "2022-11-26T11:10:38.000-03:00",
+ "release_date": null,
+ "price": null,
+ "avg_price": null,
+ "max_price": 0.0,
+ "min_price": 0.0,
+ "gtins": [
+ {
+ "gtin": 7898938738026,
+ "commercial_unit": {
+ "type_packaging": "Unidade",
+ "quantity_packaging": 1,
+ "ballast": null,
+ "layer": null
+ }
+ }
+ ],
+ "origin": "COSMOS",
+ "barcode_image": "https://api.cosmos.bluesoft.com.br/products/barcode/D07F471A796B2425320CE565D9A6E578.png",
+ "ncm": {
+ "code": "17011100",
+ "description": "De cana",
+ "full_description": "Açúcares e produtos de confeitaria - Açúcares de cana ou de beterraba e sacarose quimicamente pura, no estado sólido - Açúcares em bruto, sem adição de aromatizantes ou de corantes: - De cana",
+ "ex": null
+ }
+ },
+ {
+ "description": "AÇUCAR CRISTAL 1KG",
+ "gtin": 7898355600074,
+ "width": 0.0,
+ "height": 0.0,
+ "length": 0.0,
+ "net_weight": 0,
+ "gross_weight": 0,
+ "created_at": "2016-04-06T01:30:30.000-03:00",
+ "updated_at": "2022-11-26T11:10:48.000-03:00",
+ "release_date": null,
+ "price": null,
+ "avg_price": null,
+ "max_price": 0.0,
+ "min_price": 0.0,
+ "gtins": [
+ {
+ "gtin": 7898355600074,
+ "commercial_unit": {
+ "type_packaging": "Unidade",
+ "quantity_packaging": 1,
+ "ballast": null,
+ "layer": null
+ }
+ }
+ ],
+ "origin": "COSMOS",
+ "barcode_image": "https://api.cosmos.bluesoft.com.br/products/barcode/7A36EFA4C1C59AE402991D4428667AEC.png",
+ "ncm": {
+ "code": "17011100",
+ "description": "De cana",
+ "full_description": "Açúcares e produtos de confeitaria - Açúcares de cana ou de beterraba e sacarose quimicamente pura, no estado sólido - Açúcares em bruto, sem adição de aromatizantes ou de corantes: - De cana",
+ "ex": null
+ }
+ },
+ {
+ "description": "AÇUCAR CRISTAL 2KG",
+ "gtin": 7898368480021,
+ "width": 0.0,
+ "height": 0.0,
+ "length": 0.0,
+ "net_weight": 0,
+ "gross_weight": 0,
+ "created_at": "2016-04-06T01:25:13.000-03:00",
+ "updated_at": "2022-04-11T22:45:55.000-03:00",
+ "release_date": null,
+ "price": null,
+ "avg_price": null,
+ "max_price": 0.0,
+ "min_price": 0.0,
+ "gtins": [
+ {
+ "gtin": 7898368480021,
+ "commercial_unit": {
+ "type_packaging": "Unidade",
+ "quantity_packaging": 1,
+ "ballast": null,
+ "layer": null
+ }
+ }
+ ],
+ "origin": "COSMOS",
+ "barcode_image": "https://api.cosmos.bluesoft.com.br/products/barcode/98C4143F0132780ED0A1B98ED64F93F9.png",
+ "ncm": {
+ "code": "17011100",
+ "description": "De cana",
+ "full_description": "Açúcares e produtos de confeitaria - Açúcares de cana ou de beterraba e sacarose quimicamente pura, no estado sólido - Açúcares em bruto, sem adição de aromatizantes ou de corantes: - De cana",
+ "ex": null
+ }
+ },
+ {
+ "description": "AÇUCAR CRISTAL 5KG",
+ "gtin": 7898994105398,
+ "width": 0.0,
+ "height": 0.0,
+ "length": 0.0,
+ "net_weight": 0,
+ "gross_weight": 0,
+ "created_at": "2016-04-06T01:25:15.000-03:00",
+ "updated_at": "2022-05-14T15:20:13.000-03:00",
+ "release_date": null,
+ "price": null,
+ "avg_price": null,
+ "max_price": 0.0,
+ "min_price": 0.0,
+ "gtins": [
+ {
+ "gtin": 7898994105398,
+ "commercial_unit": {
+ "type_packaging": "Unidade",
+ "quantity_packaging": 1,
+ "ballast": null,
+ "layer": null
+ }
+ }
+ ],
+ "origin": "COSMOS",
+ "barcode_image": "https://api.cosmos.bluesoft.com.br/products/barcode/E6E75AC8F64F649D67A5F8AFE8956108.png",
+ "ncm": {
+ "code": "17019900",
+ "description": "Outros",
+ "full_description": "Açúcares e produtos de confeitaria - Açúcares de cana ou de beterraba e sacarose quimicamente pura, no estado sólido. - Outros: - Outros",
+ "ex": null
+ }
+ },
+ {
+ "description": "AÇUCAR CRISTAL 5KG",
+ "gtin": 7898994111917,
+ "width": 0.0,
+ "height": 0.0,
+ "length": 0.0,
+ "net_weight": 0,
+ "gross_weight": 0,
+ "created_at": "2016-04-06T01:25:21.000-03:00",
+ "updated_at": "2022-12-29T11:11:41.000-03:00",
+ "release_date": null,
+ "price": null,
+ "avg_price": null,
+ "max_price": 0.0,
+ "min_price": 0.0,
+ "gtins": [
+ {
+ "gtin": 7898994111917,
+ "commercial_unit": {
+ "type_packaging": "Unidade",
+ "quantity_packaging": 1,
+ "ballast": null,
+ "layer": null
+ }
+ }
+ ],
+ "origin": "COSMOS",
+ "barcode_image": "https://api.cosmos.bluesoft.com.br/products/barcode/E6E75AC8F64F649D203862AC2D8731E3.png",
+ "ncm": {
+ "code": "17011100",
+ "description": "De cana",
+ "full_description": "Açúcares e produtos de confeitaria - Açúcares de cana ou de beterraba e sacarose quimicamente pura, no estado sólido - Açúcares em bruto, sem adição de aromatizantes ou de corantes: - De cana",
+ "ex": null
+ }
+ },
+ {
+ "description": "AÇUCAR CRISTAL 5KG",
+ "gtin": 7898938738019,
+ "width": 0.0,
+ "height": 0.0,
+ "length": 0.0,
+ "net_weight": 0,
+ "gross_weight": 0,
+ "created_at": "2016-04-06T01:25:12.000-03:00",
+ "updated_at": "2022-11-15T17:43:46.000-03:00",
+ "release_date": null,
+ "price": null,
+ "avg_price": null,
+ "max_price": 0.0,
+ "min_price": 0.0,
+ "gtins": [
+ {
+ "gtin": 7898938738019,
+ "commercial_unit": {
+ "type_packaging": "Unidade",
+ "quantity_packaging": 1,
+ "ballast": null,
+ "layer": null
+ }
+ }
+ ],
+ "origin": "COSMOS",
+ "barcode_image": "https://api.cosmos.bluesoft.com.br/products/barcode/D07F471A796B2425EB3619ECD145675C.png",
+ "ncm": {
+ "code": "17011100",
+ "description": "De cana",
+ "full_description": "Açúcares e produtos de confeitaria - Açúcares de cana ou de beterraba e sacarose quimicamente pura, no estado sólido - Açúcares em bruto, sem adição de aromatizantes ou de corantes: - De cana",
+ "ex": null
+ }
+ },
+ {
+ "description": "AÇUCAR CRISTAL 5KG",
+ "gtin": 7898368480014,
+ "width": 0.0,
+ "height": 0.0,
+ "length": 0.0,
+ "net_weight": 0,
+ "gross_weight": 0,
+ "created_at": "2016-04-06T01:25:12.000-03:00",
+ "updated_at": "2022-05-23T19:08:44.000-03:00",
+ "release_date": null,
+ "price": null,
+ "avg_price": null,
+ "max_price": 0.0,
+ "min_price": 0.0,
+ "gtins": [
+ {
+ "gtin": 7898368480014,
+ "commercial_unit": {
+ "type_packaging": "Unidade",
+ "quantity_packaging": 1,
+ "ballast": null,
+ "layer": null
+ }
+ }
+ ],
+ "origin": "COSMOS",
+ "barcode_image": "https://api.cosmos.bluesoft.com.br/products/barcode/98C4143F0132780E5208E889537837D8.png",
+ "ncm": {
+ "code": "17019900",
+ "description": "Outros",
+ "full_description": "Açúcares e produtos de confeitaria - Açúcares de cana ou de beterraba e sacarose quimicamente pura, no estado sólido. - Outros: - Outros",
+ "ex": null
+ }
+ },
+ {
+ "description": "AÇUCAR CRISTAL 5KG",
+ "gtin": 7898926037063,
+ "width": 0.0,
+ "height": 0.0,
+ "length": 0.0,
+ "net_weight": 0,
+ "gross_weight": 0,
+ "created_at": "2016-04-06T01:33:20.000-03:00",
+ "updated_at": "2022-06-04T13:53:25.000-03:00",
+ "release_date": null,
+ "price": null,
+ "avg_price": null,
+ "max_price": 0.0,
+ "min_price": 0.0,
+ "gtins": [
+ {
+ "gtin": 7898926037063,
+ "commercial_unit": {
+ "type_packaging": "Unidade",
+ "quantity_packaging": 1,
+ "ballast": null,
+ "layer": null
+ }
+ }
+ ],
+ "origin": "COSMOS",
+ "barcode_image": "https://api.cosmos.bluesoft.com.br/products/barcode/346AF44333E690A6710A32974C51B6D0.png",
+ "ncm": {
+ "code": "17011100",
+ "description": "De cana",
+ "full_description": "Açúcares e produtos de confeitaria - Açúcares de cana ou de beterraba e sacarose quimicamente pura, no estado sólido - Açúcares em bruto, sem adição de aromatizantes ou de corantes: - De cana",
+ "ex": null
+ }
+ },
+ {
+ "description": "AÇUCAR CRISTAL 2KG",
+ "gtin": 7898163430023,
+ "width": 0.0,
+ "height": 0.0,
+ "length": 0.0,
+ "net_weight": 0,
+ "gross_weight": 0,
+ "created_at": "2016-04-06T01:33:20.000-03:00",
+ "updated_at": "2022-03-24T11:47:52.000-03:00",
+ "release_date": null,
+ "price": null,
+ "avg_price": null,
+ "max_price": 0.0,
+ "min_price": 0.0,
+ "gtins": [
+ {
+ "gtin": 7898163430023,
+ "commercial_unit": {
+ "type_packaging": "Unidade",
+ "quantity_packaging": 1,
+ "ballast": null,
+ "layer": null
+ }
+ }
+ ],
+ "origin": "COSMOS",
+ "barcode_image": "https://api.cosmos.bluesoft.com.br/products/barcode/F0E7D557600E314A4C819EFA8BDD7401.png",
+ "ncm": {
+ "code": "17011100",
+ "description": "De cana",
+ "full_description": "Açúcares e produtos de confeitaria - Açúcares de cana ou de beterraba e sacarose quimicamente pura, no estado sólido - Açúcares em bruto, sem adição de aromatizantes ou de corantes: - De cana",
+ "ex": null
+ }
+ },
+ {
+ "description": "AÇUCAR CRISTAL 5KG",
+ "gtin": 7898088870201,
+ "width": 0.0,
+ "height": 0.0,
+ "length": 0.0,
+ "net_weight": 0,
+ "gross_weight": 0,
+ "created_at": "2016-04-06T01:33:20.000-03:00",
+ "updated_at": "2021-07-11T10:18:57.000-03:00",
+ "release_date": null,
+ "price": null,
+ "avg_price": null,
+ "max_price": 0.0,
+ "min_price": 0.0,
+ "gtins": [
+ {
+ "gtin": 7898088870201,
+ "commercial_unit": {
+ "type_packaging": "Unidade",
+ "quantity_packaging": 1,
+ "ballast": null,
+ "layer": null
+ }
+ }
+ ],
+ "origin": "COSMOS",
+ "barcode_image": "https://api.cosmos.bluesoft.com.br/products/barcode/4CD3535E6499764EB842313B20C746B6.png",
+ "ncm": {
+ "code": "17011100",
+ "description": "De cana",
+ "full_description": "Açúcares e produtos de confeitaria - Açúcares de cana ou de beterraba e sacarose quimicamente pura, no estado sólido - Açúcares em bruto, sem adição de aromatizantes ou de corantes: - De cana",
+ "ex": null
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/src/pages/index.js b/src/pages/index.js
index db3ea08f..e732c072 100644
--- a/src/pages/index.js
+++ b/src/pages/index.js
@@ -1,15 +1,45 @@
import { FormSearchProducts } from "../components/formSearchProducts";
import { Header } from "../components/header";
import { SectionProducts } from "../components/sectionProducts";
+import { api } from "../services/api";
import { GlobalStyle } from "../styles/global";
-export default function Home() {
+export default function Home(props) {
+
+ const mocks = {
+ exemplo: require("../mocks/products.json")
+ }
+
+
+
return (
-
+
)
}
+
+///9?name=sla
+
+export async function getServerSideProps(context) {
+
+ const { name } = context.query
+
+ let products = null;
+
+ // if (name) {
+ // const { data } = await api.get(`/products?query=${name}`)
+ // products = data
+ // }
+
+
+
+ return {
+ props: {
+ products
+ }
+ }
+}
diff --git a/src/services/api.js b/src/services/api.js
new file mode 100644
index 00000000..27d8b457
--- /dev/null
+++ b/src/services/api.js
@@ -0,0 +1,34 @@
+import axios from "axios";
+
+const tokenBluesoft = process.env.TOKEN_BLUESOFT_COSMOS;
+
+export const api = axios.create({
+ baseURL: "https://api.cosmos.bluesoft.com.br",
+ headers: { 'X-Cosmos-Token': "DytjRBuVJC5Gmd3dwUZxLA" },
+ validateStatus: () => true
+
+})
+
+export async function getProductByGtin(gtin) {
+ try {
+ const { status, data } = await api.get(`gtins/${gtin}`)
+ return {
+ status: status,
+ data: data
+ }
+ } catch (error) {
+ console.log(error);
+ }
+}
+
+export async function getProductByName(name) {
+ try {
+ const { status, data } = await api.get(`gtins/${gtin}`)
+ return {
+ status: status,
+ data: data
+ }
+ } catch (error) {
+ console.log(error);
+ }
+}
\ No newline at end of file
diff --git a/src/utils/titleCase.js b/src/utils/titleCase.js
new file mode 100644
index 00000000..9d6a94e7
--- /dev/null
+++ b/src/utils/titleCase.js
@@ -0,0 +1,12 @@
+export const titleCase = text => {
+
+ if (text?.length > 0) {
+ return text.toLowerCase()
+ .split(' ')
+ .map((word) => {
+ return word[0].toUpperCase() + word.slice(1);
+ }).join(' ')
+ }
+
+ return ""
+}
\ No newline at end of file
diff --git a/yarn.lock b/yarn.lock
index a9f0b62c..ba0b5297 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -495,11 +495,25 @@ ast-types-flow@^0.0.7:
resolved "https://registry.yarnpkg.com/ast-types-flow/-/ast-types-flow-0.0.7.tgz#f70b735c6bca1a5c9c22d982c3e39e7feba3bdad"
integrity sha512-eBvWn1lvIApYMhzQMsu9ciLfkBY499mFZlNqG+/9WR7PVlroQw0vG30cOQQbaKz3sCEc44TAOu2ykzqXSNnwag==
+asynckit@^0.4.0:
+ version "0.4.0"
+ resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
+ integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==
+
axe-core@^4.4.3:
version "4.6.0"
resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.6.0.tgz#1d07514866fa51262734b3357932fcf86961383a"
integrity sha512-L3ZNbXPTxMrl0+qTXAzn9FBRvk5XdO56K8CvcCKtlxv44Aw2w2NCclGuvCWxHPw1Riiq3ncP/sxFYj2nUqdoTw==
+axios@^1.2.2:
+ version "1.2.2"
+ resolved "https://registry.yarnpkg.com/axios/-/axios-1.2.2.tgz#72681724c6e6a43a9fea860fc558127dbe32f9f1"
+ integrity sha512-bz/J4gS2S3I7mpN/YZfGFTqhXTYzRho8Ay38w2otuuDR322KzFIWm/4W2K6gIwvWaws5n+mnb7D1lN9uD+QH6Q==
+ dependencies:
+ follow-redirects "^1.15.0"
+ form-data "^4.0.0"
+ proxy-from-env "^1.1.0"
+
axobject-query@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-2.2.0.tgz#943d47e10c0b704aa42275e20edf3722648989be"
@@ -610,6 +624,13 @@ color-name@~1.1.4:
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
+combined-stream@^1.0.8:
+ version "1.0.8"
+ resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f"
+ integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==
+ dependencies:
+ delayed-stream "~1.0.0"
+
concat-map@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
@@ -687,6 +708,11 @@ define-properties@^1.1.3, define-properties@^1.1.4:
has-property-descriptors "^1.0.0"
object-keys "^1.1.1"
+delayed-stream@~1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"
+ integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==
+
dir-glob@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f"
@@ -1056,6 +1082,20 @@ flatted@^3.1.0:
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.7.tgz#609f39207cb614b89d0765b477cb2d437fbf9787"
integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==
+follow-redirects@^1.15.0:
+ version "1.15.2"
+ resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13"
+ integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==
+
+form-data@^4.0.0:
+ version "4.0.0"
+ resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452"
+ integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==
+ dependencies:
+ asynckit "^0.4.0"
+ combined-stream "^1.0.8"
+ mime-types "^2.1.12"
+
fs.realpath@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
@@ -1523,6 +1563,18 @@ micromatch@^4.0.4:
braces "^3.0.2"
picomatch "^2.3.1"
+mime-db@1.52.0:
+ version "1.52.0"
+ resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70"
+ integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==
+
+mime-types@^2.1.12:
+ version "2.1.35"
+ resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a"
+ integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==
+ dependencies:
+ mime-db "1.52.0"
+
minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b"
@@ -1757,6 +1809,11 @@ prop-types@^15.8.1:
object-assign "^4.1.1"
react-is "^16.13.1"
+proxy-from-env@^1.1.0:
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2"
+ integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==
+
punycode@^2.1.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
From 1e2333c49677cd55e5642d676ca6c6ff765e614c Mon Sep 17 00:00:00 2001
From: Mateus Lopes <73197343+progmateus@users.noreply.github.com>
Date: Mon, 16 Jan 2023 21:31:40 -0300
Subject: [PATCH 04/11] component pagination
---
package.json | 1 +
src/components/formSearchProducts/style.js | 5 +-
src/components/pagination/index.jsx | 44 ++
src/components/pagination/style.js | 46 ++
src/components/sectionProducts/index.jsx | 2 -
src/mocks/products.json | 856 ++++++++++-----------
src/pages/index.js | 3 +
yarn.lock | 9 +-
8 files changed, 518 insertions(+), 448 deletions(-)
create mode 100644 src/components/pagination/index.jsx
create mode 100644 src/components/pagination/style.js
diff --git a/package.json b/package.json
index 254f619d..ce4c60ab 100644
--- a/package.json
+++ b/package.json
@@ -14,6 +14,7 @@
"react": "^18.2.0",
"react-dom": "18.2.0",
"react-icons": "^4.7.1",
+ "react-paginate": "^8.1.4",
"styled-components": "^5.3.6"
},
"devDependencies": {
diff --git a/src/components/formSearchProducts/style.js b/src/components/formSearchProducts/style.js
index dcd321ef..10e2aa74 100644
--- a/src/components/formSearchProducts/style.js
+++ b/src/components/formSearchProducts/style.js
@@ -2,7 +2,7 @@ import styled from "styled-components";
export const Container = styled.div`
- margin-top: 1.5rem;
+ margin-top: 2rem;
display: flex;
justify-content: center;
@@ -20,7 +20,8 @@ export const Container = styled.div`
height: 2.5rem;
margin-top: 0.6rem;
border-radius: 70px;
- border: 0.5px solid #000;
+ /// border: 0.1px solid #000;
+ box-shadow: 1px 1px 3px black;
align-items: center;
padding: 0.8rem;
diff --git a/src/components/pagination/index.jsx b/src/components/pagination/index.jsx
new file mode 100644
index 00000000..d52436aa
--- /dev/null
+++ b/src/components/pagination/index.jsx
@@ -0,0 +1,44 @@
+import { useState } from 'react';
+import ReactPaginate from 'react-paginate';
+import { Container } from './style';
+
+
+const Pagination = (props) => {
+
+ console.log("props: ", props.pageCount);
+
+ const [itemOffset, setItemOffset] = useState(0);
+
+ /// const endOffset = itemOffset + itemsPerPage;
+ /// console.log(`Loading items from ${itemOffset} to ${endOffset}`);
+ /// const currentItems = items.slice(itemOffset, endOffset);
+ ///const pageCount = Math.ceil(items.length / itemsPerPage);
+
+ const handlePageClick = (event) => {
+ // const newOffset = (event.selected * itemsPerPage) % items.length;
+ // console.log(
+ // `User requested page number ${event.selected}, which is offset ${newOffset}`
+ // );
+ // setItemOffset(newOffset);
+
+ console.log(`User requested page number ${event.selected}`)
+ };
+
+ return (
+
+
+
+
+ )
+}
+export { Pagination };
\ No newline at end of file
diff --git a/src/components/pagination/style.js b/src/components/pagination/style.js
new file mode 100644
index 00000000..2de4e9b7
--- /dev/null
+++ b/src/components/pagination/style.js
@@ -0,0 +1,46 @@
+import styled from "styled-components";
+
+
+export const Container = styled.div`
+ display: flex;
+
+ .container_className{
+ display: flex;
+ list-style: none;
+ margin: 1rem auto;
+
+ li{
+ margin: 0 0.4rem;
+ background-color: #2E8CA3;
+ /// border: 1px solid #1F6B88;
+ border-radius: 10px;
+ box-shadow: 1px 1px 2px black;
+ padding: 0.6rem 0.8rem;
+
+
+ a{
+ color: white;
+ font-weight: bold;
+ width: 100%;
+
+ &:hover{
+ cursor: pointer;
+ }
+ }
+
+ &.selected{
+ background-color: white;
+ -webkit-box-shadow: inset 0px 0px 5px #c1c1c1;
+ -moz-box-shadow: inset 0px 0px 5px #c1c1c1;
+ box-shadow: inset 0px 0px 5px #c1c1c1;
+ a{
+ color: black;
+ }
+ }
+ }
+ }
+
+ .activeLinkClassName{
+ color: white;
+ }
+`;
\ No newline at end of file
diff --git a/src/components/sectionProducts/index.jsx b/src/components/sectionProducts/index.jsx
index 9fe638c6..e90ec43f 100644
--- a/src/components/sectionProducts/index.jsx
+++ b/src/components/sectionProducts/index.jsx
@@ -3,12 +3,10 @@ import { Container } from "./style"
const SectionProducts = (props) => {
- console.log(props.products)
return (
{
props.products.map((product) => {
- console.log(product)
return (
+
)
}
diff --git a/yarn.lock b/yarn.lock
index ba0b5297..e14dfb74 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1800,7 +1800,7 @@ prelude-ls@^1.2.1:
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396"
integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==
-prop-types@^15.8.1:
+prop-types@^15, prop-types@^15.8.1:
version "15.8.1"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5"
integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==
@@ -1842,6 +1842,13 @@ react-is@^16.13.1, react-is@^16.7.0:
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
+react-paginate@^8.1.4:
+ version "8.1.4"
+ resolved "https://registry.yarnpkg.com/react-paginate/-/react-paginate-8.1.4.tgz#f62bfef4f07bb420f3a994e0284d1065a865a6b9"
+ integrity sha512-c3rxjcTEqeDQa6LqXifxLeFguY2qy2CHGRphVjHLFFMGfIHyaJ+v3bOvIlLYEeohwQ1q+cQpknjsqBVrkc/SNA==
+ dependencies:
+ prop-types "^15"
+
react@^18.2.0:
version "18.2.0"
resolved "https://registry.yarnpkg.com/react/-/react-18.2.0.tgz#555bd98592883255fa00de14f1151a917b5d77d5"
From 3958ade8c76781ed06bd20f0bd0effb08a07581e Mon Sep 17 00:00:00 2001
From: Mateus Lopes <73197343+progmateus@users.noreply.github.com>
Date: Tue, 17 Jan 2023 03:27:29 -0300
Subject: [PATCH 05/11] page list products
---
src/components/formSearchProducts/index.jsx | 25 +++++--
src/components/pageProduct/index.jsx | 26 ++++++++
src/components/pageProduct/style.js | 72 +++++++++++++++++++++
src/components/pagination/index.jsx | 22 ++++---
src/components/productItem/index.jsx | 2 +-
src/components/productItem/style.js | 6 +-
src/components/sectionProducts/index.jsx | 2 +-
src/pages/index.js | 54 ++++++++++++----
src/pages/products.js | 14 ++++
src/services/api.js | 2 +-
10 files changed, 197 insertions(+), 28 deletions(-)
create mode 100644 src/components/pageProduct/index.jsx
create mode 100644 src/components/pageProduct/style.js
create mode 100644 src/pages/products.js
diff --git a/src/components/formSearchProducts/index.jsx b/src/components/formSearchProducts/index.jsx
index 993477a9..823665f4 100644
--- a/src/components/formSearchProducts/index.jsx
+++ b/src/components/formSearchProducts/index.jsx
@@ -1,15 +1,32 @@
import { Container } from "./style"
import { BsSearch } from "react-icons/bs";
+import Router from "next/router";
const FormSearchProducts = () => {
+
+ const handleKeyPressInput = (event) => {
+ event.preventDefault();
+ const input = document.getElementById("input_search_products")
+
+ Router.push(`/?name=${input.value}`)
+ }
+
+
return (
)
diff --git a/src/components/pageProduct/index.jsx b/src/components/pageProduct/index.jsx
new file mode 100644
index 00000000..a260bd45
--- /dev/null
+++ b/src/components/pageProduct/index.jsx
@@ -0,0 +1,26 @@
+import { Container } from "./style"
+
+
+const PageProduct = () => {
+ return (
+
+ )
+}
+export { PageProduct }
\ No newline at end of file
diff --git a/src/components/pageProduct/style.js b/src/components/pageProduct/style.js
new file mode 100644
index 00000000..4e2ced1e
--- /dev/null
+++ b/src/components/pageProduct/style.js
@@ -0,0 +1,72 @@
+import styled from "styled-components"
+
+export const Container = styled.div`
+
+ margin-top: 4rem;
+
+ .header_product{
+ text-align: center;
+
+ div{
+ margin-top: 2rem;
+ }
+
+ h1{
+ font-size: 24px;
+ }
+
+ img{
+ max-width: 12rem;
+ max-height: 12rem;
+ }
+
+ p{
+ font-weight: bold;
+ margin-top: 1rem;
+ opacity: 0.6;
+ }
+
+ }
+
+ .footer_product{
+ margin: 2rem auto;
+ line-height: 1.5em;
+ max-width: 34rem;
+ }
+
+
+
+
+ @media (max-width: 768px){
+ .footer_product{
+ max-width: 34rem;
+ }
+ }
+
+
+
+
+ @media (max-width: 688px) {
+
+ margin-top: 5rem;
+ padding: 0 3rem;
+
+ .header_product{
+ text-align: center;
+
+ h1{
+ margin: 0 auto;
+ font-size: 18px;
+ max-width: 22rem;
+ }
+
+ img{
+ max-width: 10rem;
+ max-height: 10rem;
+ }
+ }
+ }
+
+
+
+`;
\ No newline at end of file
diff --git a/src/components/pagination/index.jsx b/src/components/pagination/index.jsx
index d52436aa..b8535682 100644
--- a/src/components/pagination/index.jsx
+++ b/src/components/pagination/index.jsx
@@ -1,12 +1,11 @@
import { useState } from 'react';
import ReactPaginate from 'react-paginate';
+import { api } from '../../services/api';
import { Container } from './style';
const Pagination = (props) => {
- console.log("props: ", props.pageCount);
-
const [itemOffset, setItemOffset] = useState(0);
/// const endOffset = itemOffset + itemsPerPage;
@@ -14,14 +13,18 @@ const Pagination = (props) => {
/// const currentItems = items.slice(itemOffset, endOffset);
///const pageCount = Math.ceil(items.length / itemsPerPage);
- const handlePageClick = (event) => {
- // const newOffset = (event.selected * itemsPerPage) % items.length;
- // console.log(
- // `User requested page number ${event.selected}, which is offset ${newOffset}`
- // );
- // setItemOffset(newOffset);
+ const handlePageClick = async (event) => {
+ console.log("Entrou na função")
+
+ console.log("Name: ", props.product_name)
+
+ const { data } = await api.get(`/products?page=${(event.selected + 1)}&query=${props.product_name}`)
+
+ console.log(`User requested page number ${(event.selected + 1)}`)
+ console.log(`Pagina atual ${data.current_page}`)
+
+ props.setdataProducts(data)
- console.log(`User requested page number ${event.selected}`)
};
return (
@@ -29,6 +32,7 @@ const Pagination = (props) => {