@material-ui/styles#createStyles JavaScript Examples

The following examples show how to use @material-ui/styles#createStyles. 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: AddMedicine.js    From DMS_React with GNU Affero General Public License v3.0 6 votes vote down vote up
useStyles = makeStyles((theme= Theme) =>
    createStyles({
        
        wrapper: {
            margin: theme.spacing.unit,
            position: 'relative',
        },
        buttonSuccess: {
            backgroundColor: green[500],
            color: grey[50],
            '&:hover': {
                backgroundColor: green[700],
            },
        },
        buttonProgress: {
            color: green[500],
            position: 'absolute',
            top: '50%',
            left: '50%',
            marginTop: -12,
            marginLeft: -12,
        },
    }))
Example #2
Source File: style.js    From wiki with GNU General Public License v3.0 6 votes vote down vote up
useStyles = makeStyles(({ breakpoints }) =>
  createStyles({
    drawer: {
      [breakpoints.up('sm')]: {
        width: drawerWidth,
        flexShrink: 0,
      },
    },
    drawerPaper: {
      width: drawerWidth,
    },
    drawerContainer: {
      overflow: 'auto',
    }
  }),
)
Example #3
Source File: style.js    From wiki with GNU General Public License v3.0 6 votes vote down vote up
useStyles = makeStyles(({ spacing, mixins }) =>
  createStyles({
    content: {
      flexGrow: 1,
      padding: spacing(3),
    },
    // necessary for content to be below app bar
    toolbar: mixins.toolbar,
  }),
)
Example #4
Source File: style.js    From wiki with GNU General Public License v3.0 6 votes vote down vote up
useStyles = makeStyles(({ spacing, zIndex, palette }) =>
  createStyles({
    appbar: {
      backgroundColor: "white",
      zIndex: zIndex.drawer + 1,
    },
    menuButton: {
      marginRight: spacing(2),
    },
    title: {
      flexGrow: 1,
    },
    phoneHidden: {
      flexGrow: 1,
    },
    flowButton: {
      marginLeft: spacing(-2),
      color: "#ef476f"
    },
    titleLink: {
      textDecoration: 'none',
      "&:visited":{
        color: palette.primary.main,
      },
      "&:hover": {
        color: "green"
      }
    },
    hide: {
      display: 'none',
    },
  }),
)
Example #5
Source File: BaseOptionChart.js    From course-manager with MIT License 5 votes vote down vote up
useStyles = makeStyles((theme) =>
  createStyles({
    '@global': {
      // Tooltip
      '.apexcharts-tooltip,.apexcharts-xaxistooltip': {
        border: '0 !important',
        boxShadow: `${theme.customShadows.z24} !important`,
        color: `${theme.palette.text.primary} !important`,
        borderRadius: `${theme.shape.borderRadiusSm}px !important`,
        backgroundColor: `${theme.palette.background.default} !important`
      },
      '.apexcharts-tooltip-title': {
        border: '0 !important',
        fontWeight: theme.typography.fontWeightBold,
        backgroundColor: `${theme.palette.grey[500_16]} !important`,
        color: theme.palette.text.secondary
      },
      '.apexcharts-xaxistooltip-bottom': {
        '&:before': {
          borderBottomColor: 'transparent !important'
        },
        '&:after': {
          borderBottomColor: `${theme.palette.background.paper} !important`
        }
      },

      // Legend
      '.apexcharts-legend': {
        padding: '0 !important'
      },
      '.apexcharts-legend-series': {
        alignItems: 'center',
        display: 'flex !important'
      },
      '.apexcharts-legend-marker': {
        marginTop: '-2px !important',
        marginRight: '8px !important'
      },
      '.apexcharts-legend-text': {
        lineHeight: '18px',
        textTransform: 'capitalize'
      }
    }
  })
)
Example #6
Source File: style.js    From wiki with GNU General Public License v3.0 5 votes vote down vote up
useStyles = makeStyles(({ palette, breakpoints, mixins }) =>
    createStyles({
        sidebarBase: {
            display: "inline-box",
            textDecoration: "none",
            color: "black",
            width: "100%",
        },
        sidebarSectionNormal: {
            fontSize: "1.5em",
            fontWeight: "bold",
        },
        sidebarSectionHighlight: {
            fontSize: "1.5em",
            fontWeight: "bold",
            color: palette.primary.main,
            borderLeft: "0.25rem solid"
        },
        sidebarItemNormal: {
            fontSize: "1.2em",
        },
        sidebarItemHighlight: {
            fontSize: "1.2em",
            color: palette.primary.main,
            borderLeft: "0.25rem solid"
        },

        drawer: {
            [breakpoints.up('sm')]: {
                width: drawerWidth,
                flexShrink: 0,
            },
            width: drawerWidth,
            flexShrink: 0,
        },
        drawerContainer: {
            overflow: 'auto',
        },
        toolbar: mixins.toolbar,
        titleLink: {
            textDecoration: 'none',
            "&:visited": {
                color: palette.primary.main,
            },
            "&:hover": {
                color: "green"
            }
        }

    }),
)
Example #7
Source File: style.js    From wiki with GNU General Public License v3.0 5 votes vote down vote up
useStyles = makeStyles(() =>
  createStyles({
    root: {
      display: "flex",
    }
  }),
)
Example #8
Source File: AddMedicine.js    From DMS_React with GNU Affero General Public License v3.0 4 votes vote down vote up
AddMedicine = props => {

console.log("addMedicine", Theme, createStyles())
    const [name, setName] = useState('');
    const [type, setType] = useState('');
    const [quantity, setQuanity] = useState(0);
    const [selectedDate, setDate] = useState(null);
    const [loading, setLoading] = useState(false);
    const [success, setSuccess] = useState(false);
    const dispatch = useDispatch();

    const classes = useStyles();
    const handleChange = key => event => {
        // console.log(key, event);
        switch (key) {
            case 'name':
                setName(event.target.value);
                break;
            case 'type':
                setType(event.target.value);
                break;
            case 'quantity':
                setQuanity(event.target.value);
                break;
            case 'selectedDate':
                setDate(event);
                break;
            default:
                return;
        }
    };

    const addMedicine = async () => {
        setLoading(true);
        await dispatch(actions.addMedicine({ name, type, quantity, selectedDate }))
        setLoading(false);
        props.history.push('/app/ims/medicinelist');
    }

    const buttonClassname = classNames({
        [classes.buttonSuccess]: success,
    });

    return (
        // <div >
        <div className="login-content mt-5">
            <Grid container>
            <Grid item xs={2} justify="flex-start" alignItems="center" container>
                <Link to='/app/ims/medicinelist' style={{ textDecoration: 'none', color: 'white' }}>
                    <IconButton type="submit" aria-label="search">
                        <ArrowBackIcon />
                    </IconButton>
                </Link>
            </Grid>
            <Grid item xs={6} justify="flex-start" alignItems="center" container>
                <Typography variant="h5">Add Medicine</Typography>
            </Grid>
            </Grid>

            <MuiPickersUtilsProvider utils={DateFnsUtils}>
                <div className="login-form">
                    <div style={{padding: '30px'}}>
                    <form className="row" noValidate autoComplete="off">
                        {/* <div className="col-md-3 col-12"> */}
                        <fieldset>
                            <TextField
                                id="name"
                                label={<IntlMessages id="appModule.medicine.name" />}
                                value={name}
                                onChange={handleChange('name')}
                                data-test="textComp"
                                margin="normal"
                                fullWidth
                                className="mt-1"
                            />
                            <FormControl className="w-100 mb-2">
                                <InputLabel htmlFor="age-native-simple">Type</InputLabel>
                                <Select
                                    native
                                    value={type}
                                    data-test="selectComp"
                                    onChange={handleChange('type')}
                                    input={<Input id="age-native-simple" />}

                                >
                                    <option value="" />
                                    <option value={10}>Liquid</option>
                                    <option value={20}>Tablets</option>
                                    <option value={30}>Capsules</option>
                                    <option value={40}>Topical</option>
                                    <option value={50}>Suppositories</option>
                                    <option value={60}>Drops</option>
                                    <option value={70}>Inhalers</option>
                                    <option value={80}>Injections</option>
                                    <option value={90}>Patches</option>
                                </Select>
                            </FormControl>
                            <TextField
                                id="quantity"
                                label="Quantity"
                                value={quantity}
                                type="number"
                                data-test="quantityComp"
                                onChange={handleChange('quantity')}
                                margin="normal"
                                fullWidth
                                className="mt-1"
                            />
                            <FormControl className="w-100 mb-2">
                                <DatePicker
                                    label="Expiry Date"
                                    value={selectedDate}
                                    onChange={handleChange('selectedDate')}
                                    animateYearScrolling={false}
                                    data-test="dateComp"
                                    className="mt-1"
                                />
                            </FormControl>
                            <div className={classes.wrapper}>
                                <Button onClick={addMedicine} data-test="addMedicineComp" disabled={loading} color="primary" variant="contained" className={buttonClassname}>
                                    <IntlMessages id="appModule.addItem" />
                                    {loading && <CircularProgress size={24} className={classes.buttonProgress} />}
                                </Button>
                            </div>

                        </fieldset>
                        
                    </form>
                    </div>
                </div>
            </MuiPickersUtilsProvider>
        </div>
        // </div>
    )
}