Skip to content
This repository was archived by the owner on Jan 2, 2022. It is now read-only.

Commit 90ab667

Browse files
authored
Feature/add editpage (#133)
* feat: firebase library * Squashed commit of the following: commit 064eb0a Author: hosono kotaro <hosono1985@gmail.com> Date: Sun Feb 21 11:00:29 2021 +0900 fix: precommit script (#127) commit bea617a Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun Feb 21 10:21:22 2021 +0900 build(deps-dev): bump @babel/preset-typescript from 7.12.16 to 7.12.17 (#124) Bumps [@babel/preset-typescript](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-typescript) from 7.12.16 to 7.12.17. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.12.17/packages/babel-preset-typescript) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: hosono kotaro <hosono1985@gmail.com> commit 1d2c51b Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat Feb 20 23:19:41 2021 +0900 build(deps-dev): bump @types/webpack-bundle-analyzer from 3.9.0 to 3.9.1 (#123) commit 64f4864 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat Feb 20 23:14:33 2021 +0900 build(deps-dev): bump @typescript-eslint/parser from 4.14.2 to 4.15.1 (#122) commit 806314f Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat Feb 20 23:06:46 2021 +0900 build(deps-dev): bump @types/node from 14.14.22 to 14.14.31 (#121) commit 3781d1d Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat Feb 20 23:00:33 2021 +0900 build(deps-dev): bump @typescript-eslint/eslint-plugin (#120) commit 7ecf748 Author: hosono kotaro <hosono1985@gmail.com> Date: Sat Feb 20 20:51:55 2021 +0900 feature/husky fix (#125) * feat: Add husky * fix: precommit task * feat: add auth page * fix: move store files * fix: move page files * feat: split edit page * fix: delete chunk filename * wip: add create post * feat: login 機能 * fix: move createPost logic * fix: add regenerator-runtime * Squashed commit of the following: commit 5609b26 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Mar 1 19:41:57 2021 +0900 build(deps-dev): bump html-webpack-plugin from 4.5.1 to 5.2.0 (#130) Bumps [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin) from 4.5.1 to 5.2.0. - [Release notes](https://github.com/jantimon/html-webpack-plugin/releases) - [Changelog](https://github.com/jantimon/html-webpack-plugin/blob/main/CHANGELOG.md) - [Commits](jantimon/html-webpack-plugin@v4.5.1...v5.2.0) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit e45d792 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Mar 1 00:29:30 2021 +0900 build(deps-dev): bump @babel/preset-env from 7.12.16 to 7.13.8 (#134) commit bb6093c Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Mar 1 00:26:48 2021 +0900 build(deps-dev): bump @typescript-eslint/parser from 4.15.1 to 4.15.2 (#132) commit d899582 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Mar 1 00:21:37 2021 +0900 build(deps-dev): bump @babel/preset-react from 7.12.10 to 7.12.13 (#129) * fix: import resolve * fix: export component name * fix: component に型を持たせる * fix: import path name を resolve 名で指定 * fix: add jest の alias * feat: add CreatePost test * Squashed commit of the following: commit c655686 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat Mar 6 10:52:47 2021 +0900 build(deps-dev): bump is-ci from 2.0.0 to 3.0.0 (#140) commit 8fddef2 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat Mar 6 10:48:32 2021 +0900 build(deps-dev): bump css-loader from 5.0.1 to 5.1.1 (#139) commit ad98aaf Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat Mar 6 10:41:59 2021 +0900 build(deps-dev): bump fork-ts-checker-webpack-plugin from 6.1.0 to 6.1.1 (#138) commit 9a9f16e Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat Mar 6 10:35:52 2021 +0900 build(deps-dev): bump eslint-config-prettier from 7.2.0 to 8.1.0 (#137) commit 5609b26 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Mar 1 19:41:57 2021 +0900 build(deps-dev): bump html-webpack-plugin from 4.5.1 to 5.2.0 (#130) Bumps [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin) from 4.5.1 to 5.2.0. - [Release notes](https://github.com/jantimon/html-webpack-plugin/releases) - [Changelog](https://github.com/jantimon/html-webpack-plugin/blob/main/CHANGELOG.md) - [Commits](jantimon/html-webpack-plugin@v4.5.1...v5.2.0) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit e45d792 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Mar 1 00:29:30 2021 +0900 build(deps-dev): bump @babel/preset-env from 7.12.16 to 7.13.8 (#134) commit bb6093c Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Mar 1 00:26:48 2021 +0900 build(deps-dev): bump @typescript-eslint/parser from 4.15.1 to 4.15.2 (#132) commit d899582 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Mar 1 00:21:37 2021 +0900 build(deps-dev): bump @babel/preset-react from 7.12.10 to 7.12.13 (#129) * fix: dependabot ignore husky v5x * fix: edit page top * fix: component name * feat: add edit App test * feat: EditPostList の状態排除、Style * feat: EditPost * Squashed commit of the following: commit 8d3a7f0 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun Mar 14 01:40:16 2021 +0900 build(deps-dev): bump webpack-cli from 4.4.0 to 4.5.0 (#146) Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 4.4.0 to 4.5.0. - [Release notes](https://github.com/webpack/webpack-cli/releases) - [Changelog](https://github.com/webpack/webpack-cli/blob/master/CHANGELOG.md) - [Commits](https://github.com/webpack/webpack-cli/compare/webpack-cli@4.4.0...webpack-cli@4.5.0) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: hosono kotaro <hosono1985@gmail.com> commit 56bc5fa Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun Mar 14 01:32:37 2021 +0900 build(deps-dev): bump ts-jest from 26.5.1 to 26.5.3 (#145) Bumps [ts-jest](https://github.com/kulshekhar/ts-jest) from 26.5.1 to 26.5.3. - [Release notes](https://github.com/kulshekhar/ts-jest/releases) - [Changelog](https://github.com/kulshekhar/ts-jest/blob/master/CHANGELOG.md) - [Commits](kulshekhar/ts-jest@v26.5.1...v26.5.3) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit 7967d40 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun Mar 14 01:27:53 2021 +0900 build(deps-dev): bump stylelint from 13.9.0 to 13.12.0 (#144) Bumps [stylelint](https://github.com/stylelint/stylelint) from 13.9.0 to 13.12.0. - [Release notes](https://github.com/stylelint/stylelint/releases) - [Changelog](https://github.com/stylelint/stylelint/blob/master/CHANGELOG.md) - [Commits](stylelint/stylelint@13.9.0...13.12.0) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: hosono kotaro <hosono1985@gmail.com> commit 101e07e Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun Mar 14 01:10:01 2021 +0900 build(deps-dev): bump typescript from 4.1.3 to 4.2.3 (#143) Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.1.3 to 4.2.3. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Commits](microsoft/TypeScript@v4.1.3...v4.2.3) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: hosono kotaro <hosono1985@gmail.com> commit 267ddce Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun Mar 14 01:03:22 2021 +0900 build(deps-dev): bump cypress from 6.3.0 to 6.6.0 (#142) Bumps [cypress](https://github.com/cypress-io/cypress) from 6.3.0 to 6.6.0. - [Release notes](https://github.com/cypress-io/cypress/releases) - [Changelog](https://github.com/cypress-io/cypress/blob/develop/.releaserc.base.js) - [Commits](cypress-io/cypress@v6.3.0...v6.6.0) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit c655686 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat Mar 6 10:52:47 2021 +0900 build(deps-dev): bump is-ci from 2.0.0 to 3.0.0 (#140) commit 8fddef2 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat Mar 6 10:48:32 2021 +0900 build(deps-dev): bump css-loader from 5.0.1 to 5.1.1 (#139) commit ad98aaf Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat Mar 6 10:41:59 2021 +0900 build(deps-dev): bump fork-ts-checker-webpack-plugin from 6.1.0 to 6.1.1 (#138) commit 9a9f16e Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat Mar 6 10:35:52 2021 +0900 build(deps-dev): bump eslint-config-prettier from 7.2.0 to 8.1.0 (#137) commit 5609b26 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Mar 1 19:41:57 2021 +0900 build(deps-dev): bump html-webpack-plugin from 4.5.1 to 5.2.0 (#130) Bumps [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin) from 4.5.1 to 5.2.0. - [Release notes](https://github.com/jantimon/html-webpack-plugin/releases) - [Changelog](https://github.com/jantimon/html-webpack-plugin/blob/main/CHANGELOG.md) - [Commits](jantimon/html-webpack-plugin@v4.5.1...v5.2.0) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit e45d792 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Mar 1 00:29:30 2021 +0900 build(deps-dev): bump @babel/preset-env from 7.12.16 to 7.13.8 (#134) commit bb6093c Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Mar 1 00:26:48 2021 +0900 build(deps-dev): bump @typescript-eslint/parser from 4.15.1 to 4.15.2 (#132) commit d899582 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Mar 1 00:21:37 2021 +0900 build(deps-dev): bump @babel/preset-react from 7.12.10 to 7.12.13 (#129) * fix: edit spinner
1 parent 8d3a7f0 commit 90ab667

37 files changed

Lines changed: 23008 additions & 62 deletions

.babelrc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
{
22
"presets": [
3-
"@babel/preset-env",
3+
[
4+
"@babel/preset-env",
5+
{
6+
"useBuiltIns": "usage",
7+
"corejs": 3,
8+
"debug": true
9+
}
10+
],
411
"@babel/preset-react",
512
[
613
"@babel/preset-typescript",

.github/dependabot.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ updates:
77
interval: 'weekly'
88
day: 'saturday'
99
timezone: 'Asia/Tokyo'
10+
ignore:
11+
- dependency-name: "husky"
12+
# 5.x の新しいバージョンのみを無視する
13+
versions: ["5.x"]

jest.config.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
"preset": "ts-jest",
33
"moduleNameMapper": {
44
"^@App/(.*)$": "<rootDir>/src/$1",
5+
"^~/(.+)": "<rootDir>/src/$1",
6+
"^@/(.+)": "<rootDir>/src/components/$1",
57
".+\\.(css|scss)$": "identity-obj-proxy"
68
},
79
"setupFilesAfterEnv": ["@testing-library/jest-dom/extend-expect"],

package-lock.json

Lines changed: 21975 additions & 41 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
"license": "MIT",
2020
"devDependencies": {
2121
"@babel/core": "^7.12.10",
22-
"@babel/polyfill": "^7.12.1",
2322
"@babel/preset-env": "^7.13.8",
2423
"@babel/preset-react": "^7.12.13",
2524
"@babel/preset-typescript": "^7.12.17",
@@ -89,7 +88,10 @@
8988
"@types/mini-css-extract-plugin": "^1.2.2",
9089
"@types/react-redux": "^7.1.16",
9190
"axios": "^0.21.1",
91+
"core-js": "^3.9.0",
92+
"firebase": "^8.2.7",
9293
"lint-staged": "^10.5.4",
93-
"react-redux": "^7.2.2"
94+
"react-redux": "^7.2.2",
95+
"regenerator-runtime": "^0.13.7"
9496
}
9597
}

src/adapter/firebase.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import 'firebase/auth';
2+
3+
import firebase from 'firebase/app';
4+
5+
const firebaseConfig = {
6+
apiKey: 'AIzaSyBsC6ZAinkt3n3fB0B-Yo1UMqwqaoCzi4s',
7+
authDomain: 'hosonokotaro-blog.firebaseapp.com',
8+
databaseURL: 'https://hosonokotaro-blog.firebaseio.com',
9+
projectId: 'hosonokotaro-blog',
10+
storageBucket: 'hosonokotaro-blog.appspot.com',
11+
messagingSenderId: '23911354523',
12+
appId: '1:23911354523:web:56bec2eb2bf7d1b712f63e',
13+
};
14+
15+
firebase.initializeApp(firebaseConfig);
16+
17+
// NOTE: firebase 認証機能を利用する
18+
export const Auth = firebase.auth();
19+
20+
// NOTE: Google 認証を利用する
21+
export const GoogleAuthProvider = new firebase.auth.GoogleAuthProvider();
22+
23+
export type User = firebase.User;
24+
25+
export default firebase;

src/components/CreatePost.test.tsx

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import '@testing-library/jest-dom/extend-expect';
2+
3+
import React from 'react';
4+
5+
import { render, screen } from '~/testUtil';
6+
7+
import CreatePost from './CreatePost';
8+
9+
const handleSubmit = jest.fn();
10+
const onTitleChanged = jest.fn();
11+
12+
it('it should render: CreatePost の input area に入れた文字が表示される', () => {
13+
const title = 'test title';
14+
const canSaveNewPost = true;
15+
16+
render(
17+
<CreatePost
18+
title={title}
19+
handleSubmit={handleSubmit}
20+
onTitleChanged={onTitleChanged}
21+
canSaveNewPost={canSaveNewPost}
22+
/>
23+
);
24+
25+
expect(screen.getByRole('textbox').getAttribute('value')).toEqual(title);
26+
});
27+
28+
it('it should render: CreatePost の input area に入れた文字が表示されない', () => {
29+
const title = '';
30+
const canSaveNewPost = false;
31+
32+
render(
33+
<CreatePost
34+
title={title}
35+
handleSubmit={handleSubmit}
36+
onTitleChanged={onTitleChanged}
37+
canSaveNewPost={canSaveNewPost}
38+
/>
39+
);
40+
41+
expect(screen.getByRole('textbox').getAttribute('value')).toEqual(title);
42+
});

src/components/CreatePost.tsx

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import React from 'react';
2+
3+
import {
4+
StyledButton,
5+
StyledInputText,
6+
StyledLabel,
7+
StyledSection,
8+
StyledWrapper,
9+
} from './styledCreatePost';
10+
11+
export interface Props {
12+
title: string;
13+
handleSubmit: () => void;
14+
onTitleChanged: (e: React.ChangeEvent<HTMLInputElement>) => void;
15+
canSaveNewPost: boolean;
16+
}
17+
18+
const CreatePost: React.FC<Props> = ({
19+
title,
20+
handleSubmit,
21+
onTitleChanged,
22+
canSaveNewPost,
23+
}) => {
24+
return (
25+
<StyledSection>
26+
<h2>記事の新規作成</h2>
27+
<StyledWrapper>
28+
<form>
29+
<StyledLabel htmlFor="postTitle">タイトル</StyledLabel>
30+
<StyledInputText
31+
type="text"
32+
id="postTitle"
33+
name="postTitle"
34+
value={title}
35+
onChange={onTitleChanged}
36+
/>
37+
</form>
38+
<StyledButton onClick={handleSubmit} disabled={!canSaveNewPost}>
39+
記事を準備する
40+
</StyledButton>
41+
</StyledWrapper>
42+
</StyledSection>
43+
);
44+
};
45+
46+
export default CreatePost;
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import '@testing-library/jest-dom/extend-expect';
2+
3+
import React from 'react';
4+
// NOTE: React Router をテストする場合は MemoryRouter を使用する
5+
import { Link, MemoryRouter } from 'react-router-dom';
6+
7+
import { render, screen } from '~/testUtil';
8+
9+
import EditPostList, { Post } from './EditPostList';
10+
11+
const postList: Post[] = [
12+
{
13+
id: 'a1b2c3',
14+
release: true,
15+
createDate: '2021年1月10日 00:57',
16+
routerLink: <Link to="/edit/a1b2c3">test title</Link>,
17+
},
18+
{
19+
id: 'b2c3d4',
20+
release: true,
21+
createDate: '2021年1月11日 00:57',
22+
routerLink: <Link to="/edit/b2c3d4">test title2</Link>,
23+
},
24+
];
25+
26+
it('should render: EditPostList に投稿記事一覧の各リンクが存在するか', () => {
27+
render(
28+
<MemoryRouter>
29+
<EditPostList postList={postList} />
30+
</MemoryRouter>
31+
);
32+
33+
expect(screen.getAllByRole('link')).toHaveLength(postList.length);
34+
});

src/components/EditPostList.tsx

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import React from 'react';
2+
3+
import {
4+
StyledPost,
5+
StyledPosts,
6+
StyledSection,
7+
StyledTimestamp,
8+
} from './styledEditPostList';
9+
10+
export interface Post {
11+
id: string;
12+
release: boolean;
13+
createDate: string;
14+
routerLink: React.ReactNode;
15+
}
16+
17+
interface Props {
18+
postList: Post[];
19+
}
20+
21+
// TODO: どこかの処理で、release が false の状態だと弾く処理が入っているようだ
22+
const EditPostList: React.FC<Props> = ({ postList }) => {
23+
return (
24+
<StyledSection>
25+
<h2>投稿された記事一覧</h2>
26+
<StyledPosts>
27+
{postList.map(({ id, release, createDate, routerLink }) => (
28+
<StyledPost key={id}>
29+
<div>
30+
{!release && <span>【非公開】</span>}
31+
{routerLink}
32+
</div>
33+
<StyledTimestamp>
34+
作成日時: {createDate}
35+
<br />
36+
id: {id}
37+
</StyledTimestamp>
38+
</StyledPost>
39+
))}
40+
</StyledPosts>
41+
</StyledSection>
42+
);
43+
};
44+
45+
export default EditPostList;

0 commit comments

Comments
 (0)