-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
40df382
commit 72ccb24
Showing
8 changed files
with
169 additions
and
57 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
packages/edit-site/src/components/dataviews/field-actions.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components'; | ||
import { __ } from '@wordpress/i18n'; | ||
import { moreVertical } from '@wordpress/icons'; | ||
|
||
function FieldActions( { item, actions } ) { | ||
return ( | ||
<DropdownMenu icon={ moreVertical } label={ __( 'Actions' ) }> | ||
{ () => ( | ||
<MenuGroup> | ||
{ actions.map( ( action ) => ( | ||
<MenuItem | ||
key={ action.id } | ||
onClick={ () => action.perform( item ) } | ||
isDestructive={ action.isDesctructive } | ||
> | ||
{ action.label } | ||
</MenuItem> | ||
) ) } | ||
</MenuGroup> | ||
) } | ||
</DropdownMenu> | ||
); | ||
} | ||
|
||
export default FieldActions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,63 @@ | ||
export function ViewGrid() { | ||
return 'Grid'; | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { | ||
__experimentalGrid as Grid, | ||
__experimentalHStack as HStack, | ||
__experimentalVStack as VStack, | ||
FlexBlock, | ||
Placeholder, | ||
} from '@wordpress/components'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import FieldActions from './field-actions'; | ||
|
||
export function ViewGrid( { data, fields, view, actions } ) { | ||
const mediaField = fields.find( | ||
( field ) => field.id === view.layout.mediaField | ||
); | ||
const visibleFields = fields.filter( | ||
( field ) => | ||
! view.hiddenFields.includes( field.id ) && | ||
field.id !== view.layout.mediaField | ||
); | ||
return ( | ||
<Grid gap={ 8 } columns={ 2 } alignment="top"> | ||
{ data.map( ( item, index ) => { | ||
return ( | ||
<VStack key={ index }> | ||
<div className="dataviews-view-grid__media"> | ||
{ ( mediaField && | ||
mediaField.render( { item, view } ) ) || ( | ||
<Placeholder | ||
withIllustration | ||
style={ { | ||
width: '100%', | ||
minHeight: '200px', | ||
} } | ||
/> | ||
) } | ||
</div> | ||
|
||
<HStack justify="space-between" alignment="top"> | ||
<FlexBlock> | ||
<VStack> | ||
{ visibleFields.map( ( field ) => ( | ||
<div key={ field.id }> | ||
{ field.render | ||
? field.render( { item, view } ) | ||
: field.accessorFn( item ) } | ||
</div> | ||
) ) } | ||
</VStack> | ||
</FlexBlock> | ||
<FieldActions item={ item } actions={ actions } /> | ||
</HStack> | ||
</VStack> | ||
); | ||
} ) } | ||
</Grid> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
.edit-site-page-pages__featured-image { | ||
border-radius: $radius-block-ui; | ||
max-height: 60px; | ||
} |
72ccb24
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.
Flaky tests detected in 72ccb24.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.
🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6546007539
📝 Reported issues:
/test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js
/test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js