@material-ui/icons#CalendarTodayOutlined JavaScript Examples

The following examples show how to use @material-ui/icons#CalendarTodayOutlined. 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: TimeLog.js    From jobtriage with MIT License 5 votes vote down vote up
TimeLogItem = props => {
  const classes = useStyles();
  const {
    note, time, type, applicationId, id, onUpdate,
  } = props;
  const [openAddTimeLog, setOpenAddTimeLog] = useState(false);
  const dayJS = new DayJsAdapter();
  const formatedTime = dayJS.format(dayJS.date(time), 'MMM DD YYYY, hh:mm a');

  const handleDelete = () => {
    APIService.deleteTimeLog(applicationId, id).then(onUpdate);
  };

  const handleAddTimeLogOpen = () => {
    setOpenAddTimeLog(true);
  };

  const handleAddTimeLogClose = () => {
    setOpenAddTimeLog(false);
  };


  const FormatedNote = React.forwardRef((innerProps, ref) => (
    <div {...innerProps} ref={ref}>
      <Typography variant="body2">
        {note.length > 35 ? `${note.substring(0, 37)}...` : note}
      </Typography>
    </div>
  ));

  return (
    <Paper className={classes.timeLogItem} elevation={3}>
      <Typography variant="body2" style={{ width: '20%' }}>
        {formatedTime}
      </Typography>
      <Typography variant="body2" style={{ width: '10%' }}>
        {type.toUpperCase()}
      </Typography>
      <BootstrapTooltip title={note} style={{ width: '40%' }} arrow placement="top">
        <FormatedNote />
      </BootstrapTooltip>
      <div className={classes.displayFlex} style={{ justifyContent: 'space-between' }}>
        <a href={getCalenderLink(type, time, note)} label="Add to calender" target="_blank" rel="noopener noreferrer">
          <IconButton aria-label="Add to calender" component="span">
            <CalendarTodayOutlined />
          </IconButton>
        </a>
        <IconButton aria-label="Edit time log" component="span" onClick={handleAddTimeLogOpen}>
          <Edit color="primary" />
        </IconButton>
        <IconButton aria-label="Delete time log" component="span" onClick={handleDelete}>
          <Delete color="error" />
        </IconButton>
      </div>

      <TimeLogForm
        open={openAddTimeLog}
        onClose={handleAddTimeLogClose}
        onChange={onUpdate}
        applicationId={applicationId}
        timeLogId={id}
        time={time}
        note={note}
        type={type}
      />
    </Paper>
  );
}