stab
This commit is contained in:
parent
06ce5266e2
commit
a885686ae4
|
@ -89,8 +89,8 @@ const getTitleAndSubtitle = (
|
||||||
}
|
}
|
||||||
|
|
||||||
const getMainTopicTitle = (article: Shout, lng: string) => {
|
const getMainTopicTitle = (article: Shout, lng: string) => {
|
||||||
const mainTopicSlug = article.main_topic || ''
|
const mainTopicSlug = article?.main_topic || ''
|
||||||
const mainTopic = article.topics?.find((tpc: Topic) => tpc.slug === mainTopicSlug)
|
const mainTopic = article?.topics?.find((tpc: Topic) => tpc.slug === mainTopicSlug)
|
||||||
const mainTopicTitle =
|
const mainTopicTitle =
|
||||||
mainTopicSlug && lng === 'en' ? mainTopicSlug.replace(/-/, ' ') : mainTopic?.title || ''
|
mainTopicSlug && lng === 'en' ? mainTopicSlug.replace(/-/, ' ') : mainTopic?.title || ''
|
||||||
|
|
||||||
|
@ -111,8 +111,8 @@ export const ArticleCard = (props: ArticleCardProps) => {
|
||||||
const [isActionPopupActive, setIsActionPopupActive] = createSignal(false)
|
const [isActionPopupActive, setIsActionPopupActive] = createSignal(false)
|
||||||
const [isCoverImageLoadError, setIsCoverImageLoadError] = createSignal(false)
|
const [isCoverImageLoadError, setIsCoverImageLoadError] = createSignal(false)
|
||||||
const [isCoverImageLoading, setIsCoverImageLoading] = createSignal(true)
|
const [isCoverImageLoading, setIsCoverImageLoading] = createSignal(true)
|
||||||
const description = getDescription(props.article.body)
|
const description = getDescription(props.article?.body)
|
||||||
const aspectRatio = () => LAYOUT_ASPECT[props.article.layout]
|
const aspectRatio = () => LAYOUT_ASPECT[props.article?.layout]
|
||||||
const [mainTopicTitle, mainTopicSlug] = getMainTopicTitle(props.article, lang())
|
const [mainTopicTitle, mainTopicSlug] = getMainTopicTitle(props.article, lang())
|
||||||
const { title, subtitle } = getTitleAndSubtitle(props.article)
|
const { title, subtitle } = getTitleAndSubtitle(props.article)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user