bigbuffet-rw/app/soapbox/features/ui/components/cta-banner.tsx

45 lines
1.6 KiB
TypeScript
Raw Normal View History

2022-05-10 03:17:01 -07:00
import React from 'react';
import { FormattedMessage } from 'react-intl';
2022-07-26 08:30:48 -07:00
import { Banner, Button, HStack, Stack, Text } from 'soapbox/components/ui';
2023-01-13 17:13:15 -08:00
import { useAppSelector, useInstance, useRegistrationStatus, useSoapboxConfig } from 'soapbox/hooks';
2022-05-10 03:17:01 -07:00
const CtaBanner = () => {
2022-11-26 08:38:16 -08:00
const instance = useInstance();
2023-01-13 17:13:15 -08:00
const { isOpen } = useRegistrationStatus();
const { displayCta } = useSoapboxConfig();
2022-05-10 03:17:01 -07:00
const me = useAppSelector((state) => state.me);
2023-01-13 17:13:15 -08:00
if (me || !displayCta || !isOpen) return null;
2022-05-10 03:17:01 -07:00
return (
2022-07-26 08:30:48 -07:00
<div data-testid='cta-banner' className='hidden lg:block'>
<Banner theme='frosted'>
<HStack alignItems='center' justifyContent='between'>
<Stack>
<Text theme='white' size='xl' weight='bold'>
2022-11-26 08:38:16 -08:00
<FormattedMessage id='signup_panel.title' defaultMessage='New to {site_title}?' values={{ site_title: instance.title }} />
2022-07-26 08:30:48 -07:00
</Text>
<Text theme='white' weight='medium' className='opacity-90'>
2022-07-26 11:22:13 -07:00
<FormattedMessage id='signup_panel.subtitle' defaultMessage="Sign up now to discuss what's happening." />
2022-07-26 08:30:48 -07:00
</Text>
</Stack>
<HStack space={2} alignItems='center'>
<Button theme='secondary' to='/login'>
<FormattedMessage id='account.login' defaultMessage='Log in' />
</Button>
<Button theme='accent' to='/signup'>
<FormattedMessage id='account.register' defaultMessage='Sign up' />
</Button>
2022-05-13 05:35:03 -07:00
</HStack>
2022-07-26 08:30:48 -07:00
</HStack>
</Banner>
2022-05-10 03:17:01 -07:00
</div>
);
};
export default CtaBanner;