Skip to content

Commit 6947fcc

Browse files
committed
Add compact option for amendment-disclaimer
1 parent 31e9682 commit 6947fcc

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

@theme/markdoc/components.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,14 +383,15 @@ function AmendmentBadge(props: { amendment: Amendment }) {
383383

384384
export function AmendmentDisclaimer(props: {
385385
name: string,
386+
compact: boolean
386387
}) {
387388
const [amendmentStatus, setStatus] = React.useState<Amendment | null>(null);
388389
const [loading, setLoading] = React.useState(true);
389390
const [error, setError] = React.useState<string | null>(null);
390391
const { useTranslate } = useThemeHooks();
391392
const { translate } = useTranslate();
392393

393-
const link = () => <Link to={`/resources/known-amendments#${props.name.toLowerCase()}`}>{props.name} amendment</Link>
394+
const link = () => <Link to={`/resources/known-amendments#${props.name.toLowerCase()}`}>{props.name}{ props.compact ? "" : " amendment"}</Link>
394395

395396
React.useEffect(() => {
396397
const fetchAmendments = async () => {
@@ -446,6 +447,16 @@ export function AmendmentDisclaimer(props: {
446447
</em></p>
447448
)
448449
}
450+
451+
if (props.compact) {
452+
return (
453+
<>
454+
{link()}
455+
{" "}
456+
<AmendmentBadge amendment={amendmentStatus} />
457+
</>
458+
)
459+
}
449460

450461
return (
451462
<p><em>(

@theme/markdoc/schema.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,11 @@ export const amendmentDisclaimer: Schema & { tagName: string } = {
229229
type: 'String',
230230
required: true
231231
},
232+
compact: {
233+
type: 'Boolean',
234+
required: false,
235+
default: false
236+
}
232237
},
233238
render: 'AmendmentDisclaimer',
234239
selfClosing: true

0 commit comments

Comments
 (0)