@eccenca/gui-elements
Version:
GUI elements based on other libraries, usable in React application, written in Typescript.
37 lines (36 loc) • 1.1 kB
TypeScript
import React from "react";
type media = "print" | "screen";
interface ApplicationViewabilityShow {
/**
* Show on media type.
* If used, `hide` cannot be set.
*/
show: media;
hide?: never;
}
interface ApplicationViewabilityHide {
/**
* Hide on media type.
* If used, `show` cannot be set.
*/
hide: media;
show?: never;
}
interface ApplicationViewabilityUndecided {
/**
* Only one child allowed.
* Need to process the `className` property.
*/
children: React.ReactElement<{
className?: string;
}>;
}
export type ApplicationViewabilityProps = ApplicationViewabilityUndecided & (ApplicationViewabilityShow | ApplicationViewabilityHide);
/**
* Sets the viewability of the the contained element regarding media.
* Can be used to hide elements, e.g. when the page is printed.
*/
export declare const ApplicationViewability: ({ children, show, hide }: ApplicationViewabilityProps) => React.ReactElement<{
className?: string;
}, string | React.JSXElementConstructor<any>>;
export default ApplicationViewability;