2018-09-12 09:01:48 +00:00
|
|
|
import React from 'react';
|
2018-10-16 10:19:51 +00:00
|
|
|
import PropTypes from 'prop-types';
|
2020-11-02 05:56:35 +00:00
|
|
|
import { siteRoot, mediaUrl, logoPath, logoWidth, logoHeight, siteTitle } from '../utils/constants';
|
2024-07-10 03:24:43 +00:00
|
|
|
import { Utils } from '../utils/utils';
|
2018-09-12 09:01:48 +00:00
|
|
|
|
2018-10-16 10:19:51 +00:00
|
|
|
const propTypes = {
|
2019-04-25 02:50:06 +00:00
|
|
|
onCloseSidePanel: PropTypes.func,
|
|
|
|
showCloseSidePanelIcon: PropTypes.bool,
|
2024-07-10 03:24:43 +00:00
|
|
|
positioned: PropTypes.bool,
|
|
|
|
showLogoOnlyInMobile: PropTypes.bool
|
2018-09-12 09:01:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class Logo extends React.Component {
|
|
|
|
|
|
|
|
closeSide = () => {
|
|
|
|
this.props.onCloseSidePanel();
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2020-11-02 05:56:35 +00:00
|
|
|
|
2018-09-12 09:01:48 +00:00
|
|
|
render() {
|
2024-07-10 03:24:43 +00:00
|
|
|
const { positioned, showLogoOnlyInMobile } = this.props;
|
|
|
|
|
|
|
|
if (showLogoOnlyInMobile && Utils.isDesktop()) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2018-09-12 09:01:48 +00:00
|
|
|
return (
|
2024-07-09 07:08:47 +00:00
|
|
|
<div className={`top-logo ${positioned ? 'd-none d-md-block positioned-top-logo' : ''}`}>
|
2018-10-16 10:19:51 +00:00
|
|
|
<a href={siteRoot} id="logo">
|
2023-10-24 06:09:57 +00:00
|
|
|
<img src={logoPath.indexOf('image-view') != -1 ? logoPath : mediaUrl + logoPath} height={logoHeight} width={logoWidth} title={siteTitle} alt="logo" />
|
2018-10-16 10:19:51 +00:00
|
|
|
</a>
|
2019-04-25 02:50:06 +00:00
|
|
|
{this.props.showCloseSidePanelIcon &&
|
2020-11-02 05:56:35 +00:00
|
|
|
<a
|
2019-04-25 02:50:06 +00:00
|
|
|
className="sf2-icon-x1 sf-popover-close side-panel-close action-icon d-md-none"
|
2020-11-02 05:56:35 +00:00
|
|
|
onClick={this.closeSide}
|
|
|
|
title="Close"
|
|
|
|
aria-label="Close"
|
2019-04-25 02:50:06 +00:00
|
|
|
>
|
|
|
|
</a>
|
|
|
|
}
|
2018-10-16 10:19:51 +00:00
|
|
|
</div>
|
2018-09-12 09:01:48 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-16 10:19:51 +00:00
|
|
|
Logo.propTypes = propTypes;
|
2018-09-12 09:01:48 +00:00
|
|
|
|
|
|
|
export default Logo;
|