Skip to content

Commit

Permalink
Add labels
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed Nov 29, 2023
1 parent 0bfb834 commit 5450cac
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
12 changes: 12 additions & 0 deletions packages/edit-site/src/components/dataviews/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,15 @@
width: 100%;
}

.dataviews-list-view__selection-column label {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0,0,0,0);
white-space: nowrap;
border: 0;
}

19 changes: 19 additions & 0 deletions packages/edit-site/src/components/dataviews/view-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,11 @@ function ViewList( {
setSelection( data.map( ( { id } ) => id ) );
}
} }
label={
areAllSelected
? __( 'Deselect all' )
: __( 'Select all' )
}
/>
),
id: 'selection',
Expand All @@ -279,6 +284,11 @@ function ViewList( {
<CheckboxControl
__nextHasNoMarginBottom
checked={ isSelected }
label={
isSelected
? __( 'Deselect item' )
: __( 'Select a new item' )
}
onChange={ () => {
if ( ! isSelected ) {
const newSelection = [
Expand All @@ -299,6 +309,7 @@ function ViewList( {
},
enableHiding: false,
width: 40,
className: 'dataviews-list-view__selection-column'
} );
}
if ( actions?.length ) {
Expand Down Expand Up @@ -524,6 +535,10 @@ function ViewList( {
header.column.columnDef
.maxWidth || undefined,
} }
className={
header.column.columnDef.className ||
undefined
}
data-field-id={ header.id }
>
<HeaderMenu
Expand Down Expand Up @@ -552,6 +567,10 @@ function ViewList( {
cell.column.columnDef
.maxWidth || undefined,
} }
className={
cell.column.columnDef.className ||
undefined
}
>
{ flexRender(
cell.column.columnDef.cell,
Expand Down
2 changes: 1 addition & 1 deletion packages/edit-site/src/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export const removeTemplate =

registry.dispatch( noticesStore ).createSuccessNotice(
sprintf(
/* translators: The template/part's name. */
/* translators: %s: The template or template part's name. */
__( '"%s" deleted.' ),
decodeEntities( templateTitle )
),
Expand Down

0 comments on commit 5450cac

Please sign in to comment.