-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2abcc62
commit 9fe2b67
Showing
11 changed files
with
300 additions
and
60 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 was deleted.
Oops, something went wrong.
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,10 @@ | ||
.card{ | ||
width:265px ; | ||
background-color: #F4F5F7 !important; | ||
height:75px ; | ||
margin-top:5px !important; | ||
margin-bottom:5px !important; | ||
color:black; | ||
|
||
|
||
} |
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,100 @@ | ||
import React, {Fragment} from 'react'; | ||
import Button from '@material-ui/core/Button'; | ||
import TextField from '@material-ui/core/TextField'; | ||
import Dialog from '@material-ui/core/Dialog'; | ||
import DialogActions from '@material-ui/core/DialogActions'; | ||
import DialogContent from '@material-ui/core/DialogContent'; | ||
import DialogContentText from '@material-ui/core/DialogContentText'; | ||
import DialogTitle from '@material-ui/core/DialogTitle'; | ||
import FormDialog from '../body/Dialog' | ||
import { TramRounded } from '@material-ui/icons'; | ||
import './CheckList.css' | ||
import CheckboxList from './checkBox' | ||
|
||
|
||
export default class CheckList extends React.Component { | ||
constructor(props) { | ||
super(props) | ||
|
||
this.state = { | ||
token:"374c221b4185e80027a402574dc071768d32336c175b07d821f47c7cdfbaecf2", | ||
key:"5c73e280ffee643ce764c6df16a719b5", | ||
open:false, | ||
id:this.props.checkId, | ||
data:[], | ||
|
||
} | ||
} | ||
async componentDidMount(){ | ||
console.log("component mounted") | ||
if(this.props.checkId!=0){ | ||
const res= fetch(`https://api.trello.com/1/checklist/${this.state.id}?key=${this.state.key}&token=${this.state.token}`) | ||
.then((res)=>res.json()).then((data1)=>{ | ||
this.setState({ | ||
data:data1.checkItems | ||
},()=>console.log("state data",this.state.data)) | ||
|
||
}) | ||
} | ||
} | ||
handleClickOpen = () => { | ||
this.setState({ | ||
open:true | ||
}) | ||
}; | ||
// FormatData = ()=>{ | ||
// let listArray=[] | ||
// if(this.state.data[0].length>0){ | ||
// for(let i in this.state.data.checkList[0]){ | ||
// listArray.push(this.props.checkList[0][i]) | ||
// } | ||
// return listArray | ||
// } | ||
// return 0 | ||
// } | ||
|
||
handleClose = () => { | ||
this.setState({ | ||
open:false | ||
}) | ||
|
||
}; | ||
handleSubmit = () => { | ||
this.setState({ | ||
open:false | ||
}) | ||
}; | ||
handleChange =(e)=>{ | ||
console.log(e.target.value) | ||
this.setState({ | ||
open:true | ||
}) | ||
} | ||
// check list items | ||
render(){ | ||
console.log("rendering") | ||
return ( | ||
<Fragment> | ||
<Button className="card" onClick={this.handleClickOpen}> | ||
{this.props.cardName} | ||
</Button> | ||
<Dialog open={this.state.open} onClose={this.handleClose} aria-labelledby="form-dialog-title"> | ||
<DialogTitle id="form-dialog-title">this.props.cardName</DialogTitle> | ||
<FormDialog></FormDialog> | ||
<DialogContent> | ||
<CheckboxList checkData={this.state.data}></CheckboxList> | ||
</DialogContent> | ||
<DialogActions> | ||
<Button onClick={this.handleClose} color="primary"> | ||
Cancel | ||
</Button> | ||
<Button color="primary"> | ||
submit | ||
</Button> | ||
</DialogActions> | ||
</Dialog> | ||
</Fragment> | ||
); | ||
} | ||
} | ||
|
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
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,77 @@ | ||
import React from 'react'; | ||
import { makeStyles } from '@material-ui/core/styles'; | ||
import List from '@material-ui/core/List'; | ||
import ListItem from '@material-ui/core/ListItem'; | ||
import ListItemIcon from '@material-ui/core/ListItemIcon'; | ||
import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction'; | ||
import ListItemText from '@material-ui/core/ListItemText'; | ||
import Checkbox from '@material-ui/core/Checkbox'; | ||
import IconButton from '@material-ui/core/IconButton'; | ||
import CommentIcon from '@material-ui/icons/Comment'; | ||
import { Button } from '@material-ui/core'; | ||
import FormDialog from '../body/Dialog' | ||
|
||
const useStyles = makeStyles((theme) => ({ | ||
root: { | ||
width: '100%', | ||
maxWidth: 360, | ||
backgroundColor: theme.palette.background.paper, | ||
}, | ||
})); | ||
export default function CheckboxList({checkList,name}) { | ||
const [checked, setChecked] = React.useState([0]); | ||
const [list, setList] = React.useState([]); | ||
const [id1, setId]= React.useState(0) | ||
let listArray=[] | ||
for(let i in checkList[0]){ | ||
listArray.push(checkList[0][i]) | ||
} | ||
setList([...listArray]) | ||
const classes = useStyles(); | ||
const handleSubmit=(name1)=>{ | ||
listArray.push({name:name1,id:id1+1}) | ||
setList([...listArray]) | ||
} | ||
|
||
const handleToggle = (value) => () => { | ||
const currentIndex = checked.indexOf(value); | ||
const newChecked = [...checked]; | ||
|
||
if (currentIndex === -1) { | ||
newChecked.push(value); | ||
} else { | ||
newChecked.splice(currentIndex, 1); | ||
} | ||
|
||
setChecked(newChecked); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<List className={classes.root}> | ||
{ | ||
list.map((value)=>{ | ||
const labelId = `checkbox-list-label-${value.id}`; | ||
console.log("data",value) | ||
return ( | ||
<ListItem key={value.id} role={undefined} dense button onClick={handleToggle(value.id)}> | ||
<ListItemIcon> | ||
<Checkbox | ||
edge="start" | ||
checked={checked.indexOf(value.id) !== -1} | ||
tabIndex={-1} | ||
disableRipple | ||
inputProps={{ 'aria-labelledby': labelId }} | ||
/> | ||
</ListItemIcon> | ||
<ListItemText id={value.id} primary={value.name} /> | ||
|
||
</ListItem> | ||
); | ||
})} | ||
|
||
</List> | ||
<FormDialog Stylename="checkList" title="Create New CheckList" submit={handleSubmit} label="Enter the task"></FormDialog> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.