Files
iNaturalistReactNative/src/components/SharedComponents/OfflineNotice.js
Ken-ichi 0b2c8315a0 OfflineNotice (#1388)
* Added clean script; fixed UI Library
* OfflineNotice component; added to Notifications
* OfflineNotice on ObsDetails media
* OfflineNotice for DQA
2024-04-11 17:25:55 -07:00

53 lines
1.2 KiB
JavaScript

// @flow
import classnames from "classnames";
import {
Body2,
INatIcon
} from "components/SharedComponents";
import { Pressable } from "components/styledComponents";
import type { Node } from "react";
import React from "react";
import { useTranslation } from "sharedHooks";
type Props = {
color?: string,
onPress: Function
};
const OfflineNotice = ( {
color,
onPress
}: Props ): Node => {
const { t } = useTranslation( );
if ( typeof ( onPress ) !== "function" ) {
throw new Error( "OfflineNotice needs an onPress function" );
}
return (
<Pressable
accessibilityLabel={t( "Internet-Connection-Required" )}
accessibilityHint={t( "Loads-content-that-requires-an-Internet-connection" )}
onPress={onPress}
className="justify-center items-center w-full h-full"
>
<INatIcon
name="offline"
size={72}
aria-hidden
accessibilityElementsHidden
importantForAccessibility="no"
color={color}
/>
<Body2
className={classnames(
"mt-[30px]",
color && `text-${color}`
)}
>
{ t( "You-are-offline-Tap-to-try-again" ) }
</Body2>
</Pressable>
);
};
export default OfflineNotice;