import React, { useRef, useState } from 'react'; import { Container, Disclaimer, TextContainer } from './styles'; interface AttributesProps { disclaimer_text: string; toggle_active_text: string; toggle_inactive_text: string; disclaimer_full_text: string; } interface RootProps { attributes: AttributesProps; } export const AffiliateLinkDisclaimer: React.FC = props => { const attributes = props.attributes; const [open, setOpen] = useState(false); const ref = useRef(null); const getHeight = (): string => { return ref.current ? `${ref.current.getBoundingClientRect().height}px` : '0px'; }; return (

{decodeURIComponent(attributes.disclaimer_text)}

{ e.preventDefault(); setOpen(!open); }} > {open ? decodeURIComponent(attributes.toggle_active_text) : decodeURIComponent(attributes.toggle_inactive_text)}

{decodeURIComponent(attributes.disclaimer_full_text)}

); };