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

Heidi newboard-newcardform #2

Merged
merged 1 commit into from
Jun 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,21 @@ function App() {
<main>
<section className='new-board-form__container'>
<h2>Create a New Board</h2>
{/* < NewBoardForm /> */}
{/* < NewBoardForm
addBoardCallBack={ newBoardData }
/> */}
</section>
<section className='boards__container'>
<h2>Choose A Board</h2>
< BoardList
boardsData= { boardsData }
/>
<h2>Choose A Board</h2>
<div>
< BoardList
boardsData= { boardsData }
/>
</div>
</section>
{/* <section>
<section>
< CardList />
</section> */}
</section>
</main>
</div>

Expand Down
2 changes: 1 addition & 1 deletion src/components/BoardList.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const BoardList = (props) => {
)
})

return <section>{ boardList }</section>
return <div>{ boardList }</div>
}

export default BoardList;
Empty file added src/components/CardList.js
Empty file.
61 changes: 58 additions & 3 deletions src/components/NewBoardForm.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,62 @@
import { useState } from 'react';
import React from 'react';

const NewBoardForm = () => {
return []
}
const NewBoardForm = (props) => {
const [boardForm, setBoardForm] = useState({
title: '',
owner: ''
});

const onTitleChange = (event) => {
setBoardForm({
...boardForm,
title: event.target.value
})
}

const onOwnerChange = (event) => {
setBoardForm({
...boardForm,
owner: event.target.value
})
}

const onFormSubmit = (event) => {
event.preventDefault();

props.addBoardCallback({
titleData: boardForm.title,
ownerData: boardForm.owner
})

setBoardForm({
title: '',
owner: ''
})
}

return (
<form onSubmit={onFormSubmit}>
<div>
<label>Title</label>
<input
value={boardForm.title}
onChange={ onTitleChange }
/>
</div>
<div>
<label>Owner</label>
<input
value={boardForm.owner}
onChange={ onOwnerChange }
/>
</div>
<input
type="submit"
value="Submit The Board"
/>
</form>
);
};

export default NewBoardForm;
44 changes: 41 additions & 3 deletions src/components/NewCardForm.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,45 @@
import React from 'react';
import { useState } from 'react';

const NewCardForm = () => {
return []
}
const NewCardForm = (props) => {
const [cardForm, setCardForm] = useState({
message: ''
});

const onMessageChange = (event) => {
setCardForm({
...cardForm,
message: event.target.value
})
}

const onFormSubmit = (event) => {
event.preventDefault();

props.addCardCallback({
message: cardForm.message
})

setCardForm({
message:''
})
}

return (
<form onSubmit={onFormSubmit}>
<div>
<label>Message</label>
<input
value={cardForm.message}
onChange={ onMessageChange }
/>
</div>
<input
type="submit"
value="Submit The Message"
/>
</form>
);
};

export default NewCardForm;