Skip to content

Commit

Permalink
feat: update digest news redirecting (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
js-machine authored and vharadkou committed Sep 1, 2019
1 parent ef1fecb commit cdc3b30
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 55 deletions.
40 changes: 12 additions & 28 deletions js_machine_front/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions js_machine_front/src/components/navBar/navBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import { FormattedMessage } from 'react-intl';
import { NavBarState } from './models/navBar';

export class NavBar extends React.PureComponent {
public state: NavBarState = { isMenuOpened: false };
public state: NavBarState = {isMenuOpened: false};

handleMenu = () => {
this.setState({ isMenuOpened: !this.state.isMenuOpened });
this.setState({isMenuOpened: !this.state.isMenuOpened});
}

render(): JSX.Element {
return (
<div>
Expand Down Expand Up @@ -41,9 +42,6 @@ export class NavBar extends React.PureComponent {
<NavLink exact={true} className="menu__nav-link" activeClassName="active-link" to="/authorization">
<FormattedMessage id="page.signIn" />
</NavLink>
<NavLink exact={true} className="menu__nav-link" activeClassName="active-link" to="/digestview">
<FormattedMessage id="page.digestview" />
</NavLink>
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ describe('NavBar component is ready', () => {

const tileContent = component.find(NavLink);

expect(tileContent).toHaveLength(7);
expect(tileContent).toHaveLength(6);
});
});
42 changes: 23 additions & 19 deletions js_machine_front/src/scenes/news/components/newsPresentation.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
import React from 'react';
import { News } from '../models/news';
import { Link } from 'react-router-dom';

export const NewsPresentation: React.FC<News> = (props) => {
const newsDate: number = new Date(props.date).getDate();
const newsMonth: string = new Date(props.date).toLocaleString('ru', { month: 'short' }).toUpperCase();
const newsDate: number = new Date(props.date).getDate();
const newsMonth: string = new Date(props.date).toLocaleString('ru', {month: 'short'}).toUpperCase();

return (
<div className="news__wrapper">
<div className="news__read">
<div className="news__read-content">ЧИТАТЬ ></div>
</div>
<div className="news__content">
<div>
<p className="news__day">{newsDate} {newsMonth}</p>
</div>
<div>
<p className="news__title">{props.title}</p>
</div>
<div>
<p className="news__description">{props.description}</p>
</div>
</div>
return (
<div className="news__wrapper">
<Link to="/digestview">
<div className="news__read">
<div className="news__read-content">ЧИТАТЬ ></div>
</div>
);
</Link>

<div className="news__content">
<div>
<p className="news__day">{newsDate} {newsMonth}</p>
</div>
<div>
<p className="news__title">{props.title}</p>
</div>
<div>
<p className="news__description">{props.description}</p>
</div>
</div>
</div>
)
};
4 changes: 2 additions & 2 deletions js_machine_front/src/scenes/news/styles/news.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.body{
.body {
height: 100%;
width: 100%;
background-color: rgba(0,0,0,0.6);
background-color: rgba(0, 0, 0, 0.6);
}
1 change: 1 addition & 0 deletions js_machine_front/src/scenes/news/styles/newsContainer.css
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,5 @@
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
white-space: nowrap;
text-decoration: none;
}

0 comments on commit cdc3b30

Please sign in to comment.