Modified render styles to improve printability

This commit is contained in:
Patrick Fic
2020-09-10 15:55:25 -07:00
parent a0bb07abfd
commit 984c001bd8
15 changed files with 187 additions and 92 deletions

View File

@@ -19,7 +19,12 @@ const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
});
export function ShopTemplateTestRender({ bodyshop, query, emailEditorRef }) {
export function ShopTemplateTestRender({
bodyshop,
query,
emailEditorRef,
style,
}) {
const [variables, setVariables] = useState({ id: "uuid" });
const [loading, setLoading] = useState(false);
const { t } = useTranslation();
@@ -31,6 +36,7 @@ export function ShopTemplateTestRender({ bodyshop, query, emailEditorRef }) {
emailEditorRef.current.exportHtml(async (data) => {
inlineCss(data.html, {
url: `${window.location.protocol}://${window.location.host}/`,
removeLinkTags: false,
}).then(async function (inlineHtml) {
try {
const { data: contextData } = await client.query({
@@ -59,13 +65,11 @@ export function ShopTemplateTestRender({ bodyshop, query, emailEditorRef }) {
};
return (
<div>
<div style={{ width: "20rem" }}>
<Editor value={variables} onChange={(e) => setVariables(e)} />
<Button loading={loading} type="ghost" onClick={handleTestRender}>
{t("bodyshop.actions.testrender")}
</Button>
</div>
<div style={style}>
<Editor value={variables} onChange={(e) => setVariables(e)} />
<Button loading={loading} type="ghost" onClick={handleTestRender}>
{t("bodyshop.actions.testrender")}
</Button>
</div>
);
}