Merge branch 'syntax-switch-fix' into 'dev'

Add background-color to options of Syntax Switch.

See merge request ligolang/ligo!542
This commit is contained in:
Sander 2020-04-01 14:41:47 +00:00
commit 60070cc8d0
5 changed files with 14 additions and 12 deletions

View File

@ -2,15 +2,15 @@ import React from 'react';
import styles from './styles.module.css'; import styles from './styles.module.css';
function SyntaxSwitch(props) { function SyntaxSwitch(props) {
return React.createElement("select", { return /*#__PURE__*/React.createElement("select", {
className: styles.syntaxSwitch, className: styles.syntaxSwitch,
defaultValue: props.syntax, defaultValue: props.syntax,
onChange: e => props.onSyntaxChange(e.target.value) onChange: e => props.onSyntaxChange(e.target.value)
}, React.createElement("option", { }, /*#__PURE__*/React.createElement("option", {
value: "pascaligo" value: "pascaligo"
}, "PascaLIGO"), React.createElement("option", { }, "PascaLIGO"), /*#__PURE__*/React.createElement("option", {
value: "cameligo" value: "cameligo"
}, "CameLIGO"), React.createElement("option", { }, "CameLIGO"), /*#__PURE__*/React.createElement("option", {
value: "reasonligo" value: "reasonligo"
}, "ReasonLIGO")); }, "ReasonLIGO"));
} }

View File

@ -2,11 +2,11 @@ import React from 'react';
import SyntaxContext from './SyntaxContext'; import SyntaxContext from './SyntaxContext';
function Syntax(props) { function Syntax(props) {
return React.createElement(SyntaxContext.Consumer, null, syntax => { return /*#__PURE__*/React.createElement(SyntaxContext.Consumer, null, syntax => {
if (syntax === props.syntax) { if (syntax === props.syntax) {
return props.children; return props.children;
} else { } else {
return React.createElement(React.Fragment, null); return /*#__PURE__*/React.createElement(React.Fragment, null);
} }
}); });
} }

View File

@ -32,6 +32,7 @@
.syntaxSwitch option { .syntaxSwitch option {
color: var(--color-primary-text); color: var(--color-primary-text);
font-weight:normal; font-weight:normal;
background-color: var(--ifm-navbar-background-color);
} }

View File

@ -72,9 +72,9 @@ function SyntaxTitle(props) {
useEffect(() => { useEffect(() => {
setMounted(true); setMounted(true);
}, []); }, []);
return React.createElement(SyntaxContext.Consumer, null, syntax => { return /*#__PURE__*/React.createElement(SyntaxContext.Consumer, null, syntax => {
if (syntax === props.syntax) { if (syntax === props.syntax) {
return React.createElement(Highlight, _extends({}, defaultProps, { return /*#__PURE__*/React.createElement(Highlight, _extends({}, defaultProps, {
key: mounted, key: mounted,
language: props.syntax, language: props.syntax,
code: props.children, code: props.children,
@ -85,7 +85,7 @@ function SyntaxTitle(props) {
tokens, tokens,
getLineProps, getLineProps,
getTokenProps getTokenProps
}) => React.createElement("pre", { }) => /*#__PURE__*/React.createElement("pre", {
className: className, className: className,
style: { style: {
backgroundColor: 'var(--ifm-background-color)', backgroundColor: 'var(--ifm-background-color)',
@ -95,15 +95,15 @@ function SyntaxTitle(props) {
whiteSpace: 'break-spaces', whiteSpace: 'break-spaces',
marginTop: '3rem' marginTop: '3rem'
} }
}, tokens.map((line, i) => React.createElement("div", getLineProps({ }, tokens.map((line, i) => /*#__PURE__*/React.createElement("div", getLineProps({
line, line,
key: i key: i
}), line.map((token, key) => React.createElement("span", getTokenProps({ }), line.map((token, key) => /*#__PURE__*/React.createElement("span", getTokenProps({
token, token,
key key
}))))))); })))))));
} else { } else {
return React.createElement("div", null); return /*#__PURE__*/React.createElement("div", null);
} }
}); });
} }

View File

@ -32,6 +32,7 @@
.syntaxSwitch option { .syntaxSwitch option {
color: var(--color-primary-text); color: var(--color-primary-text);
font-weight:normal; font-weight:normal;
background-color: var(--ifm-navbar-background-color);
} }