A grid layout
This commit is contained in:
parent
d281f22242
commit
ce530b20a1
6 changed files with 168 additions and 54 deletions
|
@ -1,6 +1,12 @@
|
|||
import rr from "./railroad.js";
|
||||
|
||||
export function railroadDiagram(builder, elementID) {
|
||||
export function railroadDiagram(builder, elementID, elementClass) {
|
||||
const diagram = builder(rr);
|
||||
diagram.addTo(document.getElementById(elementID));
|
||||
const diagramSVG = diagram.toSVG();
|
||||
if (elementClass) {
|
||||
diagramSVG.classList.add(elementClass);
|
||||
}
|
||||
|
||||
const figure = document.getElementById(elementID);
|
||||
figure.appendChild(diagramSVG);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue