Skip to content

Commit

Permalink
🙈 Change hiding long bibliography from 5 to 15 (#518)
Browse files Browse the repository at this point in the history
Based on feedback from @dellaert
  • Loading branch information
rowanc1 authored Jan 10, 2025
1 parent 5311b9d commit 40572ab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/long-shirts-behave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@myst-theme/site': patch
---

Hide long bibliography changed to 15
10 changes: 5 additions & 5 deletions packages/site/src/components/Bibliography.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@ import classNames from 'classnames';
import { HashLink } from 'myst-to-react';
import { useState } from 'react';

const HIDE_OVER_N_REFERENCES = 5;

export function Bibliography({
containerClassName,
innerClassName,
hideLongBibliography = 15,
}: {
containerClassName?: string;
innerClassName?: string;
hideLongBibliography?: false | number;
}) {
const references = useReferences();
const grid = useGridSystemProvider();
const { order, data } = references?.cite ?? {};
const filtered = order?.filter((l) => l);
const [hidden, setHidden] = useState(true);
if (!filtered || !data || filtered.length === 0) return null;
const refs = hidden ? filtered.slice(0, HIDE_OVER_N_REFERENCES) : filtered;
const refs = hidden && hideLongBibliography ? filtered.slice(0, hideLongBibliography) : filtered;
return (
<section
id="references"
className={classNames(grid, 'subgrid-gap col-screen', containerClassName)}
>
<div className={innerClassName}>
{filtered.length > HIDE_OVER_N_REFERENCES && (
{!!hideLongBibliography && filtered.length > hideLongBibliography && (
<button
onClick={() => setHidden(!hidden)}
className="float-right p-1 px-2 text-xs border rounded hover:border-blue-500 dark:hover:border-blue-400"
Expand Down Expand Up @@ -56,7 +56,7 @@ export function Bibliography({
/>
);
})}
{filtered.length > HIDE_OVER_N_REFERENCES && (
{!!hideLongBibliography && filtered.length > hideLongBibliography && (
<li className="text-center list-none">
<button
onClick={() => setHidden(!hidden)}
Expand Down

0 comments on commit 40572ab

Please sign in to comment.