Map-Bilder und Seitenwahl mit Emblemen
Map-Bilder aus ghostcap-gaming/cs2-map-images lokal als WebP gespeichert (npm run images lädt und verkleinert sie). Bilder in Veto-Kacheln, Pool-Vorschau, Serie und Seitenwahl; CT/T-Embleme aus client/public/sides mit Ersatzsymbol, falls die Dateien fehlen.
This commit is contained in:
1 parent
e304556346
commit
7be0d85ab5
21 files changed
+701
-27
No files matched your search
@@ -0,0 +1,36 @@
|
||||
import { useState } from 'react';
|
||||
|
||||
// Emblem-Dateien in client/public/sides/. Fehlen sie, wird ein schlichtes Ersatzsymbol gezeichnet.
|
||||
const IMAGES = { CT: '/sides/ct.png', T: '/sides/t.png' };
|
||||
|
||||
export default function SideIcon({ side, size = 28 }) {
|
||||
const [failed, setFailed] = useState(false);
|
||||
if (!failed) {
|
||||
return (
|
||||
<img className={`side-icon side-icon-${side.toLowerCase()}`} src={IMAGES[side]} width={size} height={size}
|
||||
alt="" aria-hidden="true" onError={() => setFailed(true)} />
|
||||
);
|
||||
}
|
||||
return <FallbackIcon side={side} size={size} />;
|
||||
}
|
||||
|
||||
function FallbackIcon({ side, size }) {
|
||||
if (side === 'CT') {
|
||||
return (
|
||||
<svg className="side-icon side-icon-ct" viewBox="0 0 32 32" width={size} height={size} aria-hidden="true">
|
||||
<path d="M16 2 4 6.5v8.2C4 22.3 9.1 28 16 30c6.9-2 12-7.7 12-15.3V6.5L16 2z" fill="currentColor" opacity=".22" />
|
||||
<path d="M16 2 4 6.5v8.2C4 22.3 9.1 28 16 30c6.9-2 12-7.7 12-15.3V6.5L16 2z" fill="none" stroke="currentColor" strokeWidth="2" strokeLinejoin="round" />
|
||||
<path d="m16 9 2.1 4.3 4.7.7-3.4 3.3.8 4.7-4.2-2.2-4.2 2.2.8-4.7-3.4-3.3 4.7-.7z" fill="currentColor" />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<svg className="side-icon side-icon-t" viewBox="0 0 32 32" width={size} height={size} aria-hidden="true">
|
||||
<rect x="5" y="11" width="22" height="15" rx="2.5" fill="currentColor" opacity=".22" />
|
||||
<rect x="5" y="11" width="22" height="15" rx="2.5" fill="none" stroke="currentColor" strokeWidth="2" />
|
||||
<rect x="9" y="15" width="9" height="5" rx="1" fill="currentColor" />
|
||||
<circle cx="22.5" cy="17.5" r="1.8" fill="currentColor" />
|
||||
<path d="M11 11V8.5a2.5 2.5 0 0 1 2.5-2.5h2c1.4 0 2.5-1.1 2.5-2.5" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user