Skip to content
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

Add "New" badge to Key Metrics dashboard widgets. #7493

Merged
merged 2 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion assets/js/googlesitekit/widgets/register-defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
/**
* WordPress dependencies
*/
import { Fragment } from '@wordpress/element';
import { __ } from '@wordpress/i18n';

/**
Expand All @@ -34,6 +35,7 @@ import {
ChangeMetricsLink,
} from '../../components/KeyMetrics';
import AddMetricCTATile from '../../components/KeyMetrics/AddMetricCTATile';
import Badge from '../../components/Badge';
import { CORE_SITE } from '../datastore/site/constants';

const { ...ADDITIONAL_WIDGET_CONTEXTS } = WIDGET_CONTEXTS;
Expand Down Expand Up @@ -84,7 +86,15 @@ export function registerDefaults( widgetsAPI ) {
widgetsAPI.registerWidgetArea(
AREA_MAIN_DASHBOARD_KEY_METRICS_PRIMARY,
{
title: __( 'Key metrics', 'google-site-kit' ),
title: (
<Fragment>
{ __( 'Key metrics', 'google-site-kit' ) }
<Badge
className="googlesitekit-new-badge"
label={ __( 'New', 'google-site-kit' ) }
/>
</Fragment>
),
subtitle: __(
'Track progress towards your goals with tailored metrics',
'google-site-kit'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@
@include mdc-layout-grid-cell-span_("phone", 4, $gutter);
}
}

.googlesitekit-widget-area-header__title {

align-items: center;
display: flex;

.googlesitekit-new-badge {
margin-left: 12px;
}
}
}

.googlesitekit-km-change-metrics-cta {
Expand Down