Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/snap-networks-utils/src/ui/Asset/Asset.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Asset, AssetIcon, QUESTION_MARK_SVG } from './Asset';
import { Asset, AssetIcon } from './Asset';
import questionMarkIcon from './question-mark.svg';

const render = (props: Partial<Parameters<typeof Asset>[0]> = {}): string =>
JSON.stringify(Asset({ symbol: 'XLM', amount: '1.5', ...props }));
Expand All @@ -20,7 +21,7 @@ describe('AssetIcon', () => {
(iconUrl) => {
const serialized = JSON.stringify(AssetIcon({ iconUrl }));

expect(serialized).toContain(JSON.stringify(QUESTION_MARK_SVG));
expect(serialized).toContain(JSON.stringify(questionMarkIcon));
expect(serialized).toContain('"height":16');
},
);
Expand Down
7 changes: 2 additions & 5 deletions packages/snap-networks-utils/src/ui/Asset/Asset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ import {
} from '@metamask/snaps-sdk/jsx';
import type { IconProps } from '@metamask/snaps-sdk/jsx';

// Raw SVG markup: `Image` accepts it as `src`, and the library build cannot
// bundle `.svg` imports the way `mm-snap` does.
export const QUESTION_MARK_SVG =
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="16" height="16"><path fill="#999999" d="M42.75 24c0 10.59375-8.53125 19.21875-19.125 19.21875-10.6875 0-19.21875-8.625-19.21875-19.21875 0-10.59375 8.53125-19.21875 19.21875-19.21875 10.59375 0 19.125 8.625 19.125 19.21875zM23.625 14.0625c-3.09375 0-5.90625 2.25-5.90625 5.4375 0 0.84375 0.75 1.59375 1.59375 1.59375 0.84375 0 1.59375-0.75 1.59375-1.59375 0-1.125 1.03125-2.25 2.71875-2.25 1.59375 0 2.625 1.125 2.625 2.25 0 0.5625-0.375 1.03125-1.3125 1.59375l0 0c-1.125 0.75-3 1.96875-3 4.5l0 0.46875c0 0.84375 0.75 1.59375 1.6875 1.59375 0.84375 0 1.59375-0.75 1.59375-1.59375l0-0.46875c0-0.65625 0.28125-1.125 1.40625-1.78125 1.03125-0.65625 2.8125-1.875 2.8125-4.3125 0-3.1875-2.8125-5.4375-5.8125-5.4375zM23.53125 31.875c-0.84375 0-1.59375 0.65625-1.59375 1.59375 0 0.84375 0.75 1.59375 1.59375 1.59375l0.09375 0c0.84375 0 1.59375-0.75 1.59375-1.59375 0-0.9375-0.75-1.59375-1.59375-1.59375z"/></svg>';
import questionMarkIcon from './question-mark.svg';

const IconSize = {
sm: 16,
Expand Down Expand Up @@ -63,7 +60,7 @@ export const AssetIcon = ({
}: AssetIconProps): ComponentOrElement => (
<Image
borderRadius="full"
src={iconUrl?.trim() ? iconUrl : QUESTION_MARK_SVG}
src={iconUrl?.trim() ? iconUrl : questionMarkIcon}
height={IconSize[size]}
width={IconSize[size]}
/>
Expand Down
3 changes: 3 additions & 0 deletions packages/snap-networks-utils/src/ui/Asset/question-mark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading