Skip to content

Commit

Permalink
fix: word wrap (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
simboonlong authored Nov 15, 2021
1 parent 6e7a5ca commit 29b23c6
Show file tree
Hide file tree
Showing 5 changed files with 204 additions and 14 deletions.
10 changes: 3 additions & 7 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
{
"presets": [
"@babel/preset-env",
"@babel/preset-typescript",
"@babel/preset-react",
"@emotion/babel-preset-css-prop"
],
"presets": ["@babel/preset-env", "@babel/preset-typescript", "@babel/preset-react", "@emotion/babel-preset-css-prop"],
"plugins": [
[
"@babel/plugin-transform-runtime",
{
"corejs": 3
}
},
"@babel/plugin-proposal-class-properties"
]
]
}
190 changes: 185 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"devDependencies": {
"@babel/cli": "^7.15.4",
"@babel/core": "^7.15.5",
"@babel/plugin-proposal-class-properties": "^7.16.0",
"@babel/plugin-transform-runtime": "^7.15.0",
"@babel/preset-env": "^7.15.6",
"@babel/preset-react": "^7.14.5",
Expand Down
2 changes: 2 additions & 0 deletions src/DefaultTemplate.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import { DefaultTemplate } from "./DefaultTemplate";
document={{
foo: {
title: "Bar is awesome",
someVeryLongData:
"JVBERi0xLjUNCiW1tbW1DQoxIDAgb2JqDQo8PC9UeXBlL0NhdGFsb2cvUGFnZXMgMiAwIFIvTGFuZyhlbi1JTikgPj4NCmVuZG9iag0KMiAwIG9iag0KPDwvVHlwZS9QYWdlcy9Db3VudCAxNS9LaWRzWyAzIDAgUiAyMTkgMCBSIDM5MSAwIFIgNTIwIDAgUiA2MTAgMCBSIDY1OCAwIFIgNzU2IDAgUiA5MDYgMCBSIDEwMjIgMCBSIDExNjYgMCBSIDExNzYgMCBSIDEyODAgMCBSIDE0MTAgMCBSIDE1MjAgMCBSIDE3MzEgMCBSXSA",
},
name: "John Doe",
institute: "Institute of John Doe",
Expand Down
15 changes: 13 additions & 2 deletions src/DefaultTemplate.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React from "react";
import { TemplateProps, TemplateWithComponent } from "./types";

const paddingBox = `.75rem 1.25rem`;

export const DefaultTemplate: React.FunctionComponent<TemplateProps> = (props) => {
return (
<div id="default-template">
Expand All @@ -20,7 +22,7 @@ export const DefaultTemplate: React.FunctionComponent<TemplateProps> = (props) =
color: "#856404",
backgroundColor: "#fff3cd",
border: "1px solid #ffeeba",
padding: ".75rem 1.25rem",
padding: paddingBox,
}}
>
You see this template because the certificate issuer misconfigured the template configuration of your document.
Expand All @@ -30,7 +32,16 @@ export const DefaultTemplate: React.FunctionComponent<TemplateProps> = (props) =
</a>
.
</div>
<pre style={{ backgroundColor: "lightgray" }}>{JSON.stringify(props.document, null, 2)}</pre>
<pre
style={{
backgroundColor: "lightgray",
padding: paddingBox,
whiteSpace: "pre-wrap",
wordWrap: "break-word",
}}
>
{JSON.stringify(props.document, null, 2)}
</pre>
</div>
);
};
Expand Down

0 comments on commit 29b23c6

Please sign in to comment.