-
Notifications
You must be signed in to change notification settings - Fork 9
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
Update notes components #419
Changes from 1 commit
567cfeb
2921fea
eaf5781
cbdfeb5
15c8c25
1ee453d
26e35d5
f39c175
408e41a
bd104a6
4e81572
164f906
24f7955
42fa96f
bd26e7d
66e68c4
c496e8c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import fecha from 'fecha'; | ||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
|
||
import classnames from 'classnames'; | ||
import Badge from './Badge'; | ||
import Button from './Button'; | ||
import CardHeader from './CardHeader'; | ||
|
@@ -26,22 +26,37 @@ class NoteHeader extends React.Component { | |
const { note, onDelete, onEdit } = this.props; | ||
const { date, edited, from } = note; | ||
|
||
const headerClassNames = classnames( | ||
'd-flex', | ||
'flex-wrap', | ||
'align-items-center', | ||
'justify-content-between', | ||
'py-2', | ||
'pr-2', | ||
'bg-info' | ||
); | ||
|
||
return ( | ||
<CardHeader className="d-flex justify-content-start p-2 bg-info"> | ||
{edited ? <span className="js-note-header__edited"><Badge color="primary text-uppercase mr-2">Edited</Badge></span> : null} | ||
<span className="text-muted"> | ||
<span className="hidden-xs-down"> | ||
{edited ? 'Last edited' : 'Posted'} | ||
{from ? <span className="js-note-header__from">{` by ${from}`}</span> : ' '} on <span className="js-note-header__date">{dateFormat(date, 'ddd, MMMM D, YYYY "at" h:mm A')}</span> | ||
</span> | ||
<span className="hidden-sm-up"> | ||
{from ? <span>{from} </span> : null}<span className="js-note-header__shortDate">{dateFormat(date, 'M/D/YY h:mm A')}</span> | ||
<CardHeader className={headerClassNames}> | ||
<div | ||
className="d-inline-flex align-items-center" | ||
ref="title" | ||
> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The In use: https://qa.qa.appfolio.com/maintenance/mobile?assignedUserId=any#/133920/notes |
||
{edited && <Badge color="primary" className="text-uppercase mr-2 js-note-header__edited">Edited</Badge>} | ||
<span className="m-0 my-1 mr-auto"> | ||
<span className="hidden-xs-down"> | ||
{edited ? 'Last edited' : 'Posted'} | ||
{from ? <span className="js-note-header__from">{` by ${from}`}</span> : ' '} on <span className="js-note-header__date">{dateFormat(date, 'ddd, MMMM D, YYYY "at" h:mm A')}</span> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a bit odd to me that there are different date formats for Edited and non-edited notes, but that's the way it is in APM. Perhaps it makes sense to have these customizable. Not a big deal though There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to be clear, the date format is the same, only the labeling of that date changes: "Posted by Gary Thomas on Mon, July 2, 2018 at 2:33 PM" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I meant compared to short dateformat below on line 52: |
||
</span> | ||
<span className="hidden-sm-up"> | ||
{from ? <span>{from} </span> : null}<span className="js-note-header__shortDate">{dateFormat(date, 'M/D/YY h:mm A')}</span> | ||
</span> | ||
</span> | ||
</span> | ||
<span className="ml-auto"> | ||
</div> | ||
<div className="d-inline-flex"> | ||
{onEdit ? <Button color="link" onClick={() => onEdit(note)} className="js-note-header__edit mr-3 p-0">edit</Button> : null} | ||
{onDelete ? <Button color="link" onClick={() => onDelete(note)} className="js-note-header__delete p-0">delete</Button> : null} | ||
</span> | ||
</div> | ||
</CardHeader> | ||
); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this ref for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These were left over from the original impl. The unit test uses these refs to find elements. We should get away from that, IMHO, but I didn't go that far.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries, just curious