started highlight first wednesday

calendar-modal
Max 2023-09-21 15:48:50 -07:00
parent 733fba0ddd
commit 0920798e9e
4 changed files with 89 additions and 23 deletions

View File

@ -1,8 +1,8 @@
import React from 'react'
import React, {useState} from 'react'
import styled from '@emotion/styled'
import { Box, Container, Grid, Paper, Typography } from '@mui/material';
import { Box, Container, Grid, Paper, Typography, Badge } from '@mui/material';
import { grey } from '@mui/material/colors';
import { DateCalendar } from '@mui/x-date-pickers';
import { DateCalendar, PickersDay } from '@mui/x-date-pickers';
const SuiteAndBTCGraphic = (
<svg width="485" height="372" viewBox="0 0 485 372" fill="none" xmlns="http://www.w3.org/2000/svg">
@ -75,8 +75,45 @@ const CustomDiv = styled.div`
`;
const isFirstWednesday = (dateStr) => {
// console.log(JSON.stringify(dateStr))
let date = new Date(dateStr);
return date.getDay() === 3 && date.getDate() <= 7;
}
const ServerDay = (props) => {
const { highlightedDays = [], day, outsideCurrentMonth, ...other } = props;
const isSelected = !props.outsideCurrentMonth && isFirstWednesday(props.day.date());
return (
<Badge
key={props.day.toString()}
variant='dot'
color='secondary'
invisible={isSelected ? false : true}
overlap='circular'
>
<PickersDay {...other} outsideCurrentMonth={outsideCurrentMonth} day={day} />
</Badge>
);
}
/*
The goal of the calendar is to be able to click on dates and have a popup that shows our meetup details.
1. Perhaps the modal is actually seperate and is just passed the dates from a click event?
*** 2. We also want to have the only badge be on the first wednesday of each month
- onMonthChange has been added. Need to get this info to the day components to render badge
3. Also need to change colors
*/
const CalendarPage = () => {
const [highlightedDays, setHighlightedDays] = useState([11,20,9])
return (
<CustomDiv>
<Container>
@ -87,7 +124,17 @@ const CalendarPage = () => {
</Box>
<Box>
<Paper>
<DateCalendar />
<DateCalendar
slots={{
day: ServerDay
}}
onMonthChange={(month) => console.log(JSON.stringify(month))}
slotProps={{
day: {
highlightedDays
}
}}
/>
</Paper>
</Box>
<Box>

View File

@ -1,12 +1,13 @@
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import { Grid } from '@mui/material';
import { Container, Grid, Typography } from '@mui/material';
import React from 'react'
const CustomDiv = styled.div`
background-color: ${(props) => props.theme.palette.primary.main};
height: 140vh;
width: 100%
height: 1500px;
width: 100%;
display: flex;
`;
const CustomH1 = styled.h1`
@ -30,6 +31,8 @@ const CircleContainer = styled.div`
justify-content: center;
align-items: center;
font-size: 24px; /* Replace with your desired font size */
border-style: solid;
border-color: purple;
`;
const HorizontalLine = styled.div`
@ -40,21 +43,31 @@ const HorizontalLine = styled.div`
function MainPage() {
return (
<CustomDiv style={{display: 'flex'}}>
<Grid container justifyContent="center" alignItems="center" spacing={5}>
<Grid item xs={4}>
<CustomH1>Empowerment for those who need it most</CustomH1>
<HorizontalLine />
<CustomH3>Bitcoin is a grassroots technology for communities to build lasting wealth</CustomH3>
<CustomDiv>
<Container style={{borderStyle: 'solid', borderColor: 'orange'}}>
<Grid style={{borderStyle: 'solid', borderColor: 'red'}} container marginTop={20} justifyContent='center' spacing={2}>
<Grid item sm={4} xs={12} style={{borderStyle: 'solid', borderColor: 'green'}}>
<Grid container direction="column" style={{borderStyle: 'solid', borderColor: 'blue'}}>
<Grid item>
<Typography align='center' variant='h2'>Empowerment for those who need it most</Typography>
</Grid>
<Grid item xs={4}>
<Grid item>
<HorizontalLine />
</Grid>
<Grid item>
<Typography align='center' variant='h5'>Bitcoin is a grassroots technology for communities to build lasting wealth</Typography>
</Grid>
</Grid>
</Grid>
<Grid item sm={4} xs={12} style={{borderStyle: 'solid', borderColor: 'yellow'}}>
<CircleContainer>
<svg xmlns="http://www.w3.org/2000/svg" width="96" height="147" viewBox="0 0 192 295" fill="none">
<path d="M15.25 59.25H132.917C144.619 59.25 155.843 63.8989 164.118 72.1739C172.393 80.449 177.042 91.6723 177.042 103.375C177.042 115.078 172.393 126.301 164.118 134.576C155.843 142.851 144.619 147.5 132.917 147.5M132.917 147.5C144.619 147.5 155.843 152.149 164.118 160.424C172.393 168.699 177.042 179.922 177.042 191.625C177.042 203.328 172.393 214.551 164.118 222.826C155.843 231.101 144.619 235.75 132.917 235.75H15.25M132.917 147.5H44.6667M44.6667 59.25V235.75M59.375 15.125V59.25M118.208 15.125V59.25M59.375 235.75V279.875M118.208 235.75V279.875" stroke="#FAE84E" stroke-width="29.4167" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</CircleContainer>
</Grid>/
</Grid>
</Grid>
</Container>
</CustomDiv>
);
}

View File

@ -20,10 +20,16 @@ const WheelSpinPage = () => {
const [openSpinResult, setOpenSpinResult] = useState(false);
const [winningIndex, setWinningIndex] = useState(0);
const [emailValue, setEmailValue] = useState("");
const wheelRef = useRef();
const handleTextChange = (event) => {
setEmailValue(event.target.value);
}
const submitHandler = () => {
setEmailValue("");
wheelRef.current.spin(1000);
}
@ -80,7 +86,7 @@ const WheelSpinPage = () => {
<Grid container justifyContent="center" alignItems="center" spacing={3}>
<Grid item xs={6}>
<h1>Join our mailing list to spin the wheel for a chance to win BTC!</h1>
<TextField /><Button variant="contained" color="secondary" onClick={submitHandler}>Submit and Spin!</Button>
<TextField value={emailValue} onChange={handleTextChange}/><Button variant="contained" color="secondary" onClick={submitHandler}>Submit and Spin!</Button>
</Grid>
<Grid item xs={6}>
<Grid container justifyContent="center">

View File

@ -42,7 +42,7 @@ const Home = () => {
<PerksPage />
<WheelSpinPage />
<CalendarPage />
<GraphPage />
{/* <GraphPage /> */}
<BottomBar />
</div>
</LocalizationProvider>