Commit 2c549018 authored by Matija Obreza's avatar Matija Obreza
Browse files

Fix: Page title component should not use t()

parent 170aa79b
import * as React from 'react';
import { WithTranslation, withTranslation } from 'react-i18next';
import { Helmet } from 'react-helmet-async';
import { stripHtml } from '@genesys/client/utilities';
import { connect } from 'react-redux';
import { WithConfig } from 'config/config';
interface IPageTitle extends React.ClassAttributes<any>, WithTranslation {
interface IPageTitle extends React.ClassAttributes<any> {
title: string;
description?: string;
}
class PageTitle extends React.Component<IPageTitle & WithConfig, any> {
public constructor(props, context) {
super(props, context);
}
public render() {
const { appConfig: { title: appTitle }, title, description, t } = this.props;
const { appConfig: { title: appTitle }, title, description } = this.props;
return (
<Helmet>
<title>{ t(stripHtml( appTitle ? (appTitle + ' ' + title).trim() : title)) }</title>
{ description && <meta name="description" content={ t(description) } /> }
<title>{ stripHtml( appTitle ? (appTitle + ' ' + title).trim() : title) }</title>
{ description && <meta name="description" content={ stripHtml(description) } /> }
</Helmet>
);
}
......@@ -31,4 +27,4 @@ const mapStateToProps = (state) => ({
appConfig: state.appConfig.config,
});
export default connect(mapStateToProps)(withTranslation()(PageTitle));
export default connect(mapStateToProps)(PageTitle);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment