How to use the @material-ui/styles.getThemeProps function in @material-ui/styles

To help you get started, we’ve selected a few @material-ui/styles examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mui-org / material-ui / packages / material-ui-styles / src / index.spec.tsx View on Github external
function testGetThemeProps(theme: Theme, props: AppBarProps): void {
  const overriddenProps: AppBarProps = getThemeProps({ name: 'MuiAppBar', props, theme });

  // AvatarProps not assignable to AppBarProps
  // $ExpectError
  const wronglyNamedProps: AppBarProps = getThemeProps({
    name: 'MuiAvatar',
    props,
    theme,
  });
}
github mui-org / material-ui / packages / material-ui-styles / src / index.spec.tsx View on Github external
function testGetThemeProps(theme: Theme, props: AppBarProps): void {
  const overriddenProps: AppBarProps = getThemeProps({ name: 'MuiAppBar', props, theme });

  // AvatarProps not assignable to AppBarProps
  // $ExpectError
  const wronglyNamedProps: AppBarProps = getThemeProps({
    name: 'MuiAvatar',
    props,
    theme,
  });
}
github siriwatknp / mui-treasury / packages / mui-layout / src / hooks / useMediaQuery.js View on Github external
function useMediaQuery(queryInput, options = {}) {
  const theme = useTheme();
  const { iWindow } = useWindow();

  const props = getThemeProps({
    theme,
    name: 'MuiUseMediaQuery',
    props: {},
  });

  if (process.env.NODE_ENV !== 'production') {
    if (typeof queryInput === 'function' && theme === null) {
      console.error(
        [
          'Material-UI: the `query` argument provided is invalid.',
          'You are providing a function without a theme in the context.',
          'One of the parent elements needs to use a ThemeProvider.',
        ].join('\n')
      );
    }
  }
github mui-org / material-ui / packages / material-ui / src / useMediaQuery / useMediaQuery.js View on Github external
function useMediaQuery(queryInput, options = {}) {
  const theme = useTheme();
  const props = getThemeProps({
    theme,
    name: 'MuiUseMediaQuery',
    props: {},
  });

  if (process.env.NODE_ENV !== 'production') {
    if (typeof queryInput === 'function' && theme === null) {
      console.error(
        [
          'Material-UI: the `query` argument provided is invalid.',
          'You are providing a function without a theme in the context.',
          'One of the parent elements needs to use a ThemeProvider.',
        ].join('\n'),
      );
    }
  }
github marmelab / react-admin / packages / ra-ui-materialui / src / layout / useMediaQuery.ts View on Github external
function useMediaQuery(query: (theme: Theme) => string, options) {
    const theme = useTheme() as Theme;
    const props = getThemeProps({
        theme,
        name: 'MuiUseMediaQuery',
        props: {},
    });

    return useMuiMediaQuery(theme ? query(theme) : '', {
        ...props,
        ...options,
    });
}
github mui-org / material-ui / packages / material-ui / src / Modal / Modal.js View on Github external
const Modal = React.forwardRef(function Modal(inProps, ref) {
  const theme = useTheme();
  const props = getThemeProps({ name: 'MuiModal', props: { ...inProps }, theme });
  const {
    BackdropComponent = SimpleBackdrop,
    BackdropProps,
    children,
    closeAfterTransition = false,
    container,
    disableAutoFocus = false,
    disableBackdropClick = false,
    disableEnforceFocus = false,
    disableEscapeKeyDown = false,
    disablePortal = false,
    disableRestoreFocus = false,
    disableScrollLock = false,
    hideBackdrop = false,
    keepMounted = false,
    manager = defaultManager,