Skip to content

Instantly share code, notes, and snippets.

@khusamov
Last active February 12, 2020 11:51
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 khusamov/5599baf14fc8d300dda0605d53acb1c0 to your computer and use it in GitHub Desktop.
Save khusamov/5599baf14fc8d300dda0605d53acb1c0 to your computer and use it in GitHub Desktop.
Способ пометки 'Не для печати' блоков Grid из material-ui.com
import React, {FunctionComponent} from 'react';
import makeStyles from '@material-ui/core/styles/makeStyles';
import cn from 'classnames';
const useNoPrintStyles = (
makeStyles({
root: {
'@media print': {
display: 'none'
}
}
}, {
name: 'NoPrint'
})
);
type DivProps = React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
/**
* Способ пометки 'Не для печати' блоков Grid из material-ui.com.
* @example <Grid item component={NoPrint}>
* @link https://gist.github.com/khusamov/5599baf14fc8d300dda0605d53acb1c0
*/
const NoPrint: FunctionComponent<DivProps> = (
({className, ...other}) => {
const css = useNoPrintStyles();
return <div className={cn(css.root, className)} {...other}/>;
}
);
export default NoPrint;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment