Skip to content

Commit

Permalink
feat(core): create <Header />
Browse files Browse the repository at this point in the history
use <Header /> on <Layout />, also rename <Nav /> to <Navigation />
  • Loading branch information
aneurysmjs committed May 2, 2019
1 parent 9b0a8fe commit f5abcc6
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 10 deletions.
30 changes: 30 additions & 0 deletions src/app/components/core/Header/Header.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// @flow strict
import React, { Component } from 'react';
// $FlowIgnore
import { connect } from 'react-redux';

import Navigation from '@/components/core/Navigation/Navigation';

import './Header.scss';

type PropsType = {};

type StateType = {};

class Header extends Component<PropsType, StateType> {
state = {};

render() {
return (
<div className="header">
<Navigation />
</div>
);
}
}

const mapStateToProps = () => ({});

const mapDispatchToProps = {};

export default connect(mapStateToProps, mapDispatchToProps)(Header);
7 changes: 7 additions & 0 deletions src/app/components/core/Header/Header.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@import '~styles/functions/px-to-rem';
@import '~styles/mixins';
@import '~styles/variables';

.header {

}
13 changes: 13 additions & 0 deletions src/app/components/core/Header/Header.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// @flow strict
import React from 'react';
import { shallow } from 'enzyme';

import Header from './Header';

describe('Header', () => {
const defaultProps = {};

it('tests something', () => {
shallow(<Header {...defaultProps} />);
});
});
4 changes: 2 additions & 2 deletions src/app/components/core/Layout/Layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react';
import type { Node } from 'react';

import Footer from '@/components/core/Footer/Footer';
import Nav from '@/components/core/Nav/Nav';
import Header from '@/components/core/Header/Header';

import './Layout.scss';

Expand All @@ -13,7 +13,7 @@ type PropsType = {

const Layout = (props: PropsType) => (
<div className="layout">
<Nav />
<Header />
<div className="layout__content">
{ props.children }
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// @flow strict
import React, { Component } from 'react';
import { NavLink } from 'react-router-dom';
// $FlowIgnore
import { connect } from 'react-redux';

type StateType = {
links: Array<{
Expand All @@ -11,7 +9,8 @@ type StateType = {
name: string,
}>
};
class Nav extends Component<{}, StateType> {

class Navigation extends Component<{}, StateType> {

state = {
links: [],
Expand Down Expand Up @@ -53,8 +52,4 @@ class Nav extends Component<{}, StateType> {
}
}

const mapStateToProps = (state) => ({
selectedCountry: state.selectedCountry
});

export default connect(mapStateToProps)(Nav);
export default Navigation;
File renamed without changes.
File renamed without changes.

0 comments on commit f5abcc6

Please sign in to comment.