mirror of
https://github.com/arfct/itty-bitty.git
synced 2026-03-11 08:54:33 +00:00
Update step and header display
This commit is contained in:
parent
5fa0783df4
commit
7f3dc06176
2 changed files with 26 additions and 5 deletions
|
|
@ -166,6 +166,22 @@ ul.step {
|
|||
padding: 0;margin: 0em;
|
||||
}
|
||||
|
||||
ul.step:after {
|
||||
content: "";
|
||||
display: block;
|
||||
width: 5em;
|
||||
height: 0.5px;
|
||||
background-color: currentColor;
|
||||
opacity: 1;
|
||||
border:none;
|
||||
margin: 1em 0 0.2em 0 ;
|
||||
}
|
||||
|
||||
ul.step.header:after,
|
||||
ul.step:last-child:after {
|
||||
display:none;
|
||||
}
|
||||
|
||||
.instructions:not(.numbered) .number {
|
||||
display: none;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -444,16 +444,21 @@ function render() {
|
|||
let step = 1;
|
||||
function renderInstructions(instruction, terms) {
|
||||
if (Array.isArray(instruction)) {
|
||||
// if (Array.isArray(instruction[0])) instruction = instruction.flat();
|
||||
return [m("hr"), m("ul.step", instruction.map(i => renderInstructions(i, terms)))];
|
||||
let instructions = instruction.map(i => renderInstructions(i, terms));
|
||||
let className = "step";
|
||||
console.log(instructions[0].tagName, instructions[0].tagName=="H3")
|
||||
if (instructions[0].tagName=="H3") className = "step header"
|
||||
return m("ul", {className}, instructions);
|
||||
}
|
||||
|
||||
let text = (instruction?.text || instruction);
|
||||
if (text?.startsWith("= ")) return m("h3", text.substring(2));
|
||||
|
||||
if (!text) return;
|
||||
|
||||
if (text?.startsWith("= ")) return m("h3", text.substring(2));
|
||||
if (text?.endsWith(":")) return m("h3", text);
|
||||
|
||||
return m("li", { onclick: highlightStep },
|
||||
m("span.number" + (step>9 ? ".big" : ""), `${step++}`),
|
||||
m("span.number" + (step > 9 ? ".big" : ""), `${step++}`),
|
||||
m("span.substep",{innerHTML:highlightTimes(highlightTerms(FRACTION_MAP.replace(text.trim()), terms))}))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue