mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-26 20:39:08 +01:00
Fall back to aggregator name when icon is unavailable (Swaps Load View) (#11718)
This commit is contained in:
parent
24d563fc2c
commit
7f0b2a81ce
@ -10,22 +10,31 @@ function hexToRGB(hex, alpha) {
|
|||||||
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function AggregatorLogo({ icon, color }) {
|
export default function AggregatorLogo({ name, icon, color }) {
|
||||||
return (
|
return (
|
||||||
<div className="loading-swaps-quotes__logo">
|
<div className="loading-swaps-quotes__logo">
|
||||||
<div
|
{icon && color ? (
|
||||||
style={{
|
<div
|
||||||
background: color,
|
style={{
|
||||||
boxShadow: `0px 4px 20px ${hexToRGB(color, 0.25)}`,
|
background: color,
|
||||||
}}
|
boxShadow: `0px 4px 20px ${hexToRGB(color, 0.25)}`,
|
||||||
>
|
}}
|
||||||
<img src={icon} alt="" />
|
>
|
||||||
</div>
|
<img src={icon} alt="" />
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
name && (
|
||||||
|
<div>
|
||||||
|
<span>{name}</span>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
AggregatorLogo.propTypes = {
|
AggregatorLogo.propTypes = {
|
||||||
icon: PropTypes.string.isRequired,
|
name: PropTypes.string,
|
||||||
color: PropTypes.string.isRequired,
|
icon: PropTypes.string,
|
||||||
|
color: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
@ -107,12 +107,17 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
background: $ui-black;
|
||||||
}
|
}
|
||||||
|
|
||||||
img {
|
img {
|
||||||
width: 74px;
|
width: 74px;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
span {
|
||||||
|
color: $ui-white;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__loading-bar-container {
|
&__loading-bar-container {
|
||||||
|
@ -220,7 +220,7 @@ export default function LoadingSwapsQuotes({
|
|||||||
key={`aggregator-logo-${aggName}`}
|
key={`aggregator-logo-${aggName}`}
|
||||||
>
|
>
|
||||||
<AggregatorLogo
|
<AggregatorLogo
|
||||||
aggregatorName={aggName}
|
name={aggregatorMetadata[aggName]?.title}
|
||||||
icon={aggregatorMetadata[aggName]?.icon}
|
icon={aggregatorMetadata[aggName]?.icon}
|
||||||
color={aggregatorMetadata[aggName]?.color}
|
color={aggregatorMetadata[aggName]?.color}
|
||||||
/>
|
/>
|
||||||
@ -245,6 +245,7 @@ LoadingSwapsQuotes.propTypes = {
|
|||||||
onDone: PropTypes.func.isRequired,
|
onDone: PropTypes.func.isRequired,
|
||||||
aggregatorMetadata: PropTypes.objectOf(
|
aggregatorMetadata: PropTypes.objectOf(
|
||||||
PropTypes.shape({
|
PropTypes.shape({
|
||||||
|
title: PropTypes.string,
|
||||||
color: PropTypes.string,
|
color: PropTypes.string,
|
||||||
icon: PropTypes.string,
|
icon: PropTypes.string,
|
||||||
}),
|
}),
|
||||||
|
Loading…
Reference in New Issue
Block a user