Skip to content

Commit

Permalink
🐛 Hide frontmatter bar properly (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanc1 authored Aug 2, 2023
1 parent ed13744 commit 8f5a310
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/spotty-insects-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@myst-theme/frontmatter': patch
---

Hide the frontmatter badges bar properly
11 changes: 6 additions & 5 deletions packages/frontmatter/src/FrontmatterBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -302,16 +302,17 @@ export function FrontmatterBlock({
const isJupyter = kind === SourceFileKind.Notebook;
const hasExports = exports && exports.length > 0;
const hasAuthors = authors && authors.length > 0;
const hasHeaders =
subject || github || venue || biblio || open_access || license || hasExports || isJupyter;
const hasDateOrDoi = doi || date;
if (!title && !subtitle && !hasHeaders && !hasAuthors && !hasDateOrDoi) {
const hasBadges = !!open_access || !!license || !!hasExports || !!isJupyter || !!github;
const hasHeaders = !!subject || !!venue || !!biblio;
const hasDateOrDoi = !!doi || !!date;
const showHeaderBlock = hasHeaders || (hasBadges && !hideBadges) || (hasExports && !hideExports);
if (!title && !subtitle && !showHeaderBlock && !hasAuthors && !hasDateOrDoi) {
// Nothing to show!
return null;
}
return (
<div className={classNames(className)}>
{hasHeaders && (
{showHeaderBlock && (
<div className="flex items-center h-6 mt-3 mb-5 text-sm font-light">
{subject && (
<div
Expand Down

0 comments on commit 8f5a310

Please sign in to comment.