Skip to content

Instantly share code, notes, and snippets.

@matheusps
Created October 5, 2022 18:28
Show Gist options
  • Select an option

  • Save matheusps/36b515928e9ff2069814ce2e4cd988b4 to your computer and use it in GitHub Desktop.

Select an option

Save matheusps/36b515928e9ff2069814ce2e4cd988b4 to your computer and use it in GitHub Desktop.
// Integration APP - IO
import { useIframeState, Iframe } from '@vtex/raccoon-io'
const [size, setSize] = useState('250px')
const iframe = useIframeState({
asyncHandlers: {
resize: (data: any) => {
setSize(data.size)
}
}
})
/* button to reduce the navigation */
// post message to the iframe
<Iframe style={{ width: size }} state={iframe} />
// App Next
import { publishMessage } from '@vtex/raccoon-next'
publishMessage({
type: 'resize',
data: {
size: '500px'
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment