mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-07 14:38:11 +08:00
Bezier-rs: Add hash URLs for individual API examples (#968)
* Handle displaying single demos * Address comments * Update eslintrc * Add hash links * Use hash instead of pathname * Address small nits * Change url format * CSS improvements --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
committed by
Keavon Chambers
co-authored by
Keavon Chambers
parent
875f2a5cd1
commit
ff51098c11
@@ -42,9 +42,16 @@ export function renderDemoPane(demoPane: DemoPane): void {
|
||||
const container = document.createElement("div");
|
||||
container.className = "demo-pane-container";
|
||||
|
||||
const headerAnchorLink = document.createElement("a");
|
||||
headerAnchorLink.innerText = "#";
|
||||
const currentHash = window.location.hash.split("/");
|
||||
// Add href anchor if not on a solo example page
|
||||
if (currentHash.length !== 3 && currentHash[2] !== "solo") headerAnchorLink.href = `#${demoPane.id}`;
|
||||
|
||||
const header = document.createElement("h3");
|
||||
header.innerText = demoPane.name;
|
||||
header.className = "demo-pane-header";
|
||||
header.append(headerAnchorLink);
|
||||
|
||||
const computeTypeContainer = document.createElement("div");
|
||||
computeTypeContainer.className = "compute-type-choice";
|
||||
|
||||
Reference in New Issue
Block a user