surveybutton localization

This commit is contained in:
Jorge Escobar 2022-04-26 16:46:05 -04:00
parent b8c7faab36
commit 4d382e46d0

View file

@ -9,23 +9,20 @@ import J40MainGridContainer from '../J40MainGridContainer';
// @ts-ignore
import launchIcon from '/node_modules/uswds/dist/img/usa-icons/launch.svg';
export const onClickHandler = () => {
const intl = useIntl();
const href = intl.locale === 'es' ? 'https://www.surveymonkey.com/r/cejst-survey-es' : 'https://www.surveymonkey.com/r/cejst-survey';
export const onClickHandler = (href: string | undefined) => {
Object.assign(document.createElement('a'), {target: '_blank', href: href}).click();
};
const SurveyButton = () => {
const intl = useIntl();
const href = intl.locale === 'es' ? 'https://www.surveymonkey.com/r/cejst-survey-es' : 'https://www.surveymonkey.com/r/cejst-survey';
return (
<J40MainGridContainer className={styles.surveyButtonContainer}>
<Button
type='button'
className={styles.surveyButton}
onClick={() => onClickHandler()}>
onClick={() => onClickHandler(href)}>
{intl.formatMessage(CONTACT_COPY.PAGE_INTRO.SURVEY_TEXT)}
<img
className={styles.launchIcon}