Skip to content

Commit 06ab657

Browse files
committed
fixes
1 parent ed2208f commit 06ab657

4 files changed

Lines changed: 14 additions & 14 deletions

File tree

web/src/components/Search/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export const SearchInput = styled.input.attrs({ type: "search" })`
2929
border-radius: 8px;
3030
background: ${(props) => props.theme.searchbox.background};
3131
color: ${(props) => props.theme.text};
32+
font-family: inherit;
3233
font-size: 14px;
3334
outline: none;
3435
transition: border-color 0.15s, box-shadow 0.15s;
@@ -43,7 +44,7 @@ export const SearchInput = styled.input.attrs({ type: "search" })`
4344
}
4445
`;
4546

46-
export function SearchBox({ baseUrl, className }: { baseUrl: string; className?: string }) {
47+
export function SearchBox({ baseUrl, className, placeholder = "Search..." }: { baseUrl: string; className?: string; placeholder?: string }) {
4748
const { search, setSearch } = useContext(SearchContext);
4849
const navigate = useNavigate();
4950
const location = useLocation();
@@ -80,7 +81,7 @@ export function SearchBox({ baseUrl, className }: { baseUrl: string; className?:
8081
return (
8182
<SearchInput
8283
className={className}
83-
placeholder="Search..."
84+
placeholder={placeholder}
8485
ref={ref}
8586
value={search}
8687
onChange={onChange}

web/src/components/layout/NavBar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function NavBarWithSearch({ baseUrl }: { baseUrl: string }) {
3131
/>
3232
</NavBarSidebarCell>
3333
<NavBarContentCell>
34-
<NavBarSearchBox baseUrl={baseUrl} />
34+
<NavBarSearchBox baseUrl={baseUrl} placeholder="Search... (module:name to filter)" />
3535
<HomeBrandLink to="/schemas">Source 2 Schemas</HomeBrandLink>
3636
<NavBarThemeSwitcher />
3737
</NavBarContentCell>

web/src/components/layout/Sidebar.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import React, { useContext } from "react";
2+
import { NavLink } from "react-router-dom";
23
import styled from "styled-components";
34
import { IconKind, KindIcon } from "~components/KindIcon";
45
import { Declaration } from "~components/Docs/api";
56
import { DeclarationsContext } from "~components/Docs/DeclarationsContext";
67

7-
const SidebarLink = styled.a`
8+
const SidebarLink = styled(NavLink)`
89
display: block;
910
background: transparent;
1011
border-radius: 6px;
@@ -37,32 +38,30 @@ const SidebarKindIcon = styled(KindIcon)`
3738
`;
3839

3940
export const SidebarElement: React.FC<{
40-
href: string;
41+
to: string;
4142
icon: IconKind;
4243
text: string;
43-
active?: boolean;
44-
}> = React.memo(({ href, icon, text, active }) => (
45-
<SidebarLink href={href} className={active ? "active" : undefined}>
44+
}> = React.memo(({ to, icon, text }) => (
45+
<SidebarLink to={to}>
4646
<SidebarKindIcon kind={icon} size="small" /> {text}
4747
</SidebarLink>
4848
));
4949

50-
export const DeclarationSidebarElement: React.FC<{ declaration: Declaration; active?: boolean }> = React.memo(({ declaration, active }) => {
50+
export const DeclarationSidebarElement: React.FC<{ declaration: Declaration }> = React.memo(({ declaration }) => {
5151
const { root } = useContext(DeclarationsContext);
5252
return (
5353
<SidebarElement
54-
href={`#${root}/${declaration.name}`}
54+
to={`${root}/${declaration.name}`}
5555
icon={declaration.kind}
5656
text={declaration.name}
57-
active={active}
5857
/>
5958
);
6059
});
6160

6261
export const SidebarGroupHeader = styled.div<{ $collapsed: boolean }>`
6362
background: ${(props) => props.theme.sidebar};
6463
padding: 0 6px;
65-
height: 100%;
64+
height: 28px;
6665
box-sizing: border-box;
6766
font-size: 14px;
6867
font-weight: 600;

web/src/pages/DeclarationsSidebar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export const DeclarationsSidebar = () => {
147147
}}
148148
>
149149
{isHeader ? (
150-
<div style={{ paddingTop: virtualRow.index > 0 ? HEADER_GAP : 0, height: "100%", background: "inherit" }}>
150+
<div style={{ paddingTop: virtualRow.index > 0 && !isActiveSticky ? HEADER_GAP : 0, background: "inherit" }}>
151151
<SidebarGroupHeader
152152
$collapsed={collapsed.has(row.module)}
153153
onClick={() => toggleModule(row.module)}
@@ -156,7 +156,7 @@ export const DeclarationsSidebar = () => {
156156
</SidebarGroupHeader>
157157
</div>
158158
) : (
159-
<DeclarationSidebarElement declaration={row.declaration} active={scope === row.declaration.name} />
159+
<DeclarationSidebarElement declaration={row.declaration} />
160160
)}
161161
</div>
162162
);

0 commit comments

Comments
 (0)