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
// the hook also provides a style object for convenience | |
const { hideOutlineStyle } = useTabOutline(); | |
// the `style` prop is used here for easy manipulation | |
<div className="contact-form-checkbox" style={hideOutlineStyle} /> | |
// the object is always defined, so spreading is always safe | |
<div | |
style={{ | |
...hideOutlineStyle, |
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
// get the state from the hook | |
const { hideOutline } = useTabOutline(); | |
// in one case this was used in a render like so: | |
<span | |
className={classnames({ | |
highlighted, | |
checkmark: true, | |
'hide-outline': hideOutline, | |
})} |
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
import { useEffect, useState } from 'react'; | |
/** | |
* Workaround for outlines that flash or stick on click. | |
* | |
* In general, never globally disable the `outline` attribute for | |
* accessibility (a11y) reasons, but this can cause visual glitches | |
* when using a mouse. | |
* | |
* This hook provides two ways to automate hiding an element's outline |
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
exports.onPreRenderHTML = ({ getHeadComponents, replaceHeadComponents }) => { | |
const headComponents = getHeadComponents(); | |
// Show a blocking message on MSIE | |
// (documentMode is an IE-only property, versions 8-11) | |
// (dangerouslySetInnerHTML keeps the script string unescaped) | |
headComponents.push( | |
<script | |
key="block-msie" | |
type="text/javascript" |
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
<head> | |
<script type="text/javascript"> | |
// Show a blocking message on MSIE | |
// (documentMode is an IE-only property, versions 8-11) | |
if (typeof window !== 'undefined' && window.document.documentMode) { | |
window.onload = function () { | |
document.body.innerHTML = | |
'Internet Explorer is no longer supported.<br /><br />Please visit this site on Edge or Chrome.'; | |
document.body.style.cssText = | |
'text-align: center; padding-top: 40vh; font-family: Sans-Serif;'; |
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
// Deep-merges arrays without duplicate values | |
const mergeCustomizer = (objValue: any, srcValue: any) => { | |
if (Array.isArray(objValue) && Array.isArray(srcValue)) { | |
return uniqWith( | |
[...srcValue, ...objValue], | |
(a, b) => a === b || isEqual(a, b), | |
); | |
} | |
}; |
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
<AnimatedNode_ | |
animatedStyle='headerHeight' | |
> | |
<Animated.View .../> | |
</AnimatedNode_> |
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
<Conductor_ | |
animatedStyles={{ | |
headerHeight: this.headerHeightStyle, | |
}} | |
> | |
<YourComponent /> | |
</Conductor_> |