Add CurrencyIcon

This commit is contained in:
Bill 2021-04-15 23:42:00 -04:00
parent bf1f357848
commit 08d0c76b90
5 changed files with 27 additions and 0 deletions

View File

@ -27,4 +27,5 @@ $chat-zindex: 20;
$highscore-zindex: 19; $highscore-zindex: 19;
@import './transitions/TransitionStyles.scss'; @import './transitions/TransitionStyles.scss';
@import './utils/Styles.scss';
@import './views/Styles.scss'; @import './views/Styles.scss';

1
src/utils/Styles.scss Normal file
View File

@ -0,0 +1 @@
@import './currency-icon/CurrencyIcon.scss';

View File

@ -0,0 +1,6 @@
.nitro-currency-icon {
background-position: center;
background-repeat: no-repeat;
width: 25px;
height: 25px;
}

View File

@ -0,0 +1,15 @@
import { Nitro } from 'nitro-renderer';
import { CurrencyIconProps } from './CurrencyIcon.types';
export function CurrencyIcon(props: CurrencyIconProps): JSX.Element
{
let url = Nitro.instance.getConfiguration<string>('currency.asset.icon.url', '');
url = url.replace('%type%', props.type.toString());
url = `url(${ url })`;
return (
<div className="nitro-currency-icon" style={ (url && url.length) ? { backgroundImage: url } : {} } />
);
}

View File

@ -0,0 +1,4 @@
export interface CurrencyIconProps
{
type: number;
}