-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
[Data views]: Normalize render
fields function
#55411
Changes from all commits
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 |
---|---|---|
|
@@ -89,7 +89,7 @@ export default function PagePages() { | |
id: 'featured-image', | ||
header: __( 'Featured Image' ), | ||
accessorFn: ( page ) => page.featured_media, | ||
render: ( { item, view: currentView } ) => | ||
render: ( item, currentView ) => | ||
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 problem is that this is not a component anymore, I think make it a component have some advantages. So I'd rather change the signature of 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. Yeah, I'm planning on doing this today. |
||
!! item.featured_media ? ( | ||
<Media | ||
className="edit-site-page-pages__featured-image" | ||
|
@@ -107,7 +107,7 @@ export default function PagePages() { | |
header: __( 'Title' ), | ||
id: 'title', | ||
accessorFn: ( page ) => page.title?.rendered || page.slug, | ||
render: ( { item: page } ) => { | ||
render: ( page ) => { | ||
return ( | ||
<VStack spacing={ 1 }> | ||
<Heading as="h3" level={ 5 }> | ||
|
@@ -134,7 +134,7 @@ export default function PagePages() { | |
header: __( 'Author' ), | ||
id: 'author', | ||
accessorFn: ( page ) => page._embedded?.author[ 0 ]?.name, | ||
render: ( { item } ) => { | ||
render: ( item ) => { | ||
const author = item._embedded?.author[ 0 ]; | ||
return ( | ||
<a href={ `user-edit.php?user_id=${ author.id }` }> | ||
|
@@ -153,7 +153,7 @@ export default function PagePages() { | |
{ | ||
header: 'Date', | ||
id: 'date', | ||
render: ( { item } ) => { | ||
render: ( item ) => { | ||
const formattedDate = dateI18n( | ||
getSettings().formats.datetimeAbbreviated, | ||
getDate( item.date ) | ||
|
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.
There was an extra spreading of the array here.