@material-ui/core#Options TypeScript Examples

The following examples show how to use @material-ui/core#Options. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MediaQuery.tsx    From clearflask with Apache License 2.0 6 votes vote down vote up
withMediaQueries = <Queries extends string, Props>(
  queriesMapper: (props: Props) => Record<Queries, (string | ((theme: Theme) => string))>,
  options?: Options,
) => Component => props => {
  const mediaQueries = {};
  const queries = queriesMapper(props);
  Object.keys(queries).forEach(query => {
    mediaQueries[query] = useMediaQuery(queries[query], options)
  });
  return <Component {...props} mediaQueries={mediaQueries} />;
}
Example #2
Source File: MediaQuery.tsx    From clearflask with Apache License 2.0 5 votes vote down vote up
withMediaQuery = (
  query: string | ((theme: Theme) => string),
  options?: Options,
) => Component => props => {
  const mediaQuery = useMediaQuery(query, options);
  return <Component {...props} mediaQuery={mediaQuery} />;
}