Fix assumption display in inventory and editor mode #84

This commit is contained in:
joneugster
2023-10-20 21:59:47 +02:00
parent 2b159f508f
commit b5927a1024
3 changed files with 42 additions and 33 deletions
+17 -6
View File
@@ -44,7 +44,7 @@ export function DualEditor({ level, codeviewRef, levelId, worldId, worldSize })
const { typewriterMode } = React.useContext(InputModeContext)
return <>
<div className={typewriterMode ? 'hidden' : ''}>
<ExerciseStatement data={level} />
<ExerciseStatement data={level} showLeanStatement={true} />
<div ref={codeviewRef} className={'codeview'}></div>
</div>
{ec ?
@@ -131,12 +131,23 @@ function DualEditorMain({ worldId, levelId, level, worldSize }: { worldId: strin
* - Theorem xyz: description
* - Theorem xyz
* - Exercises: description
*
* If `showLeanStatement` is true, it will additionally display the lean code.
*/
function ExerciseStatement({ data }) {
if (!data?.descrText) { return <></> }
return <div className="exercise-statement"><Markdown>
{(data?.displayName ? `**Theorem** \`${data?.displayName}\`: ` : data?.descrText && "**Exercise**: ") + `${data?.descrText}`}
</Markdown></div>
function ExerciseStatement({ data, showLeanStatement = false }) {
if (!(data?.descrText || data?.descrFormat)) { return <></> }
return <>
<div className="exercise-statement">
{data?.descrText &&
<Markdown>
{(data?.displayName ? `**Theorem** \`${data?.displayName}\`: ` : data?.descrText && "**Exercise**: ") + data?.descrText}
</Markdown>
}
{data?.descrFormat && showLeanStatement &&
<p><code className="lean-code">{data?.descrFormat}</code></p>
}
</div>
</>
}
// TODO: This is only used in `EditorInterface`
+14
View File
@@ -41,6 +41,20 @@
padding-right: .5em;
}
.exercise-statement {
padding-top: 1em;
padding-bottom: 1em;
}
.exercise-statement p {
margin: 0;
}
.exercise-statement .lean-code {
color: rgba(0, 32, 90, 0.87);
font-size: 12px; /* TODO: is the monaco font-size hardcoded? */
}
.conclusion {
padding: 1em;
}