mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-27 19:42:11 +10:00
use createSlug
This commit is contained in:
parent
cd22fcd093
commit
48dbe8bf77
2 changed files with 4 additions and 2 deletions
|
|
@ -5,6 +5,7 @@ import { NamedLink, ResponsiveImage } from '../../components';
|
|||
import * as propTypes from '../../util/propTypes';
|
||||
import { convertMoneyToNumber } from '../../util/currency';
|
||||
import { ensureListing, ensureUser } from '../../util/data';
|
||||
import { createSlug } from '../../util/urlHelpers';
|
||||
|
||||
import css from './ListingCard.css';
|
||||
|
||||
|
|
@ -34,7 +35,7 @@ export const ListingCardComponent = props => {
|
|||
const currentListing = ensureListing(listing);
|
||||
const id = currentListing.id.uuid;
|
||||
const { title = '', price } = currentListing.attributes;
|
||||
const slug = encodeURIComponent(title.split(' ').join('-'));
|
||||
const slug = createSlug(title);
|
||||
const author = ensureUser(listing.author);
|
||||
const authorName = `${author.attributes.profile.firstName} ${author.attributes.profile.lastName}`;
|
||||
const firstImage = currentListing.images && currentListing.images.length > 0
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import { formatMoney } from '../../util/currency';
|
|||
import config from '../../config';
|
||||
import { withFlattenedRoutes } from '../../util/contextHelpers';
|
||||
import { createResourceLocatorString } from '../../util/routes';
|
||||
import { createSlug } from '../../util/urlHelpers';
|
||||
import { ResponsiveImage } from '../../components';
|
||||
|
||||
import css from './SearchMapListingCard.css';
|
||||
|
|
@ -21,7 +22,7 @@ const getPixelPositionOffset = (width, height) => {
|
|||
|
||||
const createURL = (flattenedRoutes, history, listing) => {
|
||||
const id = listing.id.uuid;
|
||||
const slug = encodeURIComponent(listing.attributes.title.split(' ').join('-'));
|
||||
const slug = createSlug(listing.attributes.title);
|
||||
const pathParams = { id, slug };
|
||||
return createResourceLocatorString('ListingPage', flattenedRoutes, pathParams, {});
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue