-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add remove button for schedule and neaten up a bit
- Loading branch information
1 parent
3b6fdde
commit ed1a6fd
Showing
7 changed files
with
98 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,22 @@ | ||
import Box from '@material-ui/core/Box'; | ||
import React from 'react'; | ||
import Box from '@material-ui/core/Box'; | ||
import { Tab } from '../../types'; | ||
import AdvancedTabForm from './AdvancedTabForm'; | ||
|
||
type PropsType = { | ||
tabs: Tab[]; | ||
}; | ||
|
||
const TabList = ({ tabs }: PropsType) => ( | ||
<> | ||
{tabs.map((tab) => ( | ||
<Box key={`tab-${tab.id}`}> | ||
<AdvancedTabForm tab={tab} /> | ||
</Box> | ||
))} | ||
</> | ||
); | ||
const TabList = ({ tabs }: PropsType) => { | ||
return ( | ||
<> | ||
{tabs.map((tab) => ( | ||
<Box key={`tab-${tab.id}`}> | ||
<AdvancedTabForm tab={tab} /> | ||
</Box> | ||
))} | ||
</> | ||
); | ||
}; | ||
|
||
export default TabList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from 'react'; | ||
import { Schedule } from '../../types'; | ||
import IconButton from '@material-ui/core/IconButton'; | ||
import { removeSchedule } from '../../store/scheduleSlice'; | ||
import { useDispatch } from 'react-redux'; | ||
import RemoveCircleOutlineIcon from '@material-ui/icons/RemoveCircleOutline'; | ||
|
||
type PropsType = { | ||
schedule: Schedule; | ||
}; | ||
|
||
const RemoveScheduleButon = ({ schedule }: PropsType) => { | ||
const dispatch = useDispatch(); | ||
const handleRemove = () => { | ||
dispatch(removeSchedule(schedule.id)); | ||
}; | ||
|
||
return ( | ||
<IconButton aria-label="Remove Schedule" onClick={handleRemove}> | ||
<RemoveCircleOutlineIcon /> | ||
</IconButton> | ||
); | ||
}; | ||
|
||
export default RemoveScheduleButon; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,40 @@ | ||
import Box from '@material-ui/core/Box'; | ||
import React from 'react'; | ||
import Box from '@material-ui/core/Box'; | ||
import { Schedule } from '../../types'; | ||
import ScheduleForm from './ScheduleForm'; | ||
import { | ||
createStyles, | ||
makeStyles, | ||
Theme, | ||
} from '@material-ui/core/styles'; | ||
|
||
type PropsType = { | ||
schedules: Schedule[]; | ||
}; | ||
|
||
const ScheduleList = ({ schedules }: PropsType) => ( | ||
<> | ||
{schedules.map((schedule) => ( | ||
<Box key={`schedule-${schedule.id}`}> | ||
<ScheduleForm schedule={schedule} /> | ||
</Box> | ||
))} | ||
</> | ||
const useStyles = makeStyles((theme: Theme) => | ||
createStyles({ | ||
scheduleListItem: { | ||
marginTop: theme.spacing(1), | ||
marginBottom: theme.spacing(1), | ||
}, | ||
}), | ||
); | ||
|
||
const ScheduleList = ({ schedules }: PropsType) => { | ||
const classes = useStyles(); | ||
return ( | ||
<> | ||
{schedules.map((schedule) => ( | ||
<Box | ||
className={classes.scheduleListItem} | ||
key={`schedule-${schedule.id}`} | ||
> | ||
<ScheduleForm schedule={schedule} /> | ||
</Box> | ||
))} | ||
</> | ||
); | ||
}; | ||
|
||
export default ScheduleList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters