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

To help you get started, we’ve selected a few @material-ui/core 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 kubeflow-kale / kale / labextension / src / widgets / KatibDialog.tsx View on Github external
export const KatibDialog: React.FunctionComponent = props => {
  const [loading, setLoading] = React.useState(true);
  const [error, setError] = React.useState('');
  const [pipelineParameters, setPipelineParameters] = React.useState([]);
  const [pipelineMetrics, setPipelineMetrics] = React.useState([]);

  const theme = useTheme();

  React.useEffect(() => {
    // this is called when `open` changes value.
    // We are interested in the case when `open` becomes true.
    if (props.open) {
      // send RPC to retrieve current pipeline parameters and
      // update the state
      onKatibShowPanel();
    }
  }, [props.open]);

  const onKatibShowPanel = async () => {
    // Send an RPC to Kale to get the pipeline parameters
    // that are currently defined in the notebook
    const nbFilePath = props.activeNotebook.context.path;
    const args = { source_notebook_path: nbFilePath };
github mui-org / material-ui / docs / src / modules / components / AppSearch.js View on Github external
export default function AppSearch() {
  const classes = useStyles();
  const inputRef = React.useRef(null);
  const theme = useTheme();
  const userLanguage = useSelector(state => state.options.userLanguage);

  React.useEffect(() => {
    const styleNode = loadCSS(
      'https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.css',
      document.querySelector('#app-search'),
    );

    return () => {
      styleNode.parentElement.removeChild(styleNode);
    };
  }, []);

  React.useEffect(() => {
    const handleKeyDown = event => {
      // Use event.keyCode to support IE 11
github msdslab / automated-systematic-review / asreview / webapp / src / Components / DecisionUndoBar.js View on Github external
const DecisionUndoBar = (props) => {
  const theme = useTheme();
  const classes = useStyles(theme);

    const handleClose = (event, reason) => {
      props.close()
    };
  
    const handleUndo = (event, reason) => {
       props.undo()
    };

    let anchorOrigin = {
      vertical: 'bottom',
      horizontal: 'left',
    }

    return (
github Maxvien / next-shopify-storefront / components / Home / Home.tsx View on Github external
function Home() {
  const theme = useTheme();
  const classes = useStyles(theme);

  return (
    <section>
      <h1>Next Shopify Storefront</h1>
      <p>
        A Shopping Cart built with TypeScript, NextJS, React, Redux, Apollo Client, Shopify Storefront GraphQL API, ...
        and Material UI.
      </p>
      <button color="primary"> utilities.link({ path: '/products' })}
      &gt;
        Browse Products</button></section>
github siriwatknp / mui-treasury / packages / mui-layout / src / components / internal / SharedSidebar.js View on Github external
const SharedSidebar = ({
  children,
  PaperProps,
  SlideProps,
  ModalProps,
  useSidebarConfig,
  ...props
}) =&gt; {
  const { iBody } = useWindow();
  const theme = useTheme();
  const parsedCtx = useSidebarConfig();
  const height = useHeightAdjustment(parsedCtx);
  useAutoCollapse(parsedCtx);
  const [entered, setEntered] = React.useState(false);
  const styles = useSidebarStyles();
  const transition = useTransitionStyles();
  const { sidebar, opened, setOpened, getSidebarZIndex } = parsedCtx;
  const { getWidth } = createEdgeSidebar(parsedCtx);
  const isPermanent = sidebar.variant === 'permanent';
  return (
     {
        setOpened(false);
      }}
github kalmhq / kalm / src / widgets / Sidenav / index.tsx View on Github external
paddingRight: 24
        }
      },
      listItemIcon: {
        color: "white"
      },
      open: {
        backgroundColor: "#282c36",
        "&amp;:hover": {
          backgroundColor: "#282c36"
        }
      }
    };
  });

  const theme = useTheme();
  const classes = useStyles(theme);
  const [open, setOpen] = React.useState(false);

  const handleClick = () =&gt; {
    setOpen(!open);
  };

  return (
    &lt;&gt;
github sjdonado / quevent / client / src / pages / Events / EventDetails / ConfirmationDialog / ConfirmationDialog.jsx View on Github external
export default function ConfirmationDialog({ openDialog, handleCloseDialog, dialogType }) {
  const theme = useTheme();
  const fullScreen = useMediaQuery(theme.breakpoints.down('xs'));

  if (!dialogType) return null;
  return (
    <div>
      <dialog aria-labelledby="responsive-dialog-title" open="{openDialog}">
        
          {mapTypeToDialogContent[dialogType].title}
        
        
          </dialog></div>
github CodeForPhilly / prevention-point / frontend / src / layouts / MainLayout.js View on Github external
const PersistentDrawerLeft = props =&gt; {
  const classes = useStyles()
  const theme = useTheme()
  const [open, setOpen] = React.useState(false)

  const ToolbarWrapper = withRouter(({ history }) =&gt;
    history.location.pathname.match(/login/) ? null : (
github mui-org / material-ui / docs / src / pages / components / drawers / ResponsiveDrawer.tsx View on Github external
export default function ResponsiveDrawer(props: ResponsiveDrawerProps) {
  const { container } = props;
  const classes = useStyles();
  const theme = useTheme();
  const [mobileOpen, setMobileOpen] = React.useState(false);

  const handleDrawerToggle = () =&gt; {
    setMobileOpen(!mobileOpen);
  };

  const drawer = (
    <div>
      <div>
      
      
        {['Inbox', 'Starred', 'Send email', 'Drafts'].map((text, index) =&gt; (
          
            {index % 2 === 0 ?  : }
            
          </div></div>
github mui-org / material-ui / docs / src / pages / components / steppers / SwipeableTextMobileStepper.js View on Github external
function SwipeableTextMobileStepper() {
  const classes = useStyles();
  const theme = useTheme();
  const [activeStep, setActiveStep] = React.useState(0);
  const maxSteps = tutorialSteps.length;

  const handleNext = () => {
    setActiveStep(prevActiveStep => prevActiveStep + 1);
  };

  const handleBack = () => {
    setActiveStep(prevActiveStep => prevActiveStep - 1);
  };

  const handleStepChange = step => {
    setActiveStep(step);
  };

  return (