RocketChat/Rocket.Chat

View on GitHub
apps/meteor/client/views/home/cards/MobileAppsCard.tsx

Summary

Maintainability
A
0 mins
Test Coverage
import type { Card } from '@rocket.chat/fuselage';
import { useTranslation } from '@rocket.chat/ui-contexts';
import type { ComponentProps, ReactElement } from 'react';
import React from 'react';

import { GenericCard, GenericCardButton } from '../../../components/GenericCard';
import { useExternalLink } from '../../../hooks/useExternalLink';

const GOOGLE_PLAY_URL = 'https://go.rocket.chat/i/hp-mobile-app-google';
const APP_STORE_URL = 'https://go.rocket.chat/i/hp-mobile-app-apple';

const MobileAppsCard = (props: Omit<ComponentProps<typeof Card>, 'type'>): ReactElement => {
    const t = useTranslation();
    const handleOpenLink = useExternalLink();

    return (
        <GenericCard
            title={t('Mobile_apps')}
            body={t('Take_rocket_chat_with_you_with_mobile_applications')}
            buttons={[
                <GenericCardButton key={1} onClick={() => handleOpenLink(GOOGLE_PLAY_URL)} children={t('Google_Play')} role='link' />,
                <GenericCardButton key={2} onClick={() => handleOpenLink(APP_STORE_URL)} children={t('App_Store')} role='link' />,
            ]}
            data-qa-id='homepage-mobile-apps-card'
            width='x340'
            {...props}
        />
    );
};

export default MobileAppsCard;