Skip to content

Commit 1005b62

Browse files
authored
Merge pull request #8 from vicistomin/sprint-4/step-3
Sprint 4/step 3
2 parents ab70733 + 4e4d135 commit 1005b62

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1294
-895
lines changed

Diff for: .github/workflows/test.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Run tests
2+
3+
on:
4+
# Trigger the workflow on push or pull request,
5+
# but only for the main branch
6+
push:
7+
branches: [ main ]
8+
pull_request:
9+
branches: [ main ]
10+
11+
jobs:
12+
build:
13+
14+
runs-on: ubuntu-latest
15+
16+
strategy:
17+
matrix:
18+
node-version: [12.x, 14.x, 16.x]
19+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
20+
21+
steps:
22+
- uses: actions/checkout@v2
23+
- name: Run tests using Node.js ${{ matrix.node-version }}
24+
uses: actions/setup-node@v2
25+
with:
26+
node-version: ${{ matrix.node-version }}
27+
cache: 'npm'
28+
- run: npm ci
29+
- run: npm test

Diff for: .husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
CI=true npm run test

Diff for: declarations/css-modules.d.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
declare module '*.css' {
2+
interface IClassNames {
3+
[className: string]: string;
4+
}
5+
const classNames: IClassNames;
6+
export = classNames;
7+
}

Diff for: package-lock.json

+140-20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"build": "react-scripts build",
2525
"test": "react-scripts test",
2626
"cypress:open": "./node_modules/.bin/cypress open",
27-
"eject": "react-scripts eject"
27+
"eject": "react-scripts eject",
28+
"prepare": "husky install"
2829
},
2930
"eslintConfig": {
3031
"extends": [
@@ -49,15 +50,20 @@
4950
"@testing-library/react": "^11.2.7",
5051
"@testing-library/user-event": "^12.8.3",
5152
"@types/enzyme": "^3.10.9",
53+
"@types/history": "^4.7.9",
5254
"@types/jest": "^26.0.24",
5355
"@types/node": "^12.20.13",
5456
"@types/react": "^17.0.8",
57+
"@types/react-dnd": "^3.0.2",
58+
"@types/react-dnd-html5-backend": "^3.0.2",
5559
"@types/react-dom": "^17.0.5",
60+
"@types/react-router-dom": "^5.1.8",
5661
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.3",
5762
"cypress": "^8.0.0",
5863
"enzyme": "^3.11.0",
5964
"eslint-plugin-cypress": "^2.11.3",
6065
"fetch-mock": "^9.11.0",
66+
"husky": "^7.0.0",
6167
"react-test-renderer": "^17.0.2",
6268
"redux-mock-store": "^1.5.4"
6369
}

Diff for: src/components/app-header/app-header.module.css

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
.menu_list_center {
2424
composes: flex_row from global;
2525
flex-basis: 20%;
26+
cursor: pointer;
2627
}
2728

2829
.menu_list_right {

Diff for: src/components/app-header/app-header.jsx renamed to src/components/app-header/app-header.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ import MenuItem from '../menu-item/menu-item';
55
import { Logo, BurgerIcon, ListIcon, ProfileIcon } from '@ya.praktikum/react-developer-burger-ui-components';
66

77
import { useHistory } from 'react-router-dom';
8-
import { useState, useEffect } from 'react';
8+
import { FC, useState, useEffect } from 'react';
99

10-
function AppHeader() {
10+
const AppHeader: FC = () => {
1111
const history = useHistory();
1212

13-
const [isHomePage, setHomePage] = useState(false);
14-
const [isFeedPage, setFeedPage] = useState(false);
15-
const [isProfilePage, setProfilePage] = useState(false);
13+
const [isHomePage, setHomePage] = useState<boolean>(false);
14+
const [isFeedPage, setFeedPage] = useState<boolean>(false);
15+
const [isProfilePage, setProfilePage] = useState<boolean>(false);
1616

17-
const currentUrl = history.location.pathname;
17+
const currentUrl: string = history.location.pathname;
1818

1919
useEffect(() => {
2020
switch (currentUrl) {

0 commit comments

Comments
 (0)