A Metamask fork with Infura removed and default networks editable
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
ciphermask/ui/pages/swaps/loading-swaps-quotes/aggregator-logo.js

40 lines
928 B

import React from 'react';
import PropTypes from 'prop-types';
// Inspired by https://stackoverflow.com/a/28056903/4727685
function hexToRGB(hex, alpha) {
const r = parseInt(hex.slice(1, 3), 16);
const g = parseInt(hex.slice(3, 5), 16);
const b = parseInt(hex.slice(5, 7), 16);
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
}
export default function AggregatorLogo({ name, icon, color }) {
return (
<div className="loading-swaps-quotes__logo">
{icon && color ? (
<div
style={{
background: color,
boxShadow: `0px 4px 20px ${hexToRGB(color, 0.25)}`,
}}
>
<img src={icon} alt="" />
</div>
) : (
name && (
<div>
<span>{name}</span>
</div>
)
)}
</div>
);
}
AggregatorLogo.propTypes = {
name: PropTypes.string,
icon: PropTypes.string,
color: PropTypes.string,
};