Skip to content

Commit

Permalink
Changed Header into Function based component
Browse files Browse the repository at this point in the history
  • Loading branch information
Azzam1503 committed Mar 4, 2023
1 parent b273418 commit 03182b5
Showing 1 changed file with 13 additions and 33 deletions.
46 changes: 13 additions & 33 deletions src/components/theme/Header/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,37 +16,8 @@ import {
SearchWidget,
} from '@plone/volto/components';

/**
* Header component class.
* @class Header
* @extends Component
*/
class Header extends Component {
/**
* Property types.
* @property {Object} propTypes Property types.
* @static
*/
static propTypes = {
token: PropTypes.string,
pathname: PropTypes.string.isRequired,
};

/**
* Default properties.
* @property {Object} defaultProps Default properties.
* @static
*/
static defaultProps = {
token: null,
};

/**
* Render method.
* @method render
* @returns {string} Markup for the component.
*/
render() {
const Header = ({pathname, token}) => {
return (
<Segment basic className="header-wrapper" role="banner">
<Container>
Expand All @@ -55,11 +26,11 @@ class Header extends Component {
<div className="logo">
<Logo />
</div>
<Navigation pathname={this.props.pathname} />
<Navigation pathname={pathname} />
</div>
<div className="tools-search-wrapper">
<LanguageSelector />
{!this.props.token && (
{!token && (
<div className="tools">
<Anontools />
</div>
Expand All @@ -73,7 +44,16 @@ class Header extends Component {
</Segment>
);
}
}

Header.propTypes = {
token: PropTypes.string,
pathname: PropTypes.string.isRequired,
};

Header.defaultProps = {
token: null,
};


export default connect((state) => ({
token: state.userSession.token,
Expand Down

0 comments on commit 03182b5

Please sign in to comment.