// @flow import React from 'react'; import type { Node } from 'react'; import HiddenJs from './HiddenJs'; import HiddenCss from './HiddenCss'; import type { Breakpoint } from '../styles/createBreakpoints'; export type Props = { /** * The content of the component. */ children: Node, /** * @ignore */ className?: string, /** * Hide the given breakpoint(s). */ only?: Breakpoint | Array, /** * If true, screens this size and up will be hidden. */ xsUp?: boolean, /** * If true, screens this size and up will be hidden. */ smUp?: boolean, /** * If true, screens this size and up will be hidden. */ mdUp?: boolean, /** * If true, screens this size and up will be hidden. */ lgUp?: boolean, /** * If true, screens this size and up will be hidden. */ xlUp?: boolean, /** * If true, screens this size and down will be hidden. */ xsDown?: boolean, /** * If true, screens this size and down will be hidden. */ smDown?: boolean, /** * If true, screens this size and down will be hidden. */ mdDown?: boolean, /** * If true, screens this size and down will be hidden. */ lgDown?: boolean, /** * If true, screens this size and down will be hidden. */ xlDown?: boolean, /** * Specify which implementation to use. 'js' is the default, 'css' works better for server * side rendering. */ implementation?: 'js' | 'css', /** * You can use this property when choosing the `js` implementation with server side rendering. * * As `window.innerWidth` is unavailable on the server, * we default to rendering an empty componenent during the first mount. * In some situation you might want to use an heristic to approximate * the screen width of the client browser screen width. * * For instance, you could be using the user-agent or the client-hints. * http://caniuse.com/#search=client%20hint */ initialWidth?: number, }; /** * Responsively hides children based on the selected implementation. */ function Hidden(props: Props) { const { implementation, ...other } = props; if (implementation === 'js') { return ; } return ; } Hidden.defaultProps = { implementation: 'js', xsUp: false, smUp: false, mdUp: false, lgUp: false, xlUp: false, xsDown: false, smDown: false, mdDown: false, lgDown: false, xlDown: false, }; export default Hidden;