diff --git a/dev-client/__tests__/integration/__snapshots__/CreateProjectScreen-test.tsx.snap b/dev-client/__tests__/integration/__snapshots__/CreateProjectScreen-test.tsx.snap index 779b19059..4b25ac0a2 100644 --- a/dev-client/__tests__/integration/__snapshots__/CreateProjectScreen-test.tsx.snap +++ b/dev-client/__tests__/integration/__snapshots__/CreateProjectScreen-test.tsx.snap @@ -1012,134 +1012,102 @@ exports[`renders correctly 1`] = ` are visible to anyone on the LandPKS data portal. - - - LandPKS Data Portal - - - - - + LandPKS Data Portal + + + - - - LandPKS Data Portal - - - - - + LandPKS Data Portal + + + - - - LandPKS Data Portal - - - - - + LandPKS Data Portal + + + { + const [pressed, setPressed] = useState(false); + const colors = disabled ? COLORS.disabled : COLORS[type]; + + return ( + + ); +}; + +export const COLORS = { + default: { + default: 'primary.main', + pressed: 'primary.dark', + }, + error: { + default: 'error.main', + pressed: 'error.content', + }, + disabled: { + default: 'text.disabled', + pressed: 'text.disabled', + }, +}; diff --git a/dev-client/src/components/links/ExternalLink.tsx b/dev-client/src/components/links/ExternalLink.tsx index 002fa0943..25a30303a 100644 --- a/dev-client/src/components/links/ExternalLink.tsx +++ b/dev-client/src/components/links/ExternalLink.tsx @@ -15,17 +15,10 @@ * along with this program. If not, see https://www.gnu.org/licenses/. */ -import React, {useCallback, useMemo} from 'react'; -import {Linking, Pressable, StyleSheet, View} from 'react-native'; +import {useCallback, useMemo} from 'react'; +import {Linking} from 'react-native'; -import {IconButton as NativeIconButton} from 'native-base'; - -import {Icon} from 'terraso-mobile-client/components/icons/Icon'; -import { - Box, - Row, - Text, -} from 'terraso-mobile-client/components/NativeBaseAdapters'; +import {TextButton} from 'terraso-mobile-client/components/buttons/TextButton'; import {validateUrl} from 'terraso-mobile-client/util'; export type ExternalLinkProps = { @@ -33,44 +26,18 @@ export type ExternalLinkProps = { url: string; }; -export const ExternalLink = React.forwardRef( - ({label, url}: ExternalLinkProps, ref: React.Ref) => { - const isValidUrl = useMemo(() => validateUrl(url), [url]); - const openUrl = useCallback(() => Linking.openURL(url), [url]); - - return ( - isValidUrl && ( - - - - - - {label} - - } - /> - - - - - ) - ); - }, -); +export const ExternalLink = ({label, url}: ExternalLinkProps) => { + const isValidUrl = useMemo(() => validateUrl(url), [url]); + const openUrl = useCallback(() => Linking.openURL(url), [url]); -const styles = StyleSheet.create({ - container: { - paddingHorizontal: 11, - paddingVertical: 8, - }, - label: { - marginRight: 4, - verticalAlign: 'middle', - }, -}); + return ( + isValidUrl && ( + + ) + ); +};