From b5c8c26aa128c1fa79b0a70be736ea3579240d35 Mon Sep 17 00:00:00 2001 From: marlon passos Date: Fri, 20 Jan 2023 11:59:33 -0300 Subject: [PATCH] feat: configura o json html prop --- .vscode/schemas/html.json | 0 .vscode/settings.json | 168 +++++++++++++++++++++++++++ store/blocks/footer/footer.json | 31 +++-- store/blocks/pdp/product-gifts.jsonc | 3 + store/blocks/pdp/product.jsonc | 10 +- store/interfaces.json | 3 +- 6 files changed, 203 insertions(+), 12 deletions(-) create mode 100644 .vscode/schemas/html.json create mode 100644 .vscode/settings.json diff --git a/.vscode/schemas/html.json b/.vscode/schemas/html.json new file mode 100644 index 0000000..e69de29 diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..04540ca --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,168 @@ +{ + "json.schemas": [ + { + "fileMatch": ["/store/**/*.json", "/store/**/*.jsonc"], + + "schema": { + "type": "object", + "title": "html", + "properties": { + "html": { + "type": "object", + "description": "The name of the entry", + "properties": { + "props": { + "properties": { + "tag": { + "enum": [ + "section", + "div", + "span", + "p", + "h1", + "h2", + "h3", + "h4", + "h5", + "h6", + "artigle", + "aside", + "details", + "figcaption", + "figure", + "footer", + "header", + "main", + "mark", + "nav", + "summary", + "time", + "wbr", + "address", + "blockquote", + "dd", + "dl", + "dt", + "fieldset", + "hr", + "li", + "ol", + "pre", + "ul" + ], + "type": "string", + "description": "Tag HTML que sera usada para renderizar o componente.", + "default": "div" + }, + "testId": { + "type": "string", + "description": "Id para ser usado nos testes automatizados" + }, + "blockClass": { + "type": ["string", "array"], + "items": { + "type": "string" + }, + "description": "classes que serao usadas para estilizar o componente." + }, + "text": { + "type": "string", + "description": "Texto para coisas mais simples" + }, + "tachyonsClasses": { + "type": "string", + "description": "Classes CSS extras que deseja adicionar.\nFeito para uso de classes do tachyons.\n Nao vai ser possivel usar essas classes para estilizar o componente.\nPara isso, use o props \"blockClass\"" + } + } + }, + "children": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + }, + "patternProperties": { + "^html#": { + "type": "object", + "description": "The name of the entry", + "properties": { + "props": { + "properties": { + "tag": { + "enum": [ + "section", + "div", + "span", + "p", + "h1", + "h2", + "h3", + "h4", + "h5", + "h6", + "artigle", + "aside", + "details", + "figcaption", + "figure", + "footer", + "header", + "main", + "mark", + "nav", + "summary", + "time", + "wbr", + "address", + "blockquote", + "dd", + "dl", + "dt", + "fieldset", + "hr", + "li", + "ol", + "pre", + "ul" + ], + "type": "string", + "description": "Tag HTML que sera usada para renderizar o componente.", + "default": "div" + }, + "testId": { + "type": "string", + "description": "Id para ser usado nos testes automatizados" + }, + "blockClass": { + "type": ["string", "array"], + "items": { + "type": "string" + }, + "description": "classes que serao usadas para estilizar o componente." + }, + "text": { + "type": "string", + "description": "Texto para coisas mais simples" + }, + "tachyonsClasses": { + "type": "string", + "description": "Classes CSS extras que deseja adicionar.\nFeito para uso de classes do tachyons.\n Nao vai ser possivel usar essas classes para estilizar o componente.\nPara isso, use o props \"blockClass\"" + } + } + }, + "children": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + } + ] +} diff --git a/store/blocks/footer/footer.json b/store/blocks/footer/footer.json index 6fbd671..c05ac0f 100644 --- a/store/blocks/footer/footer.json +++ b/store/blocks/footer/footer.json @@ -1,6 +1,9 @@ { "footer": { - "blocks": ["footer-layout.desktop", "footer-layout.mobile"] + "blocks": [ + "footer-layout.desktop", + "footer-layout.mobile" + ] }, "footer-layout.desktop": { "children": [ @@ -24,7 +27,6 @@ "paddingBottom": 3 } }, - "social-networks": { "props": { "socialNetworks": [ @@ -47,21 +49,27 @@ ] } }, - "flex-layout.row#footer-2-desktop": { - "children": ["accepted-payment-methods"], + "children": [ + "accepted-payment-methods" + ], "props": { "blockClass": "payment-methods" } }, "accepted-payment-methods": { "props": { - "paymentMethods": ["MasterCard", "Visa", "Diners Club"] + "paymentMethods": [ + "MasterCard", + "Visa", + "Diners Club" + ] } }, - "flex-layout.row#footer-3-desktop": { - "children": ["rich-text#footer"], + "children": [ + "rich-text#footer" + ], "props": { "blockClass": "credits" } @@ -72,7 +80,6 @@ "blockClass": "footer" } }, - "footer-layout.mobile": { "children": [ "flex-layout.row#1-footer-mobile", @@ -80,7 +87,9 @@ ] }, "flex-layout.row#2-footer-mobile": { - "children": ["flex-layout.col#footer-1-mobile"], + "children": [ + "flex-layout.col#footer-1-mobile" + ], "props": { "blockClass": "payment-methods", "paddingTop": 4, @@ -105,7 +114,9 @@ "paddingTop": 4, "paddingBottom": 4 }, - "children": ["vtex.menu@2.x:menu#footer-mobile"] + "children": [ + "vtex.menu@2.x:menu#footer-mobile" + ] }, "rich-text#footer-mobile": { "props": { diff --git a/store/blocks/pdp/product-gifts.jsonc b/store/blocks/pdp/product-gifts.jsonc index 5148927..39a118a 100644 --- a/store/blocks/pdp/product-gifts.jsonc +++ b/store/blocks/pdp/product-gifts.jsonc @@ -8,6 +8,9 @@ }, "children": ["flex-layout.row#product-gifts-text", "product-gift-list"] }, + "html": { + "children": [] + }, "flex-layout.row#product-gifts-text": { "props": { diff --git a/store/blocks/pdp/product.jsonc b/store/blocks/pdp/product.jsonc index 6225aca..d6e5241 100644 --- a/store/blocks/pdp/product.jsonc +++ b/store/blocks/pdp/product.jsonc @@ -1,7 +1,7 @@ { "store.product": { "children": [ - "flex-layout.row#product-breadcrumb", + "html#breadcrumb", "image#example", "condition-layout.product#availability", "flex-layout.row#description", @@ -36,6 +36,14 @@ }, "children": ["breadcrumb"] }, + "html#breadcrumb": { + "props": { + "tag": "section", + "testId": "a1" + }, + "children": ["breadcrumb"] + }, + "flex-layout.row#description": { "props": { "marginBottom": 7 diff --git a/store/interfaces.json b/store/interfaces.json index 66feae9..c4b2ac4 100644 --- a/store/interfaces.json +++ b/store/interfaces.json @@ -3,6 +3,7 @@ "component": "Example" }, "html": { - "component": "html" + "component": "html", + "composition": "children" } }