refactor: used classname in conditional class

This commit is contained in:
ayeshoali
2022-12-01 16:17:11 +05:00
parent f45f47f2e0
commit 9d9377bb8c

View File

@@ -1,6 +1,7 @@
import React, { useContext } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { useDispatch, useSelector } from 'react-redux';
import { useHistory, useLocation } from 'react-router-dom';
@@ -109,7 +110,9 @@ function Post({
<HTMLLoader htmlNode={post.renderedBody} id="post" />
</div>
{topicContext && topic && (
<div className={`border px-3 rounded mb-4 border-light-400 align-self-start py-2.5 ${inContext ? 'w-100' : ''}`}>
<div className={classNames('border px-3 rounded mb-4 border-light-400 align-self-start py-2.5',
{ 'w-100': inContext })}
>
<span className="text-gray-500">{intl.formatMessage(messages.relatedTo)}{' '}</span>
<Hyperlink
destination={topicContext.unitLink}
@@ -120,7 +123,7 @@ function Post({
<>
<span className="w-auto">{topicContext.chapterName}</span>
<span className="mx-1">/</span>
<span className=" w-auto">{topicContext.verticalName}</span>
<span className="w-auto">{topicContext.verticalName}</span>
<span className="mx-1">/</span>
<span className="w-auto">{topicContext.unitName}</span>
</>