Created
April 9, 2019 21:52
-
-
Save rosskevin/6d5229c2e3bc3942f196cdff805dc491 to your computer and use it in GitHub Desktop.
jss material-ui hide intercom chat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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