Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,10 @@ import classnames from 'classnames';
import { __, sprintf } from '@wordpress/i18n';
import { dateI18n, getDate, humanTimeDiff } from '@wordpress/date';
import { createInterpolateElement } from '@wordpress/element';
import { Path, SVG } from '@wordpress/primitives';

const publishedIcon = (
<SVG fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<Path
fillRule="evenodd"
clipRule="evenodd"
d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16Zm-1.067-5.6 4.2-5.667.8.6-4.8 6.467-3-2.267.6-.8 2.2 1.667Z"
/>
</SVG>
);

const draftIcon = (
<SVG fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<Path
fillRule="evenodd"
clipRule="evenodd"
d="M14.5 8a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0ZM16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0Zm-8 4a4 4 0 0 0 0-8v8Z"
/>
</SVG>
);

const pendingIcon = (
<SVG fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<Path
fillRule="evenodd"
clipRule="evenodd"
d="M14.5 8a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0ZM16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0ZM8 4a4 4 0 1 0 0 8 4 4 0 0 0 0-8Z"
/>
</SVG>
);

export default function StatusLabel( { status, date, short } ) {
const relateToNow = humanTimeDiff( date );
let statusLabel = status;
let statusIcon = pendingIcon;
switch ( status ) {
case 'publish':
statusLabel = date
Expand All @@ -57,7 +25,6 @@ export default function StatusLabel( { status, date, short } ) {
{ time: <time dateTime={ date } /> }
)
: __( 'Published' );
statusIcon = publishedIcon;
break;
case 'future':
const formattedDate = dateI18n(
Expand All @@ -77,7 +44,6 @@ export default function StatusLabel( { status, date, short } ) {
break;
case 'draft':
statusLabel = __( 'Draft' );
statusIcon = draftIcon;
break;
case 'pending':
statusLabel = __( 'Pending' );
Expand All @@ -99,7 +65,7 @@ export default function StatusLabel( { status, date, short } ) {
}
) }
>
{ statusIcon } { statusLabel }
{ statusLabel }
</div>
);
}