aboutsummaryrefslogtreecommitdiffstats
path: root/packages/dev-tools-pages
diff options
context:
space:
mode:
authorAugust Skare <post@augustskare.no>2018-11-07 19:39:47 +0800
committerAugust Skare <post@augustskare.no>2018-11-07 19:39:47 +0800
commitc27a2b64efbc264262980d5ca2e7a096341ac89c (patch)
tree5b13af496e5b2149ffdfbe726652bbc648b46440 /packages/dev-tools-pages
parentfdaffb67e8fc3763c2ba7e30eedd73c8584f50fe (diff)
downloaddexon-sol-tools-c27a2b64efbc264262980d5ca2e7a096341ac89c.tar
dexon-sol-tools-c27a2b64efbc264262980d5ca2e7a096341ac89c.tar.gz
dexon-sol-tools-c27a2b64efbc264262980d5ca2e7a096341ac89c.tar.bz2
dexon-sol-tools-c27a2b64efbc264262980d5ca2e7a096341ac89c.tar.lz
dexon-sol-tools-c27a2b64efbc264262980d5ca2e7a096341ac89c.tar.xz
dexon-sol-tools-c27a2b64efbc264262980d5ca2e7a096341ac89c.tar.zst
dexon-sol-tools-c27a2b64efbc264262980d5ca2e7a096341ac89c.zip
visual tweaks in code component
Diffstat (limited to 'packages/dev-tools-pages')
-rw-r--r--packages/dev-tools-pages/ts/components/Code.tsx20
1 files changed, 13 insertions, 7 deletions
diff --git a/packages/dev-tools-pages/ts/components/Code.tsx b/packages/dev-tools-pages/ts/components/Code.tsx
index 84ce43f84..f04d5aab8 100644
--- a/packages/dev-tools-pages/ts/components/Code.tsx
+++ b/packages/dev-tools-pages/ts/components/Code.tsx
@@ -62,13 +62,12 @@ const Base =
display: flex;
padding-top: 1.5rem;
padding-bottom: 1.5rem;
+ overflow-x: auto;
+ -webkit-overflow-scrolling: touch;
`
- : `
- padding: 1.5rem;
- `}
+ : ``}
- overflow-x: auto;
- -webkit-overflow-scrolling: touch;
+
`;
const StyledCodeDiff = styled(({ gutterLength, children, ...props }: any) => <code {...props}>{children}</code>)`
@@ -113,6 +112,14 @@ const StyledCodeDiff = styled(({ gutterLength, children, ...props }: any) => <co
const StyledPre = styled.pre`
margin: 0;
+ ${(props: { diff: boolean }) =>
+ !props.diff
+ ? `
+ padding: 1.5rem;
+ overflow-x: auto;
+ -webkit-overflow-scrolling: touch;
+ `
+ : ``};
`;
const StyledCopyInput = styled.textarea`
@@ -141,7 +148,6 @@ class Code extends React.Component<CodeProps, CodeState> {
const code = children as string;
if (language !== undefined) {
- /* console.log(code); */
const { default: highlight } = await System.import(/* webpackChunkName: 'highlightjs' */ 'ts/highlight');
this.setState({
@@ -182,7 +188,7 @@ class Code extends React.Component<CodeProps, CodeState> {
return (
<Container>
<Base language={language} diff={diff} light={light}>
- <StyledPre>
+ <StyledPre diff={diff}>
<Code {...codeProps} dangerouslySetInnerHTML={hlCode ? { __html: this.state.hlCode } : null}>
{hlCode === undefined ? children : null}
</Code>