Skip to content

Commit

Permalink
Fix and update isPrimary actions
Browse files Browse the repository at this point in the history
  • Loading branch information
dkmyta committed Oct 22, 2024
1 parent 32b6d61 commit c2ed715
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,13 @@ export default function ThreatsDataView( {
if ( dataFields.includes( 'fixable' ) ) {
result.push( {
id: 'fix',
label: __( 'Auto-Fix', 'jetpack' ),
label: __( 'Auto-fix', 'jetpack' ),
isPrimary: true,
icon: (
<span className={ `${ styles.threat__action } ${ styles[ 'auto-fix' ] }` }>
{ __( 'Auto-fix', 'jetpack' ) }
</span>
),
callback: onFixThreat,
isEligible( item ) {
if ( ! onFixThreat ) {
Expand All @@ -350,7 +355,6 @@ export default function ThreatsDataView( {
}
return !! item.fixable;
},
icon: 'check',
} );
}

Expand All @@ -359,7 +363,8 @@ export default function ThreatsDataView( {
id: 'ignore',
label: __( 'Ignore', 'jetpack' ),
isPrimary: true,
isDestructive: true,
icon: <span className={ styles.threat__action }>{ __( 'Ignore', 'jetpack' ) }</span>,
// isDestructive: true,
callback: onIgnoreThreat,
isEligible( item ) {
if ( ! onIgnoreThreat ) {
Expand All @@ -370,7 +375,6 @@ export default function ThreatsDataView( {
}
return item.status === 'current';
},
icon: 'unseen',
} );
}

Expand All @@ -379,7 +383,8 @@ export default function ThreatsDataView( {
id: 'un-ignore',
label: __( 'Unignore', 'jetpack' ),
isPrimary: true,
isDestructive: true,
icon: <span className={ styles.threat__action }>{ __( 'Un-ignore', 'jetpack' ) }</span>,
// isDestructive: true,
callback: onUnignoreThreat,
isEligible( item ) {
if ( ! onUnignoreThreat ) {
Expand All @@ -390,7 +395,6 @@ export default function ThreatsDataView( {
}
return item.status === 'ignored';
},
icon: 'seen',
} );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,41 @@
min-height: 0;
}

.dataviews-view-table td, .dataviews-view-table th {
white-space: initial;
}
.dataviews-view-table td,
.dataviews-view-table th {
white-space: initial;
}

.dataviews-view-table td .components-flex {
gap: 4px;
gap: 8px;
}

.dataviews-view-list .dataviews-views-list__fields {
align-items: center;
}

.dataviews-view-table th.dataviews-view-table__actions-column {
text-align: left;
}

.dataviews-view-table tr .dataviews-item-actions {
.components-button:not(.dataviews-all-actions-button) {
opacity: 1;
}

.dataviews-all-actions-button {
display: none;
}
}

.dataviews-view-table__actions-column .dataviews-item-actions .components-button.is-compact.has-icon {
width: fit-content;

&:focus,
&:focus-visible {
box-shadow: none;
}
}
}

.media {
Expand Down Expand Up @@ -107,3 +131,25 @@
min-width: 48px;
text-align: center;
}

.threat__action {
text-wrap: nowrap;
padding: 8px;

&:hover {
color: var( --jp-highlight );
}

&.auto-fix {
background: var( --jp-highlight );
color: var( --jp-white );
border: 1px solid var( --jp-highlight );
border-radius: 3px;

&:hover {
background: var( --jp-white );
color: var( --jp-highlight );
border: 1px solid var( --jp-highlight );
}
}
}

0 comments on commit c2ed715

Please sign in to comment.