mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Added ability to change title and hide comment count (#3)
refs https://github.com/TryGhost/Team/issues/1695 This allows theme developers to customise the output via the {{comments}} helper
This commit is contained in:
parent
b58970f9e8
commit
f3f6b2a98f
3 changed files with 8 additions and 5 deletions
|
@ -283,6 +283,8 @@ export default class App extends React.Component {
|
|||
comments,
|
||||
pagination,
|
||||
postId,
|
||||
title: this.props.title,
|
||||
count: this.props.count,
|
||||
colorScheme: this.props.colorScheme,
|
||||
avatarSaturation: this.props.avatarSaturation,
|
||||
accentColor: this.props.accentColor,
|
||||
|
|
|
@ -11,7 +11,7 @@ import Loading from './Loading';
|
|||
const CommentsBoxContent = (props) => {
|
||||
const [isEditing, setIsEditing] = useState(false);
|
||||
|
||||
const {pagination, member, comments, commentsEnabled} = useContext(AppContext);
|
||||
const {pagination, member, comments, commentsEnabled, title, count} = useContext(AppContext);
|
||||
const commentsElements = comments.slice().reverse().map(comment => <Comment isEditing={isEditing} comment={comment} key={comment.id} updateIsEditing={setIsEditing} />);
|
||||
|
||||
const commentsCount = pagination?.total || 0;
|
||||
|
@ -24,10 +24,9 @@ const CommentsBoxContent = (props) => {
|
|||
{/* {TODO: Put in conditionals and variables for the new comment helper} */}
|
||||
<div className="w-full flex justify-between items-baseline font-sans mb-10">
|
||||
<h2 className="font-bold text-[2.8rem] tracking-tight dark:text-[rgba(255,255,255,0.85)]">
|
||||
{/* This will truncate to "Discussion" on mobile screens to save space */}
|
||||
<span className="hidden sm:inline">Member </span><span className="capitalize sm:normal-case">discussion</span>
|
||||
{title ? title : <><span className="hidden sm:inline">Member </span><span className="capitalize sm:normal-case">discussion</span></>}
|
||||
</h2>
|
||||
<div className="text-neutral-400 text-[1.6rem] font-medium">{commentsCount} comments</div>
|
||||
{count ? <div className="text-neutral-400 text-[1.6rem] font-medium">{commentsCount} comments</div> : null}
|
||||
</div>
|
||||
<Pagination />
|
||||
<div className={!pagination ? 'mt-4' : ''}>
|
||||
|
|
|
@ -39,8 +39,10 @@ function getSiteData() {
|
|||
const appVersion = scriptTag.dataset.appVersion;
|
||||
const commentsEnabled = scriptTag.dataset.commentsEnabled;
|
||||
const stylesUrl = scriptTag.dataset.styles;
|
||||
const title = scriptTag.dataset.title === 'null' ? null : scriptTag.dataset.title;
|
||||
const showCount = scriptTag.dataset.count === 'true';
|
||||
|
||||
return {siteUrl, stylesUrl, apiKey, apiUrl, sentryDsn, postId, adminUrl, colorScheme, avatarSaturation, accentColor, appVersion, commentsEnabled};
|
||||
return {siteUrl, stylesUrl, apiKey, apiUrl, sentryDsn, postId, adminUrl, colorScheme, avatarSaturation, accentColor, appVersion, commentsEnabled, title, showCount};
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue