Skip to content

Commit

Permalink
display modifiedat + fix style
Browse files Browse the repository at this point in the history
  • Loading branch information
S1B41 committed Nov 13, 2020
1 parent cf37dbd commit 1d36848
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
15 changes: 13 additions & 2 deletions imports/ui/note.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import NoteText from "./noteText";

export default class Note extends Component {
render() {
const { value, createdAt, onEdit, onRemove } = this.props;
const { value, createdAt, modifiedAt, onEdit, onRemove } = this.props;
return (
<div
onClick={onEdit}
style={{
padding: "15px 15px 10px",
cursor: "pointer",
whiteSpace: "pre-wrap",
overflow: "hidden",
Expand All @@ -25,10 +26,20 @@ export default class Note extends Component {
<LinesEllipsis text={value} maxLine="3" ellipsis=" ..." />
{/* </div> */}
{/* <div><button onClick={() => this.props.onRemove()}>Remove</button></div> */}
<div>
<div
style={{
marginTop: 10,
color: "#ccc",
display: "flex",
justifyContent: "space-between",
}}
>
<small style={{ fontSize: "xx-small" }}>
created on {createdAt.toLocaleString("de")}
</small>
<small style={{ fontSize: "xx-small" }}>
modified on {(modifiedAt || createdAt).toLocaleString("de")}
</small>
</div>
<div>
{/* <button className="btn"> */}
Expand Down
3 changes: 2 additions & 1 deletion imports/ui/noteList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class notelist extends Component {
notes[index].value = this.state.value;
Notes.update(
{ _id: notes[index]._id },
{ $set: { value: this.state.value, modified: new Date() } }
{ $set: { value: this.state.value, modifiedAt: new Date() } }
);
this.setState({ editModal: false, value: "" });
}
Expand Down Expand Up @@ -91,6 +91,7 @@ class notelist extends Component {
key={note._id}
value={note.value}
createdAt={note.createdAt}
modifiedAt={note.modifiedAt}
onEdit={() =>
this.setState({ currentNote: note._id, editModal: true })
}
Expand Down

0 comments on commit 1d36848

Please sign in to comment.