Skip to content

Commit 101c03d

Browse files
Link underlines - WIP
1 parent 8397f79 commit 101c03d

6 files changed

Lines changed: 19 additions & 4 deletions

File tree

src/common/use-action-feedback.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ export class ActionFeedback {
9797
href={deployment.supportLink}
9898
target="_blank"
9999
rel="noopener"
100-
textDecoration="underline"
101100
>
102101
{chunks}
103102
</MaybeLink>

src/documentation/common/DocString.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,18 @@
33
*
44
* SPDX-License-Identifier: MIT
55
*/
6+
import { css, cx } from "@microbit/ui";
67
import React from "react";
78
import { styled } from "styled-system/jsx";
89
import { SystemStyleObject } from "styled-system/types";
910
import { renderMarkdown } from "../../editor/codemirror/language-server/documentation";
1011

12+
// Docstring links (autolinked URLs in the type stubs) must be marked by more
13+
// than colour. Scoped here so the CodeMirror popups' anchors stay bare.
14+
const underlineLinksClass = css({
15+
"& a": { textDecoration: "underline" },
16+
});
17+
1118
export interface DocStringProps {
1219
value: string;
1320
/** Use span inside phrasing content (e.g. a heading subtitle). */
@@ -21,7 +28,7 @@ const DocString = React.memo(
2128
const Component = as === "span" ? styled.span : styled.div;
2229
return (
2330
<Component
24-
className="docs-spacing docs-code"
31+
className={cx("docs-spacing docs-code", underlineLinksClass)}
2532
dangerouslySetInnerHTML={html}
2633
css={cssProp}
2734
/>

src/documentation/ideas/IdeasDocumentation.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ const ActiveLevel = ({
176176
values={{
177177
link: (chunks: ReactNode) => (
178178
<Link
179+
variant="standalone"
179180
color="brand.500"
180181
href={microbitOrgMiciProjectsUrl(languageId)}
181182
target="_blank"

src/documentation/search/SearchResultList.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ const SearchResultItem = ({
6666
return (
6767
<Stack pl="3px" pr="3px">
6868
<Link
69+
variant="standalone"
6970
bgColor={viewedResults.includes(id) ? "#efedf5" : "unset"}
7071
borderRadius="md"
7172
href={url}

src/editor/ModuleOverlay.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ const ModuleOverlay = ({ moduleData }: ModuleOverlayProps) => {
9797
link: (chunks: ReactNode) => (
9898
<Button
9999
variant="link"
100-
css={{ color: "brand.500" }}
100+
// In prose, so marked by more than colour.
101+
css={{ color: "brand.500", textDecoration: "underline" }}
101102
onPress={handleShowSettings}
102103
>
103104
{chunks}

src/serial/TracebackLink.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@ const TracebackLink = ({ traceback, children }: TracebackLinkProps) => {
3333
[setSelection, traceback]
3434
);
3535
return (
36-
<Link data-testid="traceback-link" onClick={handleClick}>
36+
// Standalone: only the location span (see MaybeTracebackLink) is
37+
// underlined, not the error text sharing the click target.
38+
<Link
39+
variant="standalone"
40+
data-testid="traceback-link"
41+
onClick={handleClick}
42+
>
3743
{children}
3844
</Link>
3945
);

0 commit comments

Comments
 (0)