feat(web): add client utilities
This commit is contained in:
1 parent
a796620b7f
commit
39f3221640
7 files changed
+335
No files matched your search
@@ -0,0 +1,63 @@
|
||||
import type { Position, TeamSide } from '../api/types';
|
||||
import adcIcon from '../assets/position/position-bottom.svg';
|
||||
import jungleIcon from '../assets/position/position-jungle.svg';
|
||||
import midIcon from '../assets/position/position-middle.svg';
|
||||
import supportIcon from '../assets/position/position-support.svg';
|
||||
import topIcon from '../assets/position/position-top.svg';
|
||||
|
||||
export const POSITION_ORDER: Position[] = ['TOP', 'JGL', 'MID', 'ADC', 'SUP'];
|
||||
|
||||
export const positionLabel: Record<Position, string> = {
|
||||
TOP: '탑',
|
||||
JGL: '정글',
|
||||
MID: '미드',
|
||||
ADC: '원딜',
|
||||
SUP: '서폿',
|
||||
};
|
||||
|
||||
export const positionIcon: Record<Position, string> = {
|
||||
TOP: topIcon,
|
||||
JGL: jungleIcon,
|
||||
MID: midIcon,
|
||||
ADC: adcIcon,
|
||||
SUP: supportIcon,
|
||||
};
|
||||
|
||||
const TEAM_TONES = [
|
||||
{
|
||||
border: 'border-blue-500/20',
|
||||
bg: 'bg-blue-500/5',
|
||||
text: 'text-blue-400',
|
||||
bar: 'bg-blue-500',
|
||||
},
|
||||
{
|
||||
border: 'border-red-500/20',
|
||||
bg: 'bg-red-500/5',
|
||||
text: 'text-red-400',
|
||||
bar: 'bg-red-500',
|
||||
},
|
||||
{
|
||||
border: 'border-emerald-500/20',
|
||||
bg: 'bg-emerald-500/5',
|
||||
text: 'text-emerald-400',
|
||||
bar: 'bg-emerald-500',
|
||||
},
|
||||
{
|
||||
border: 'border-amber-500/20',
|
||||
bg: 'bg-amber-500/5',
|
||||
text: 'text-amber-400',
|
||||
bar: 'bg-amber-500',
|
||||
},
|
||||
];
|
||||
|
||||
export function teamIndexLabel(teamIndex: number, fallback?: string) {
|
||||
return fallback?.trim() || `${teamIndex}팀`;
|
||||
}
|
||||
|
||||
export function teamIndexColorClasses(teamIndex: number) {
|
||||
return TEAM_TONES[(Math.max(1, teamIndex) - 1) % TEAM_TONES.length];
|
||||
}
|
||||
|
||||
export function sideShortLabel(side: TeamSide) {
|
||||
return side === 'blue' ? 'BLUE' : 'RED';
|
||||
}
|
||||
Reference in new issue
Block a user