Skip to content
Open
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
2 changes: 1 addition & 1 deletion docs/templates/templates-introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import VersionBadge from '@site/src/components/VersionBadge';

# Templates <VersionBadge version="1.2.0" />
# Templates <VersionBadge version="1.2.0" variant="title" />

:::tip Ready to get started?
If you want to jump straight into using templates, check out:
Expand Down
2 changes: 1 addition & 1 deletion docs/testing/change-validator.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sidebar_position: 1.5
---
import VersionBadge from '@site/src/components/VersionBadge';

# Change validator <VersionBadge version="1.2.0" />
# Change validator <VersionBadge version="1.2.0" variant="title" />

`ChangeValidator` is a fluent assertion utility for verifying that change units carry the correct metadata — both code-based change **classes** and YAML **template-based change files**. It reads metadata via reflection or YAML parsing and asserts that the values match your expectations.

Expand Down
13 changes: 9 additions & 4 deletions src/components/VersionBadge/index.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
export default function VersionBadge({ version }) {
const VARIANT_STYLES = {
default: { fontSize: '0.65em', padding: '0.1rem 0.5rem', marginLeft: '0.5rem' },
title: { fontSize: '0.35em', padding: '0.05rem 0.28rem', marginLeft: '0.5rem' },
table: { fontSize: '0.6em', padding: '0.05rem 0.35rem', marginLeft: '0.3rem' },
};

export default function VersionBadge({ version, variant = 'default' }) {
const variantStyle = VARIANT_STYLES[variant] ?? VARIANT_STYLES.default;
return (
<span style={{
backgroundColor: 'var(--ifm-color-primary)',
color: 'white',
padding: '0.1rem 0.5rem',
borderRadius: '4px',
fontSize: '0.65em',
fontWeight: '600',
verticalAlign: 'middle',
marginLeft: '0.5rem',
letterSpacing: '0.03em',
...variantStyle,
}}>
Since {version}
</span>
Expand Down