mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-26 06:47:17 +10:00
ListingLink: add draft as a path variant
This commit is contained in:
parent
77743a2e4b
commit
1aaad1d4e1
1 changed files with 14 additions and 4 deletions
|
|
@ -9,8 +9,12 @@
|
|||
import React from 'react';
|
||||
import { string, oneOfType, node } from 'prop-types';
|
||||
import { richText } from '../../util/richText';
|
||||
import { LISTING_STATE_PENDING_APPROVAL, propTypes } from '../../util/types';
|
||||
import { LISTING_PAGE_PENDING_APPROVAL_VARIANT, createSlug } from '../../util/urlHelpers';
|
||||
import { LISTING_STATE_DRAFT, LISTING_STATE_PENDING_APPROVAL, propTypes } from '../../util/types';
|
||||
import {
|
||||
LISTING_PAGE_DRAFT_VARIANT,
|
||||
LISTING_PAGE_PENDING_APPROVAL_VARIANT,
|
||||
createSlug,
|
||||
} from '../../util/urlHelpers';
|
||||
import { NamedLink } from '../../components';
|
||||
|
||||
import css from './ListingLink.css';
|
||||
|
|
@ -36,13 +40,19 @@ const ListingLink = props => {
|
|||
);
|
||||
|
||||
const isPendingApproval = state === LISTING_STATE_PENDING_APPROVAL;
|
||||
const linkProps = isPendingApproval
|
||||
const isDraft = state === LISTING_STATE_DRAFT;
|
||||
const variant = isPendingApproval
|
||||
? LISTING_PAGE_PENDING_APPROVAL_VARIANT
|
||||
: isDraft
|
||||
? LISTING_PAGE_DRAFT_VARIANT
|
||||
: null;
|
||||
const linkProps = !!variant
|
||||
? {
|
||||
name: 'ListingPageVariant',
|
||||
params: {
|
||||
id,
|
||||
slug,
|
||||
variant: LISTING_PAGE_PENDING_APPROVAL_VARIANT,
|
||||
variant,
|
||||
},
|
||||
}
|
||||
: {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue