Skip to content

Commit 27c9215

Browse files
committed
Cleanup module link
1 parent 1cd0147 commit 27c9215

3 files changed

Lines changed: 15 additions & 31 deletions

File tree

src/components/Docs/SchemaClass.tsx

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as api from "./api";
55
import { SchemaTypeView, MetadataTags } from "./SchemaType";
66
import { ReferencedBy } from "./ReferencedBy";
77
import { CrossGameRefs } from "./CrossGameRefs";
8-
import { KindIcon } from "./utils/components";
8+
import { KindIcon } from "../KindIcon";
99
import { DeclarationsContext, declarationKey } from "./DeclarationsContext";
1010
import {
1111
matchesWords,
@@ -43,7 +43,7 @@ const FieldRow = styled.div`
4343
overflow: hidden;
4444
display: grid;
4545
grid-template-columns: auto 1fr;
46-
gap: 0 6px;
46+
gap: 0 10px;
4747
4848
&[data-highlighted] {
4949
background-color: var(--search-highlight);
@@ -88,33 +88,23 @@ const FieldOffset = styled.button`
8888

8989
export const ModuleBadge: React.FC<{ module: string }> = ({ module }) => {
9090
const { root } = useContext(DeclarationsContext);
91-
const navigate = useNavigate();
9291
return (
93-
<StyledModuleBadge
94-
onClick={() => navigate(`${root}?search=${encodeURIComponent(`module:${module}`)}`)}
95-
>
92+
<SectionLink to={`${root}?search=${encodeURIComponent(`module:${module}`)}`}>
93+
<svg
94+
width="16"
95+
height="16"
96+
viewBox="0 0 16 16"
97+
xmlns="http://www.w3.org/2000/svg"
98+
fill="#B180D7"
99+
aria-hidden="true"
100+
>
101+
<path d="M5 2C3.89543 2 3 2.89543 3 4V6.00469C3 6.53494 2.99231 6.79889 2.91088 7.00209C2.84826 7.15835 2.71576 7.33309 2.2764 7.55276C2.10701 7.63745 2 7.81058 2 7.99997C2 8.18935 2.10699 8.36249 2.27638 8.44719C2.71569 8.66685 2.84809 8.84151 2.91076 8.99819C2.99233 9.20211 3 9.46732 3 10L3 12C3 13.1046 3.89543 14 5 14C5.27614 14 5.5 13.7761 5.5 13.5C5.5 13.2239 5.27614 13 5 13C4.44772 13 4 12.5523 4 12L4.00003 9.94145C4.00033 9.49235 4.00065 9.03033 3.83924 8.6268C3.74212 8.384 3.59654 8.17962 3.40072 8.00002C3.59646 7.82057 3.74199 7.61645 3.83912 7.37408C4.00065 6.971 4.00033 6.51001 4.00003 6.063L4 4C4 3.44772 4.44772 3 5 3C5.27614 3 5.5 2.77614 5.5 2.5C5.5 2.22386 5.27614 2 5 2ZM11 2C12.1046 2 13 2.89543 13 4V6.00469C13 6.53494 13.0077 6.79889 13.0891 7.00209C13.1517 7.15835 13.2842 7.33309 13.7236 7.55276C13.893 7.63745 14 7.81058 14 7.99997C14 8.18935 13.893 8.36249 13.7236 8.44719C13.2843 8.66685 13.1519 8.84151 13.0892 8.99819C13.0077 9.20211 13 9.46732 13 10V12C13 13.1046 12.1046 14 11 14C10.7239 14 10.5 13.7761 10.5 13.5C10.5 13.2239 10.7239 13 11 13C11.5523 13 12 12.5523 12 12L12 9.94145C11.9997 9.49235 11.9994 9.03033 12.1608 8.6268C12.2579 8.384 12.4035 8.17962 12.5993 8.00002C12.4035 7.82057 12.258 7.61645 12.1609 7.37408C11.9993 6.971 11.9997 6.51001 12 6.063L12 4C12 3.44772 11.5523 3 11 3C10.7239 3 10.5 2.77614 10.5 2.5C10.5 2.22386 10.7239 2 11 2Z" />
102+
</svg>
96103
{module}
97-
</StyledModuleBadge>
104+
</SectionLink>
98105
);
99106
};
100107

101-
const StyledModuleBadge = styled.button`
102-
font: inherit;
103-
font-size: 14px;
104-
font-weight: 500;
105-
color: var(--text-dim);
106-
background-color: var(--group-members);
107-
border: 1px solid var(--group-border);
108-
padding: 2px 8px;
109-
border-radius: 6px;
110-
margin-left: 8px;
111-
cursor: pointer;
112-
113-
&:hover {
114-
border-color: var(--highlight);
115-
}
116-
`;
117-
118108
export const SchemaClassView: React.FC<{
119109
declaration: api.SchemaClass;
120110
}> = ({ declaration }) => {

src/components/Docs/SchemaEnum.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as api from "./api";
22
import React, { useContext, useMemo } from "react";
33
import { styled } from "@linaria/react";
44
import { ColoredSyntax } from "../ColoredSyntax";
5-
import { KindIcon } from "./utils/components";
5+
import { KindIcon } from "../KindIcon";
66
import { DeclarationsContext } from "./DeclarationsContext";
77
import { MetadataTags } from "./SchemaType";
88
import { formatHexOffset } from "./utils/format";

src/components/Docs/utils/components.tsx

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)