Skip to content

Commit

Permalink
🌗 Toggle theme in the article header block (#214)
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanc1 authored Aug 11, 2023
1 parent 88097cf commit 56430d7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/gentle-bananas-tie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@myst-theme/site': patch
---

Allow to toggle theme in the article header
4 changes: 4 additions & 0 deletions packages/site/src/components/Headers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ import {
import { useGridSystemProvider } from '@myst-theme/providers';
import classNames from 'classnames';
import type { PageFrontmatter } from 'myst-frontmatter';
import { ThemeButton } from './Navigation';

export function ArticleHeader({
frontmatter,
children,
toggleTheme,
className,
}: {
frontmatter: PageFrontmatter;
children?: React.ReactNode;
toggleTheme?: boolean;
className?: string;
}) {
const grid = useGridSystemProvider();
Expand Down Expand Up @@ -78,6 +81,7 @@ export function ArticleHeader({
<OpenAccessBadge open_access={frontmatter?.open_access} />
<GitHubLink github={frontmatter?.github} />
</div>
{toggleTheme && <ThemeButton className="inline-block w-5 h-5 mt-0.5 ml-1" />}
</div>
<FrontmatterBlock
frontmatter={rest}
Expand Down

0 comments on commit 56430d7

Please sign in to comment.