Skip to content

Commit a1f6526

Browse files
Added link buttons
1 parent a4ca516 commit a1f6526

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

packages/cursorless-org-docs/src/css/custom.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,3 @@
4646
.pointer {
4747
cursor: pointer;
4848
}
49-
50-
.facet-name {
51-
font-weight: 600;
52-
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.facet-name {
2+
font-weight: 600;
3+
}
4+
5+
.link-icon {
6+
margin-left: 0.25rem;
7+
}
8+
9+
.link-icon:hover {
10+
text-decoration: none;
11+
}

packages/cursorless-org-docs/src/docs/user/languages/components/ScopeVisualizer.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
import React, { useState } from "react";
99
import scopeTestsJson from "../../../../../static/scopeTests.json";
1010
import { Code, type Highlight } from "./Code";
11+
import "./ScopeVisualizer.css";
1112
import type { Fixture, ScopeTestsJson } from "./types";
1213
import { getFacetInfo, prettifyFacet, prettifyScopeType } from "./util";
1314

@@ -83,9 +84,15 @@ function renderScope(
8384
renderWhitespace: boolean,
8485
scope: Scope,
8586
) {
87+
const href = scope.scope.toLowerCase().replaceAll(" ", "-");
8688
return (
8789
<div key={scope.scope}>
88-
<h3>[{scope.scope}]</h3>
90+
<h3 id={href}>
91+
{scope.scope}
92+
<a href={`#${href}`} className="link-icon">
93+
🔗
94+
</a>
95+
</h3>
8996
{scope.facets.map((f) =>
9097
renderFacet(languageId, rangeType, renderWhitespace, f),
9198
)}

0 commit comments

Comments
 (0)