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
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import React from 'react';
import { Image } from 'react-native';
import {
Box,
Text,
Icon,
IconName,
IconSize,
IconColor,
TextVariant,
TextColor,
BoxAlignItems,
Button,
ButtonVariant,
ButtonSize,
} from '@metamask/design-system-react-native';
import { useTailwind } from '@metamask/design-system-twrnc-preset';
import { useAssetFromTheme } from '../../../../../util/theme';
import { strings } from '../../../../../../locales/i18n';
import errorStateLight from '../../../../../images/error-state-no-connection-light.png';
import errorStateDark from '../../../../../images/error-state-no-connection-dark.png';

interface ErrorStateProps {
/** Text describing what failed to load (e.g., "Unable to load predictions") */
Expand All @@ -24,9 +25,12 @@ interface ErrorStateProps {

/**
* Generic error state for homepage sections.
* Shows a wifi-off icon, error message, and a retry button.
* Shows a no-connection illustration, error message, and a retry button.
*/
const ErrorState: React.FC<ErrorStateProps> = ({ title, onRetry }) => {
const tw = useTailwind();
const noConnectionImage = useAssetFromTheme(errorStateLight, errorStateDark);

const handleRetry = () => {
try {
const result = onRetry();
Expand All @@ -42,10 +46,10 @@ const ErrorState: React.FC<ErrorStateProps> = ({ title, onRetry }) => {

return (
<Box alignItems={BoxAlignItems.Center} gap={3} padding={4}>
<Icon
name={IconName.WifiOff}
size={IconSize.Xl}
color={IconColor.IconMuted}
<Image
source={noConnectionImage}
resizeMode="contain"
style={tw.style('w-[72px] h-[72px]')}
/>
<Text
variant={TextVariant.BodyMd}
Expand Down
Binary file added app/images/error-state-no-connection-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/images/error-state-no-connection-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading