Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🙈 Change hiding long bibliography from 5 to 15 #518

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading