<commit_before>/**
 * @flow
 */
import React from 'react'
import {Icon, Popup} from 'semantic-ui-react'

import {isEqual} from 'lodash'
import {
	StyledHeader,
	HeaderInner,
	Navicon,
	PageTitle,
	HeaderButton
} from './style'
import {Spacer} from 'styles/base'

type Props = {
	title: string,
	toggleSidebar: () => void,
	isLoggedIn: boolean,
	isMobile: boolean
}

class Header extends React.Component {
	props: Props
	shouldComponentUpdate (nextProps: Props) {
		return !isEqual(nextProps, this.props)
	}

	render () {
		const {title, toggleSidebar, isLoggedIn, isMobile} = this.props

		return (
			<StyledHeader>
				<HeaderInner>
					{isLoggedIn &&
						isMobile &&
						<Navicon onClick={toggleSidebar}>
							<Icon name="content" />
						</Navicon>}
					<PageTitle>
						{title}
					</PageTitle>
					<Spacer />
					<Popup
						trigger={
							<HeaderButton
								id="header-button"
								icon
								as={'a'}
								aria-label="github-header-link-button"
								href="https://github.com/Metnew/noir"
								basic
								circular
							>
								<Icon name="github" size="large" link fitted />
							</HeaderButton>
						}
						content={
							`Star this project!`
						}
						inverted
					/>
				</HeaderInner>
			</StyledHeader>
		)
	}
}

export default Header<commit_msg>feat(components/Header): add react-headroom, add i18n menu<commit_after>/**
 * @flow
 */
import React, {Component} from 'react'
import {Icon, Dropdown, Flag} from 'semantic-ui-react'
import {isEqual} from 'lodash'
// import {FormattedMessage} from 'react-intl'
import {
	StyledHeader,
	HeaderInner,
	Navicon,
	PageTitle,
	HeaderButton
} from './style'
import {Spacer} from 'styles/base'
import Headroom from 'react-headroom'

type Props = {
	title: string,
	toggleSidebar: () => void,
	isLoggedIn: boolean,
	isMobile: boolean
}

class Header extends Component {
	props: Props
	shouldComponentUpdate (nextProps: Props) {
		return !isEqual(nextProps, this.props)
	}

	render () {
		const {title, toggleSidebar, isLoggedIn, isMobile} = this.props
		const options = [{key: 1, text: 'EN'}, {key: 2, text: 'RU'}]
		const selectedLanguage = {
			text: 'ru',
			icon: 'ru'
		}

		return (
			<Headroom>
				<StyledHeader>
					<HeaderInner>
						{isLoggedIn &&
							isMobile &&
							<Navicon onClick={toggleSidebar}>
								<Icon name="content" />
							</Navicon>}
						<PageTitle>
							{title}
						</PageTitle>
						<Spacer />
						<Dropdown
							text={selectedLanguage.text}
							icon={<Flag name="ru" />}
							floating
							labeled
							button
							className="icon"
						>
							<Dropdown.Menu>
								<Dropdown.Header icon="globe" content="Select Language" />
								<Dropdown.Divider />
								<Dropdown.Item flag="us" text="EN" />
								<Dropdown.Item flag="ru" text="RU" />
							</Dropdown.Menu>
						</Dropdown>
						{/* <Flag name="" /> */}
					</HeaderInner>
				</StyledHeader>
			</Headroom>
		)
	}
}

export default Header
{'fraction_non_alphanumeric': 0.13949579831932774, 'fraction_numerical': 0.0013445378151260505, 'mean_word_length': 2.6116504854368934, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 41, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5926887', 'n_tokens_mistral': 1355, 'n_tokens_neox': 992, 'n_words': 227}