aboutsummaryrefslogtreecommitdiff
path: root/src/components/Equation.js
blob: df9eb01071c36c2736c407b6a7579ea4ef67eed8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/** @jsx jsx */
import { jsx } from "theme-ui";
import { BlockMath } from "react-katex";
import dracula from "@theme-ui/prism/presets/dracula.json";

function Equation({ children, ...props }) {
  if (children) {
    return (
      <div
        {...props}
        sx={{
          ".katex": {
            color: dracula.color,
            backgroundColor: dracula.backgroundColor,
            borderRadius: "0.5rem",
            padding: "10px",
            boxShadow: "0px 0px 10px -3px rgba(0,0,0,0.5)"
          }
        }}
      >
        <BlockMath>{children}</BlockMath>
      </div>
    );
  } else {
    return <div />;
  }
}

export default Equation;