Add compact option for amendment-disclaimer

This commit is contained in:
mDuo13
2025-08-14 14:48:46 -07:00
parent 31e9682f81
commit 6947fccf57
2 changed files with 17 additions and 1 deletions

View File

@@ -383,6 +383,7 @@ function AmendmentBadge(props: { amendment: Amendment }) {
export function AmendmentDisclaimer(props: {
name: string,
compact: boolean
}) {
const [amendmentStatus, setStatus] = React.useState<Amendment | null>(null);
const [loading, setLoading] = React.useState(true);
@@ -390,7 +391,7 @@ export function AmendmentDisclaimer(props: {
const { useTranslate } = useThemeHooks();
const { translate } = useTranslate();
const link = () => <Link to={`/resources/known-amendments#${props.name.toLowerCase()}`}>{props.name} amendment</Link>
const link = () => <Link to={`/resources/known-amendments#${props.name.toLowerCase()}`}>{props.name}{ props.compact ? "" : " amendment"}</Link>
React.useEffect(() => {
const fetchAmendments = async () => {
@@ -446,6 +447,16 @@ export function AmendmentDisclaimer(props: {
</em></p>
)
}
if (props.compact) {
return (
<>
{link()}
{" "}
<AmendmentBadge amendment={amendmentStatus} />
</>
)
}
return (
<p><em>(

View File

@@ -229,6 +229,11 @@ export const amendmentDisclaimer: Schema & { tagName: string } = {
type: 'String',
required: true
},
compact: {
type: 'Boolean',
required: false,
default: false
}
},
render: 'AmendmentDisclaimer',
selfClosing: true