mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-22 22:30:52 +01:00
Add CurrencyIcon
This commit is contained in:
parent
bf1f357848
commit
08d0c76b90
@ -27,4 +27,5 @@ $chat-zindex: 20;
|
||||
$highscore-zindex: 19;
|
||||
|
||||
@import './transitions/TransitionStyles.scss';
|
||||
@import './utils/Styles.scss';
|
||||
@import './views/Styles.scss';
|
||||
|
1
src/utils/Styles.scss
Normal file
1
src/utils/Styles.scss
Normal file
@ -0,0 +1 @@
|
||||
@import './currency-icon/CurrencyIcon.scss';
|
6
src/utils/currency-icon/CurrencyIcon.scss
Normal file
6
src/utils/currency-icon/CurrencyIcon.scss
Normal file
@ -0,0 +1,6 @@
|
||||
.nitro-currency-icon {
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
}
|
15
src/utils/currency-icon/CurrencyIcon.tsx
Normal file
15
src/utils/currency-icon/CurrencyIcon.tsx
Normal 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 } : {} } />
|
||||
);
|
||||
}
|
4
src/utils/currency-icon/CurrencyIcon.types.ts
Normal file
4
src/utils/currency-icon/CurrencyIcon.types.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export interface CurrencyIconProps
|
||||
{
|
||||
type: number;
|
||||
}
|
Loading…
Reference in New Issue
Block a user