|
| 1 | +// SVG Flag components for language selector |
| 2 | +// Using simple, clean flag representations |
| 3 | + |
| 4 | +export const FlagES419 = ({ className }) => ( |
| 5 | + <svg viewBox="0 0 32 24" className={className} aria-hidden="true"> |
| 6 | + <rect width="32" height="24" fill="#AA151B"/> |
| 7 | + <rect y="6" width="32" height="12" fill="#F1BF00"/> |
| 8 | + </svg> |
| 9 | +) |
| 10 | + |
| 11 | +export const FlagGB = ({ className }) => ( |
| 12 | + <svg viewBox="0 0 32 24" className={className} aria-hidden="true"> |
| 13 | + <rect width="32" height="24" fill="#012169"/> |
| 14 | + <path d="M0 0L32 24M32 0L0 24" stroke="#fff" strokeWidth="4"/> |
| 15 | + <path d="M0 0L32 24M32 0L0 24" stroke="#C8102E" strokeWidth="2.5"/> |
| 16 | + <path d="M16 0V24M0 12H32" stroke="#fff" strokeWidth="6"/> |
| 17 | + <path d="M16 0V24M0 12H32" stroke="#C8102E" strokeWidth="4"/> |
| 18 | + </svg> |
| 19 | +) |
| 20 | + |
| 21 | +export const FlagPT = ({ className }) => ( |
| 22 | + <svg viewBox="0 0 32 24" className={className} aria-hidden="true"> |
| 23 | + <rect width="32" height="24" fill="#FF0000"/> |
| 24 | + <rect width="12" height="24" fill="#006600"/> |
| 25 | + <circle cx="12" cy="12" r="4" fill="#FFCC00"/> |
| 26 | + </svg> |
| 27 | +) |
| 28 | + |
| 29 | +export const FlagFR = ({ className }) => ( |
| 30 | + <svg viewBox="0 0 32 24" className={className} aria-hidden="true"> |
| 31 | + <rect width="10.67" height="24" fill="#002654"/> |
| 32 | + <rect x="10.67" width="10.67" height="24" fill="#FFFFFF"/> |
| 33 | + <rect x="21.34" width="10.67" height="24" fill="#ED2939"/> |
| 34 | + </svg> |
| 35 | +) |
| 36 | + |
| 37 | +export const FlagAR = ({ className }) => ( |
| 38 | + <svg viewBox="0 0 32 24" className={className} aria-hidden="true"> |
| 39 | + <rect width="32" height="24" fill="#006C35"/> |
| 40 | + <rect x="8" y="8" width="16" height="8" fill="#FFFFFF"/> |
| 41 | + </svg> |
| 42 | +) |
| 43 | + |
| 44 | +export const FlagDE = ({ className }) => ( |
| 45 | + <svg viewBox="0 0 32 24" className={className} aria-hidden="true"> |
| 46 | + <rect width="32" height="8" fill="#000000"/> |
| 47 | + <rect y="8" width="32" height="8" fill="#DD0000"/> |
| 48 | + <rect y="16" width="32" height="8" fill="#FFCC00"/> |
| 49 | + </svg> |
| 50 | +) |
| 51 | + |
| 52 | +export const FlagRU = ({ className }) => ( |
| 53 | + <svg viewBox="0 0 32 24" className={className} aria-hidden="true"> |
| 54 | + <rect width="32" height="8" fill="#FFFFFF"/> |
| 55 | + <rect y="8" width="32" height="8" fill="#0039A6"/> |
| 56 | + <rect y="16" width="32" height="8" fill="#D52B1E"/> |
| 57 | + </svg> |
| 58 | +) |
| 59 | + |
| 60 | +export const FlagCN = ({ className }) => ( |
| 61 | + <svg viewBox="0 0 32 24" className={className} aria-hidden="true"> |
| 62 | + <rect width="32" height="24" fill="#DE2910"/> |
| 63 | + <g fill="#FFDE00"> |
| 64 | + <polygon points="5,3 6.2,6.7 3,4.8 7,4.8 3.8,6.7"/> |
| 65 | + <polygon points="9,1 9.4,2.5 8,1.7 10,1.7 8.6,2.5"/> |
| 66 | + <polygon points="11,3 11.4,4.5 10,3.7 12,3.7 10.6,4.5"/> |
| 67 | + <polygon points="11,6 11.4,7.5 10,6.7 12,6.7 10.6,7.5"/> |
| 68 | + <polygon points="9,8 9.4,9.5 8,8.7 10,8.7 8.6,9.5"/> |
| 69 | + </g> |
| 70 | + </svg> |
| 71 | +) |
| 72 | + |
| 73 | +const flags = { |
| 74 | + es419: FlagES419, |
| 75 | + gb: FlagGB, |
| 76 | + pt: FlagPT, |
| 77 | + fr: FlagFR, |
| 78 | + ar: FlagAR, |
| 79 | + de: FlagDE, |
| 80 | + ru: FlagRU, |
| 81 | + cn: FlagCN, |
| 82 | +} |
| 83 | + |
| 84 | +export const Flag = ({ code, className }) => { |
| 85 | + const FlagComponent = flags[code] |
| 86 | + if (!FlagComponent) return null |
| 87 | + return <FlagComponent className={className} /> |
| 88 | +} |
| 89 | + |
| 90 | +export default Flag |
0 commit comments