5180 fichiers 38.5 Mo 0 téléchargements 306 vues mis à jour il y a 6 heures ui
nitro-v36-with-renderer-v36 / src / components / avatar-editor / palette-set / AvatarEditorPaletteSetItemView.tsx
AvatarEditorPaletteSetItemView.tsx 1.6 Ko Télécharger le fichier
import { IPartColor } from '@octane/renderer';
import { ButtonHTMLAttributes, CSSProperties, FC } from 'react';
import { ColorUtils, GetClubMemberLevel, GetConfigurationValue } from '../../../api';
import hcSmallSrc from '../../../assets/images/avatareditor/air/hc-small.png';
import { NativeTextTree } from '../../../common/native-text/NativeTextTree';
import { ToggleButton } from '../../../common/ToggleButton';

export const AvatarEditorPaletteSetItem: FC<
    {
        partColor: IPartColor;
        isSelected: boolean;
    } & ButtonHTMLAttributes<HTMLButtonElement>
> = (props) => {
    const { partColor = null, isSelected = false, className = '', style = {}, ...rest } = props;

    if (!partColor) return null;

    const isHC = !GetConfigurationValue<boolean>('hc.disabled', false) && partColor.clubLevel > 0;
    const isLocked = isHC && GetClubMemberLevel() < partColor.clubLevel;

    return (
        <NativeTextTree>
            <ToggleButton
                type="button" pressed={isSelected}
                className={`avatar-editor-palette-item${isSelected ? ' is-selected' : ''}${isLocked ? ' is-locked' : ''}${className ? ` ${className}` : ''}`}
                style={style as CSSProperties}
                {...(rest as Record<string, unknown>)}
            >
                <span className="avatar-editor-palette-color" style={{ backgroundColor: ColorUtils.makeColorNumberHex(partColor.rgb & 0xffffff) }} />
                <span className="avatar-editor-palette-frame" />
                {isHC && <img className="avatar-editor-palette-hc" src={hcSmallSrc} alt="" draggable={false} />}
            </ToggleButton>
        </NativeTextTree>
    );
};
15Sujets
1Dépôts
20Membres
2En ligne
Profile
Inscrit
Dernière visite
Messages
0
Votes positifs
0
Votes négatifs
0

Nous utilisons des cookies pour assurer le bon fonctionnement du site et améliorer votre expérience. en savoir plus

Autoriser