Skip to content

Commit

Permalink
Props added and intialized
Browse files Browse the repository at this point in the history
  • Loading branch information
Drougnov committed Sep 17, 2022
1 parent 7d6fdf8 commit f044d6b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
21 changes: 11 additions & 10 deletions src/Components/Editor.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import React from "react";
import ReactMde from "react-mde";
import Showdown from "showdown";
import React from "react"
import ReactMde from "react-mde"
import Showdown from "showdown"

export default function Editor(){
const [selectedTab, setSelectedTab] = React.useState('write')
export default function Editor(props) {
const [selectedTab, setSelectedTab] = React.useState("write")

console.log(selectedTab)
const converter = new Showdown.Converter({
tables: true,
simplifiedAutoLink: true,
strikethrough: true,
tasklists: true
});
tasklists: true,
})

return(
return (
<div className="editor">
<ReactMde
value={props.currentNote.body}
onChange={props.updateNote}
selectedTab={selectedTab}
onTabChange={setSelectedTab}
generateMarkdownPreview={(markdown) =>
Expand All @@ -26,4 +27,4 @@ export default function Editor(){
/>
</div>
)
}
}
18 changes: 13 additions & 5 deletions src/Components/Sidebar.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
export default function Sidebar(){
export default function Sidebar(props){
const noteList = props.notes.map((note, index)=> (
<li key={note.id}
className={`title ${
note.id === props.currentNote.id ? "selected-note" : ""
}`}
onClick={() =>props.setCurrentNoteId(note.id)}
>
<span className="text-snippet">Note {index + 1}</span>
</li>
))
return(
<section className="sidebar">
<div className="sidebar__header">
<h1 className="sidebar__header-logo">Notes</h1>
<button className="sidebar__header-btn">+</button>
<button className="sidebar__header-btn" onClick={props.newNote}>+</button>
</div>
<ul className="note-list">
<li>Note 1</li>
<li>Note 2</li>
<li>Note 3</li>
{noteList}
</ul>
</section>
)
Expand Down

0 comments on commit f044d6b

Please sign in to comment.