mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-29 23:58:06 +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,9 +10,10 @@ 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">
|
||||||
|
{icon && color ? (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
background: color,
|
background: color,
|
||||||
@ -21,11 +22,19 @@ export default function AggregatorLogo({ icon, color }) {
|
|||||||
>
|
>
|
||||||
<img src={icon} alt="" />
|
<img src={icon} alt="" />
|
||||||
</div>
|
</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