feat: Cria arquivo styles.css dentro do html

This commit is contained in:
Izabela Balizardo 2023-01-29 22:14:52 -03:00
parent c9a06914fb
commit 07e48330d9
8 changed files with 97 additions and 54 deletions

View File

@ -15,7 +15,6 @@
"postreleasy": "vtex publish --verbose" "postreleasy": "vtex publish --verbose"
}, },
"dependencies": { "dependencies": {
"agenciamagma.store-theme": "5.x",
"vtex.store": "2.x", "vtex.store": "2.x",
"vtex.store-header": "2.x", "vtex.store-header": "2.x",
"vtex.product-summary": "2.x", "vtex.product-summary": "2.x",

View File

@ -1,41 +1,53 @@
import React, { ReactNode } from "react"; import React, { ReactNode } from "react";
import { useCssHandles } from "vtex.css-handles"; import { useCssHandles } from "vtex.css-handles";
import "./styles.css";
const CSS_HANDLES = ["html"] as const; const CSS_HANDLES = ["html"] as const;
type HtmlProps = { type HtmlProps = {
children?: ReactNode, children?: ReactNode;
/** /**
* Qual tag Html que deseja que seja usar * Qual tag Html que deseja que seja usar
* *
* @default div * @default div
*/ */
tag?: keyof React.ReactHTML tag?: keyof React.ReactHTML;
/** /**
* Classes CSS extras que deseja adicionar. * Classes CSS extras que deseja adicionar.
* Feito para uso de [classes do tachyons](https://tachyons.io/) * Feito para uso de [classes do tachyons](https://tachyons.io/)
*/ */
tachyonsClasses?: string tachyonsClasses?: string;
/** /**
* Se caso quiser usar esse componente * Se caso quiser usar esse componente
* para adicinar um texto simples * para adicinar um texto simples
*/ */
text?: string text?: string;
/** /**
* Tag ID para * Tag ID para
*/ */
testId?: string testId?: string;
} };
export const Html = ({ children = null, tag = "div", text = "", tachyonsClasses: classes = "", testId }: HtmlProps) => { export const Html = ({
const { handles } = useCssHandles(CSS_HANDLES); children = null,
tag = "div",
const props = { text = "",
className: `${handles.html} ${classes}`, tachyonsClasses: classes = "",
"data-testid": testId testId,
}; }: HtmlProps) => {
const Children = <>{children}{text}</>; const { handles } = useCssHandles(CSS_HANDLES);
const Element = React.createElement(tag, props, Children);
const props = {
return <>{Element}</>; className: `${handles.html} ${classes}`,
"data-testid": testId,
};
const Children = (
<>
{children}
{text}
</>
);
const Element = React.createElement(tag, props, Children);
return <>{Element}</>;
}; };

View File

@ -0,0 +1,26 @@
*
{
margin:0;
}
[class*="productNameContainer--quickview"] {
color: gray;
text-align: right;
}
[class*="shareContainer"] {
display: none;
}
[class*="shippingContainer"] {
display: flex;
}
[class*="shippingContainer"] button {
margin-top: 20px;
width: 50px;
height: 50px;
background-color: black;
color: white;
}

View File

@ -12,10 +12,7 @@
}, },
"flex-layout.col#deals1": { "flex-layout.col#deals1": {
"children": [ "children": ["image#deal1", "rich-text#deal1"]
"image#deal1",
"rich-text#deal1"
]
}, },
"image#deal1": { "image#deal1": {
"props": { "props": {
@ -30,10 +27,7 @@
} }
}, },
"flex-layout.col#deals2": { "flex-layout.col#deals2": {
"children": [ "children": ["image#deal2", "rich-text#deal2"]
"image#deal2",
"rich-text#deal2"
]
}, },
"image#deal2": { "image#deal2": {
"props": { "props": {
@ -48,10 +42,7 @@
} }
}, },
"flex-layout.col#deals3": { "flex-layout.col#deals3": {
"children": [ "children": ["image#deal3", "rich-text#deal3"]
"image#deal3",
"rich-text#deal3"
]
}, },
"image#deal3": { "image#deal3": {
"props": { "props": {
@ -66,10 +57,7 @@
} }
}, },
"flex-layout.col#deals4": { "flex-layout.col#deals4": {
"children": [ "children": ["image#deal4", "rich-text#deal4"]
"image#deal4",
"rich-text#deal4"
]
}, },
"image#deal4": { "image#deal4": {
"props": { "props": {

View File

@ -2,8 +2,9 @@
"store.home": { "store.home": {
"blocks": [ "blocks": [
"list-context.image-list#demo", "list-context.image-list#demo",
"example-component", /* You can make references to blocks defined in other files. "example-component"
* For example, `flex-layout.row#deals` is defined in the `deals.json` file. */ /* You can make references to blocks defined in other files.
* For example, `flex-layout.row#deals` is defined in the `deals.json` file. */,
"flex-layout.row#deals", "flex-layout.row#deals",
"__fold__", "__fold__",
"rich-text#shelf-title", "rich-text#shelf-title",

View File

@ -101,12 +101,12 @@
}, },
"children": [ "children": [
"flex-layout.row#product-name", "flex-layout.row#product-name",
"product-identifier.product",
"product-rating-summary", "product-rating-summary",
"flex-layout.row#list-price-savings", "flex-layout.row#list-price-savings",
"flex-layout.row#selling-price", "flex-layout.row#selling-price",
"product-installments", "product-installments",
"product-separator", "product-separator",
"product-identifier.product",
"sku-selector", "sku-selector",
"product-quantity", "product-quantity",
"product-assembly-options", "product-assembly-options",

View File

@ -1,3 +1,18 @@
.product-identifier--productReference { .product-identifier--productReference {
margin-bottom: 1rem; margin-bottom: 1rem;
} }
.product-identifier--productReference {
margin-bottom: 1rem;
display: flex;
justify-content: right;
color: gray;
}
.product-identifier__label {
display: none;
}
.product-identifier__separator {
display: none;
}

View File

@ -2,6 +2,7 @@
color: #727273; color: #727273;
margin-bottom: .25rem; margin-bottom: .25rem;
font-size: 1rem; font-size: 1rem;
display: none;
} }
.sellingPrice { .sellingPrice {
@ -22,6 +23,7 @@
.savings { .savings {
font-weight: 500; font-weight: 500;
color: #79B03A; color: #79B03A;
display:none;
} }
.sellingPriceValue--summary { .sellingPriceValue--summary {