Skip to content

Commit f4b69ed

Browse files
committed
docs: add since badge
1 parent 84cd4df commit f4b69ed

File tree

4 files changed

+128
-1
lines changed

4 files changed

+128
-1
lines changed

website/docs/usage.mdx

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ slug: /usage/
33
sidebar_position: 4
44
---
55

6+
import AvailableSinceBadge from '../src/components/AvailableSince';
67
import Tabs from '@theme/Tabs';
78
import TabItem from '@theme/TabItem';
89

@@ -310,6 +311,7 @@ includes:
310311
```
311312

312313
### Flatten includes
314+
<AvailableSinceBadge version="3.31.0" />
313315

314316
You can flatten the included Taskfile tasks into the main Taskfile by using the `flatten` option.
315317
It means that the included Taskfile tasks will be available without the namespace.

website/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
"react": "^19.0.0",
2828
"react-dom": "^19.0.0",
2929
"remark-gfm": "^4.0.0",
30-
"remark-github": "^12.0.0"
30+
"remark-github": "^12.0.0",
31+
"react-icons" : "^5.5.0"
3132
},
3233
"devDependencies": {
3334
"@docusaurus/module-type-aliases": "^3.5.2",
+119
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
import React from 'react';
2+
import { FaCalendarCheck } from 'react-icons/fa';
3+
import { useColorMode } from '@docusaurus/theme-common';
4+
5+
type Props = {
6+
version: string;
7+
};
8+
9+
export default function AvailableSince({ version }: Props) {
10+
const { colorMode } = useColorMode();
11+
12+
const isDark = colorMode === 'dark';
13+
14+
15+
// Available Since color standard
16+
const style = {
17+
display: 'inline-flex',
18+
alignItems: 'center',
19+
backgroundColor: isDark ? '#004d40' : '#e0f7fa',
20+
color: isDark ? '#b2dfdb' : '#00796b',
21+
padding: '0.25em 0.6em',
22+
borderRadius: '6px',
23+
fontSize: '0.85em',
24+
fontWeight: 500,
25+
};
26+
27+
28+
//Color standard badge
29+
30+
const styleBadge = {
31+
display: 'inline-flex',
32+
alignItems: 'center',
33+
border: `1px solid ${isDark ? '#66bb6a' : '#2e7d32'}`,
34+
color: isDark ? '#a5d6a7' : '#2e7d32',
35+
padding: '0.2em 0.6em',
36+
borderRadius: '999px',
37+
fontSize: '0.8em',
38+
fontWeight: 500,
39+
backgroundColor: isDark ? 'transparent' : '#f0fdf4',
40+
};
41+
42+
43+
// Standard task color
44+
45+
const styleStandardTaskColor = {
46+
display: 'inline-flex',
47+
alignItems: 'center',
48+
backgroundColor: isDark ? 'var(--ifm-color-primary-darkest)' : '#e0f7f5',
49+
color: isDark ? '#fffdf9' : 'var(--ifm-color-primary-darker)',
50+
padding: '0.25em 0.6em',
51+
borderRadius: '6px',
52+
fontSize: '0.85em',
53+
fontWeight: 500,
54+
};
55+
56+
// Badge task color
57+
const styleBadgeTaskColor = {
58+
display: 'inline-flex',
59+
alignItems: 'center',
60+
border: `1px solid var(--ifm-color-primary)`,
61+
color: isDark ? '#fffdf9' : 'var(--ifm-color-primary)',
62+
padding: '0.2em 0.6em',
63+
borderRadius: '999px',
64+
fontSize: '0.8em',
65+
fontWeight: 500,
66+
backgroundColor: isDark ? 'transparent' : '#f0fdfa',
67+
};
68+
69+
const styleBadgeTaskColor2 = {
70+
display: 'inline-flex',
71+
alignItems: 'center',
72+
border: `1px solid var(--ifm-color-primary)`,
73+
color: isDark ? '#fffdf9' : 'var(--ifm-color-primary-darkest)',
74+
padding: '0.2em 0.6em',
75+
borderRadius: '999px',
76+
fontSize: '0.8em',
77+
fontWeight: 500,
78+
backgroundColor: isDark ? 'var(--ifm-color-primary)' : '#f0fdfa',
79+
};
80+
81+
82+
return (
83+
<div style={{ display: 'flex', flexDirection: 'column', gap: '1em' }}>
84+
<div>
85+
<span style={style}>
86+
<FaCalendarCheck style={{ marginRight: '0.4em' }} />
87+
Since {version}
88+
</span>
89+
</div>
90+
<div>
91+
<span style={styleBadge}>
92+
<FaCalendarCheck style={{ marginRight: '0.4em' }} />
93+
Since {version}
94+
</span>
95+
</div>
96+
<div>
97+
<span style={styleStandardTaskColor}>
98+
<FaCalendarCheck style={{ marginRight: '0.4em' }} />
99+
Since {version}
100+
</span>
101+
</div>
102+
<div>
103+
<span style={styleBadgeTaskColor}>
104+
<FaCalendarCheck style={{ marginRight: '0.4em' }} />
105+
Since {version}
106+
</span>
107+
</div>
108+
109+
<div>
110+
<span style={styleBadgeTaskColor2}>
111+
<FaCalendarCheck style={{ marginRight: '0.4em' }} />
112+
Since {version}
113+
</span>
114+
</div>
115+
</div>
116+
);
117+
}
118+
119+

website/yarn.lock

+5
Original file line numberDiff line numberDiff line change
@@ -7441,6 +7441,11 @@ react-fast-compare@^3.2.0:
74417441
react-fast-compare "^3.2.0"
74427442
shallowequal "^1.1.0"
74437443

7444+
react-icons@^5.5.0:
7445+
version "5.5.0"
7446+
resolved "https://registry.yarnpkg.com/react-icons/-/react-icons-5.5.0.tgz#8aa25d3543ff84231685d3331164c00299cdfaf2"
7447+
integrity sha512-MEFcXdkP3dLo8uumGI5xN3lDFNsRtrjbOEKDLD7yv76v4wpnEq2Lt2qeHaQOr34I/wPN3s3+N08WkQ+CW37Xiw==
7448+
74447449
react-is@^16.13.1, react-is@^16.6.0, react-is@^16.7.0:
74457450
version "16.13.1"
74467451
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"

0 commit comments

Comments
 (0)