|
| 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 | + |
0 commit comments