Skip to content

Instantly share code, notes, and snippets.

@rosskevin
Created April 9, 2019 21:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rosskevin/6d5229c2e3bc3942f196cdff805dc491 to your computer and use it in GitHub Desktop.
Save rosskevin/6d5229c2e3bc3942f196cdff805dc491 to your computer and use it in GitHub Desktop.
jss material-ui hide intercom chat
// tslint:disable:object-literal-sort-keys
import { create, StyleSheet } from 'jss'
import { jssPreset } from '@material-ui/core'
const jss = create(jssPreset())
const log = Logger.get('Intercom')
let invisibleSheet: undefined | StyleSheet<string>
export function intercomInvisible() {
if (!invisibleSheet) {
invisibleSheet = jss
.createStyleSheet({
'@global': {
'.intercom-app': {
visibility: 'hidden',
},
},
} as any) // doesn't like the .intercom-app
.attach()
log.debug('attached sheet')
}
}
export function intercomVisible() {
if (invisibleSheet) {
invisibleSheet.detach()
invisibleSheet = undefined
log.debug('detached sheet', invisibleSheet)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment