Skip to content

Commit

Permalink
docs: 📝 always display doc links
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan6erbond committed May 21, 2023
1 parent fee9856 commit e5def79
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 74 deletions.
134 changes: 63 additions & 71 deletions docs/src/components/layout/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,9 @@ import { TbHome } from "react-icons/tb";
interface DocsHeaderProps {
navbarOpen?: boolean;
toggleNavbar?: () => void;
withDocsLink?: boolean;
}

function DocsHeader({
navbarOpen,
toggleNavbar,
withDocsLink,
}: DocsHeaderProps) {
function DocsHeader({ navbarOpen, toggleNavbar }: DocsHeaderProps) {
const theme = useMantineTheme();

const idx = useRef<lunr.Index | null>(null);
Expand All @@ -45,7 +40,8 @@ function DocsHeader({
const [searchResults, setSearchResults] = useState([] as lunr.Index.Result[]);

useEffect(() => {
setSearchResults((search && idx.current?.search(search)) || []);
const searchResults = (search && idx.current?.search(search)) || [];
setSearchResults(searchResults);
}, [idx, search, setSearchResults]);

return (
Expand Down Expand Up @@ -80,70 +76,66 @@ function DocsHeader({
</ActionIcon>
</MediaQuery>

{withDocsLink && (
<>
<MediaQuery smallerThan="md" styles={{ display: "none" }}>
<Group>
<Anchor
component={Link}
href="/installation"
unstyled
py="md"
px="sm"
size="lg"
ml="xl"
sx={{ ":hover": { color: theme.colors.dark[2] } }}
>
Installation
</Anchor>
<Anchor
component={Link}
href="/configuration"
unstyled
py="md"
px="sm"
size="lg"
sx={{ ":hover": { color: theme.colors.dark[2] } }}
>
Configuration
</Anchor>
<Anchor
component={Link}
href="/authentication"
unstyled
py="md"
px="sm"
size="lg"
sx={{ ":hover": { color: theme.colors.dark[2] } }}
>
Authentication
</Anchor>
<Anchor
component={Link}
href="/integrations/api-keys"
unstyled
py="md"
px="sm"
size="lg"
sx={{ ":hover": { color: theme.colors.dark[2] } }}
>
Integrations
</Anchor>
</Group>
</MediaQuery>
<MediaQuery largerThan="md" styles={{ display: "none" }}>
<Anchor
component={Link}
href="/installation"
unstyled
size="lg"
sx={{ ":hover": { color: theme.colors.dark[2] } }}
>
Installation
</Anchor>
</MediaQuery>
</>
)}
<MediaQuery smallerThan="md" styles={{ display: "none" }}>
<Group>
<Anchor
component={Link}
href="/installation"
unstyled
py="md"
px="sm"
size="lg"
ml="xl"
sx={{ ":hover": { color: theme.colors.dark[2] } }}
>
Installation
</Anchor>
<Anchor
component={Link}
href="/configuration"
unstyled
py="md"
px="sm"
size="lg"
sx={{ ":hover": { color: theme.colors.dark[2] } }}
>
Configuration
</Anchor>
<Anchor
component={Link}
href="/authentication"
unstyled
py="md"
px="sm"
size="lg"
sx={{ ":hover": { color: theme.colors.dark[2] } }}
>
Authentication
</Anchor>
<Anchor
component={Link}
href="/integrations/api-keys"
unstyled
py="md"
px="sm"
size="lg"
sx={{ ":hover": { color: theme.colors.dark[2] } }}
>
Integrations
</Anchor>
</Group>
</MediaQuery>
<MediaQuery largerThan="md" styles={{ display: "none" }}>
<Anchor
component={Link}
href="/installation"
unstyled
size="lg"
sx={{ ":hover": { color: theme.colors.dark[2] } }}
>
Installation
</Anchor>
</MediaQuery>

<Box sx={{ flex: 1, width: "auto" }} />
<MediaQuery smallerThan="sm" styles={{ display: "none" }}>
Expand Down
5 changes: 2 additions & 3 deletions docs/src/components/layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import DocsHeader from "./header";

interface LayoutProps {
children: React.ReactNode;
withDocsLink?: boolean;
}

function Layout({ children, withDocsLink }: LayoutProps) {
function Layout({ children }: LayoutProps) {
return (
<AppShell
styles={(theme) => ({
Expand All @@ -20,7 +19,7 @@ function Layout({ children, withDocsLink }: LayoutProps) {
},
})}
padding="md"
header={<DocsHeader withDocsLink={withDocsLink} />}
header={<DocsHeader />}
footer={<DocsFooter />}
>
{children}
Expand Down

0 comments on commit e5def79

Please sign in to comment.