11import React from 'react' ;
2+ import MathJax from 'react-mathjax'
23
34import { Box , Button , Divider , TextField , Typography } from '@mui/material'
45
@@ -13,6 +14,11 @@ import { Box, Button, Divider, TextField, Typography } from '@mui/material'
1314 }
1415*/
1516
17+ const tex = {
18+ quadratic_solution : 'x = {-b \\pm \\sqrt{b^2-4ac} \\over 2a}' ,
19+ tex_example : `f(x) = \\int_{-\\infty}^\\infty \\hat f(\\xi)\\,e^{2 \\pi i \\xi x} \\,d\\xi` ,
20+ }
21+
1622const ExampleComponent = ( { triggerQuery, model, modelUpdate } ) => {
1723 const handleChange = ( e ) => {
1824 modelUpdate ( {
@@ -21,34 +27,14 @@ const ExampleComponent = ({ triggerQuery, model, modelUpdate }) => {
2127 }
2228 return (
2329 < >
24- < Box sx = { { m : 1 } } >
25- < Typography variant = 'h2' > { model . greeting } { model . username } </ Typography >
26- < Typography variant = 'h4' > { model . message } </ Typography >
27- < Button variant = "outlined"
28- onClick = { ( ) => triggerQuery ( model . runQuery ) }
29- > Get a user name</ Button >
30- </ Box >
31-
32- < Box sx = { { m : 1 } } >
33- < Typography variant = 'body1' > Want to trigger a query?</ Typography >
34- < Button variant = "outlined"
35- onClick = { ( ) => triggerQuery ( model . yesQuery ) }
36- >
37- 👍
38- </ Button >
39- < Button variant = "outlined"
40- onClick = { ( ) => triggerQuery ( model . noQuery ) }
41- >
42- 👎
43- </ Button >
44- </ Box >
45-
46- < Divider />
47-
48- < Box sx = { { m : 1 } } >
49- < TextField id = "outlined-uncontrolled" label = "Change Greeting" onChange = { handleChange } />
50- </ Box >
51- </ >
30+ < Box sx = { { m : 1 } } id = "retool-custom-mathjax-container" >
31+ < Typography variant = "body1" > { model . text } </ Typography >
32+ < MathJax . Provider >
33+ < MathJax . Node formula = { model . equation } id = "retool-custom-mathjax-equation" />
34+ </ MathJax . Provider >
35+ < Typography variant = "body1" > { model . question } </ Typography >
36+ </ Box >
37+ </ >
5238 ) ;
5339}
5440export default ExampleComponent ;
0 commit comments