Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calendar #33

Open
elicharlese opened this issue Feb 6, 2023 · 0 comments
Open

Calendar #33

elicharlese opened this issue Feb 6, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@elicharlese
Copy link
Member

elicharlese commented Feb 6, 2023

import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import { Paper, Typography } from '@material-ui/core';
import { Calendar, momentLocalizer } from 'react-big-calendar';
import moment from 'moment';
import 'react-big-calendar/lib/css/react-big-calendar.css';

const localizer = momentLocalizer(moment);

const useStyles = makeStyles((theme) => ({
  root: {
    width: '100%',
  },
  paper: {
    padding: theme.spacing(2),
  },
}));

const events = [
  {
    title: 'Project kickoff meeting',
    start: new Date(2023, 1, 20, 9, 0),
    end: new Date(2023, 1, 20, 11, 0),
  },
  {
    title: 'Development sprint 1',
    start: new Date(2023, 1, 27, 9, 0),
    end: new Date(2023, 2, 3, 17, 0),
  },
  {
    title: 'QA testing',
    start: new Date(2023, 2, 4, 10, 0),
    end: new Date(2023, 2, 8, 17, 0),
  },
  {
    title: 'Deployment',
    start: new Date(2023, 2, 9, 9, 0),
    end: new Date(2023, 2, 9, 12, 0),
  },
];

const CalendarComponent = () => {
  const classes = useStyles();

  return (
    <div className={classes.root}>
      <Paper className={classes.paper}>
        <Typography variant="h6" gutterBottom>
          Project Calendar
        </Typography>
        <Calendar
          localizer={localizer}
          events={events}
          startAccessor="start"
          endAccessor="end"
          style={{ height: 500 }}
        />
      </Paper>
    </div>
  );
};

export default CalendarComponent;

In this example, we are using the react-big-calendar library to display a calendar component. We are passing the calendar events as a prop and using Material-UI's Paper component to wrap the calendar. We also added a Typography component to give the calendar a title.

@elicharlese elicharlese added the bug Something isn't working label Feb 6, 2023
@elicharlese elicharlese added this to the Front-End base for all dapps in Framer milestone Feb 6, 2023
@elicharlese elicharlese self-assigned this Feb 6, 2023
@elicharlese elicharlese removed this from the Front-End base for all dapps in Framer milestone Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant