From f1bc3f72f5a9c67f23ed904f803e6174f334566a Mon Sep 17 00:00:00 2001 From: haru Date: Sun, 24 Oct 2021 10:32:50 +0900 Subject: [PATCH 01/18] initial commit From f891dbc9b6678d5125c415a4583bc9d6459494eb Mon Sep 17 00:00:00 2001 From: haru Date: Sun, 24 Oct 2021 11:36:36 +0900 Subject: [PATCH 02/18] initial commit --- .vscode/settings.json | 11 +++++++++++ amplify/README.md | 8 ++++++++ amplify/hooks/README.md | 7 +++++++ amplify/hooks/post-push.sh.sample | 24 ++++++++++++++++++++++++ amplify/hooks/pre-push.js.sample | 27 +++++++++++++++++++++++++++ 5 files changed, 77 insertions(+) create mode 100644 .vscode/settings.json create mode 100644 amplify/README.md create mode 100644 amplify/hooks/README.md create mode 100644 amplify/hooks/post-push.sh.sample create mode 100644 amplify/hooks/pre-push.js.sample diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..c87b85e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,11 @@ +{ + "files.exclude": { + "amplify/.config": true, + "amplify/**/*-parameters.json": true, + "amplify/**/amplify.state": true, + "amplify/**/transform.conf.json": true, + "amplify/#current-cloud-backend": true, + "amplify/backend/amplify-meta.json": true, + "amplify/backend/awscloudformation": true + } +} \ No newline at end of file diff --git a/amplify/README.md b/amplify/README.md new file mode 100644 index 0000000..7c0a9e2 --- /dev/null +++ b/amplify/README.md @@ -0,0 +1,8 @@ +# Getting Started with Amplify CLI +This directory was generated by [Amplify CLI](https://docs.amplify.aws/cli). + +Helpful resources: +- Amplify documentation: https://docs.amplify.aws +- Amplify CLI documentation: https://docs.amplify.aws/cli +- More details on this folder & generated files: https://docs.amplify.aws/cli/reference/files +- Join Amplify's community: https://amplify.aws/community/ diff --git a/amplify/hooks/README.md b/amplify/hooks/README.md new file mode 100644 index 0000000..8fb601e --- /dev/null +++ b/amplify/hooks/README.md @@ -0,0 +1,7 @@ +# Command Hooks + +Command hooks can be used to run custom scripts upon Amplify CLI lifecycle events like pre-push, post-add-function, etc. + +To get started, add your script files based on the expected naming convention in this directory. + +Learn more about the script file naming convention, hook parameters, third party dependencies, and advanced configurations at https://docs.amplify.aws/cli/usage/command-hooks diff --git a/amplify/hooks/post-push.sh.sample b/amplify/hooks/post-push.sh.sample new file mode 100644 index 0000000..20df3f3 --- /dev/null +++ b/amplify/hooks/post-push.sh.sample @@ -0,0 +1,24 @@ +# This is a sample hook script created by Amplify CLI. +# To start using this post-push hook please change the filename: +# post-push.sh.sample -> post-push.sh +# +# learn more: https://docs.amplify.aws/cli/usage/command-hooks + +if [ -z "$(which jq)" ]; then + echo "Please install jq to run the sample script." + exit 0 +fi + +parameters=`cat` +error=$(jq -r '.error // empty' <<< "$parameters") +data=$(jq -r '.data' <<< "$parameters") + +# +# Write code here: +# +if [ ! -z "$error" ]; then + echo "Amplify CLI emitted an error:" $(jq -r '.message' <<< "$error") + exit 0 +fi +echo "project root path:" $(pwd); +echo "Amplify CLI command:" $(jq -r '.amplify | .command' <<< "$data") \ No newline at end of file diff --git a/amplify/hooks/pre-push.js.sample b/amplify/hooks/pre-push.js.sample new file mode 100644 index 0000000..402e8f9 --- /dev/null +++ b/amplify/hooks/pre-push.js.sample @@ -0,0 +1,27 @@ +/** + * This is a sample hook script created by Amplify CLI. + * To start using this pre-push hook please change the filename: + * pre-push.js.sample -> pre-push.js + * + * learn more: https://docs.amplify.aws/cli/usage/command-hooks + */ + +/** + * @param data { { amplify: { environment: string, command: string, subCommand: string, argv: string[] } } } + * @param error { { message: string, stack: string } } + */ +const hookHandler = async (data, error) => { + // TODO write your hook handler here +}; + +const getParameters = async () => { + const fs = require("fs"); + return JSON.parse(fs.readFileSync(0, { encoding: "utf8" })); +}; + +getParameters() + .then((event) => hookHandler(event.data, event.error)) + .catch((err) => { + console.error(err); + process.exitCode = 1; + }); From bf092e8c6840459f153d915aba5d7cb2f92e265d Mon Sep 17 00:00:00 2001 From: haru Date: Sun, 24 Oct 2021 11:47:33 +0900 Subject: [PATCH 03/18] change header and width --- src/Container.js | 2 +- src/Header.js | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Container.js b/src/Container.js index 71b2e70..a165afc 100644 --- a/src/Container.js +++ b/src/Container.js @@ -11,7 +11,7 @@ function Container({ children }) { const styles = { container: { - width: 900, + width: auto, margin: '0 auto', '& h1': { textAlign: 'left' diff --git a/src/Header.js b/src/Header.js index 538e5ea..d98c00a 100644 --- a/src/Header.js +++ b/src/Header.js @@ -14,9 +14,6 @@ class Header extends React.Component { style={styles.amplifyLogo} src={require('./assets/amplifywhite.png')} /> - -

AWS Amplify Auth Starter

-

Home

From bb6bd7d4ef2063f3b52ed7916d4f5038351d5c52 Mon Sep 17 00:00:00 2001 From: haru Date: Sun, 24 Oct 2021 11:57:44 +0900 Subject: [PATCH 04/18] change container width --- src/Container.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Container.js b/src/Container.js index a165afc..b66d983 100644 --- a/src/Container.js +++ b/src/Container.js @@ -11,7 +11,7 @@ function Container({ children }) { const styles = { container: { - width: auto, + width: 400, margin: '0 auto', '& h1': { textAlign: 'left' From 8a6604acdcfc9e3b3f8eac0af1dd1414da0ee317 Mon Sep 17 00:00:00 2001 From: haru Date: Sun, 24 Oct 2021 12:09:39 +0900 Subject: [PATCH 05/18] Changed sign in prompt --- src/Authenticator.js | 4 ++-- src/SignIn.js | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Authenticator.js b/src/Authenticator.js index ca7f982..e05771d 100644 --- a/src/Authenticator.js +++ b/src/Authenticator.js @@ -32,11 +32,11 @@ class Authenticator extends React.Component {

this.switchState('showSignUp')} {...css(styles.toggle)} - >Need an account? Sign Up

+ >新規登録

this.switchState('showForgotPassword')} {...css(styles.toggle)} - >Forgot your password?

+ >パスワードをお忘れですか?

) : (
diff --git a/src/SignIn.js b/src/SignIn.js index cfb781d..306f573 100644 --- a/src/SignIn.js +++ b/src/SignIn.js @@ -49,21 +49,20 @@ class SignIn extends React.Component { { !this.state.showConfirmation && (
-

Sign In

this.onChange('username', evt.target.value)} {...css(styles.input)} - placeholder='username' + placeholder='ユーザー名' /> this.onChange('password', evt.target.value)} {...css(styles.input)} - placeholder='password' + placeholder='パスワード' />
-

Sign In

+

ログイン

) @@ -71,13 +70,14 @@ class SignIn extends React.Component { { this.state.showConfirmation && (
+

Sign In

this.onChange('authCode', evt.target.value)} {...css(styles.input)} - placeholder='Confirmation Code' + placeholder='認証コード' />
-

Confirm Sign In

+

ログイン

) From 165afada5f72a27d4dddffd1e787d99eb6b52eaa Mon Sep 17 00:00:00 2001 From: haru Date: Sun, 24 Oct 2021 12:19:34 +0900 Subject: [PATCH 06/18] Changed to Japanese --- src/Authenticator.js | 2 +- src/ForgotPassword.js | 11 +++++------ src/SignUp.js | 15 ++++++++------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Authenticator.js b/src/Authenticator.js index e05771d..8703d66 100644 --- a/src/Authenticator.js +++ b/src/Authenticator.js @@ -43,7 +43,7 @@ class Authenticator extends React.Component {

this.switchState('showSignIn')} - >Already have an account? Sign In

+ >すでにアカウントをお持ちの方はこちら

) } diff --git a/src/ForgotPassword.js b/src/ForgotPassword.js index e38ea18..85d4cb8 100644 --- a/src/ForgotPassword.js +++ b/src/ForgotPassword.js @@ -39,15 +39,14 @@ class ForgotPassword extends React.Component { { !this.state.showConfirmation && (
-

Forgot Password?

this.onChange('username', evt.target.value)} {...css(styles.input)} - placeholder='username' + placeholder='メールアドレス又は電話番号' />
-

Get Authentication Code

+

認証コードを送る

) @@ -58,16 +57,16 @@ class ForgotPassword extends React.Component { this.onChange('confirmationCode', evt.target.value)} {...css(styles.input)} - placeholder='Confirmation Code' + placeholder='認証コード' /> this.onChange('password', evt.target.value)} {...css(styles.input)} type='password' - placeholder='New Password' + placeholder='新しいパスワード' />
-

Reset Password

+

パスワードの再設定

) diff --git a/src/SignUp.js b/src/SignUp.js index 65a0783..114dd53 100644 --- a/src/SignUp.js +++ b/src/SignUp.js @@ -46,21 +46,21 @@ class SignUp extends React.Component { { !showConfirmation && (
-

Sign Up

+

新規登録

this.onChange('username', evt.target.value)} /> this.onChange('password', evt.target.value)} /> this.onChange('email', evt.target.value)} /> {/* @@ -71,7 +71,7 @@ class SignUp extends React.Component { onChange={evt => this.onChange('phone_number', evt.target.value)} /> */}
-

Sign Up

+

新規登録

) @@ -79,13 +79,14 @@ class SignUp extends React.Component { { showConfirmation && (
+

認証コード入力

this.onChange('authCode', evt.target.value)} {...css(styles.input)} - placeholder='Confirmation Code' + placeholder='認証コード' />
-

Confirm Sign Up

+

登録する

) From 4436b6aa7459dbec721d4217dc1e7e871860cc4b Mon Sep 17 00:00:00 2001 From: haru Date: Sun, 24 Oct 2021 13:15:34 +0900 Subject: [PATCH 07/18] Change appearance --- src/Container.js | 1 - src/Header.js | 18 ++++++++++++------ src/SignIn.js | 4 ++-- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/Container.js b/src/Container.js index b66d983..10ec745 100644 --- a/src/Container.js +++ b/src/Container.js @@ -11,7 +11,6 @@ function Container({ children }) { const styles = { container: { - width: 400, margin: '0 auto', '& h1': { textAlign: 'left' diff --git a/src/Header.js b/src/Header.js index d98c00a..2d829a7 100644 --- a/src/Header.js +++ b/src/Header.js @@ -16,19 +16,25 @@ class Header extends React.Component { />
-

Home

- - -

Private

+

ホーム

+ { isLoaded ? isAuthenticated ? ( +
+ +

プロフィール

+ + +

掲示板

+ -

Profile

+

メール

+
) : ( -

Sign In

+

ログイン

) : null } diff --git a/src/SignIn.js b/src/SignIn.js index 306f573..ab77150 100644 --- a/src/SignIn.js +++ b/src/SignIn.js @@ -32,7 +32,7 @@ class SignIn extends React.Component { }) .catch(err => { console.log('error signing in...: ', err) - this.props.updateErrorMessage(err.message) + this.props.updateErrorMessage('メールアドレス、電話番号又はパスワードが違います') }) } confirmSignIn = () => { @@ -52,7 +52,7 @@ class SignIn extends React.Component { this.onChange('username', evt.target.value)} {...css(styles.input)} - placeholder='ユーザー名' + placeholder='メールアドレス又は電話番号' /> Date: Sun, 24 Oct 2021 13:28:13 +0900 Subject: [PATCH 08/18] Change Header --- src/Header.js | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/Header.js b/src/Header.js index 2d829a7..a5c3bff 100644 --- a/src/Header.js +++ b/src/Header.js @@ -10,20 +10,12 @@ class Header extends React.Component { const isLoaded = this.context.isLoaded return (
-
- -

ホーム

- - { isLoaded ? isAuthenticated ? (
-

プロフィール

+

検索

掲示板

@@ -31,6 +23,9 @@ class Header extends React.Component {

メール

+ +

ホーム

+
) : ( @@ -59,7 +54,7 @@ const styles = { navContainer: { display: 'flex', flex: 1, - paddingLeft: 50, + paddingLeft: 10, marginTop: 6 }, link: { @@ -75,7 +70,7 @@ const styles = { } }, container: { - height: '80px', + height: '50px', alignItems: 'center', width: '100%', backgroundColor: '#FF9900', From 8da254dc281a2805fff7230eaf950613c597b4ed Mon Sep 17 00:00:00 2001 From: haru Date: Sun, 24 Oct 2021 13:35:01 +0900 Subject: [PATCH 09/18] Remodified header --- src/Header.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Header.js b/src/Header.js index a5c3bff..2d829a7 100644 --- a/src/Header.js +++ b/src/Header.js @@ -10,12 +10,20 @@ class Header extends React.Component { const isLoaded = this.context.isLoaded return (
+
+ +

ホーム

+ + { isLoaded ? isAuthenticated ? (
-

検索

+

プロフィール

掲示板

@@ -23,9 +31,6 @@ class Header extends React.Component {

メール

- -

ホーム

-
) : ( @@ -54,7 +59,7 @@ const styles = { navContainer: { display: 'flex', flex: 1, - paddingLeft: 10, + paddingLeft: 50, marginTop: 6 }, link: { @@ -70,7 +75,7 @@ const styles = { } }, container: { - height: '50px', + height: '80px', alignItems: 'center', width: '100%', backgroundColor: '#FF9900', From 8fd2b3ba908e2f9808da27e756737897add25ef6 Mon Sep 17 00:00:00 2001 From: haru Date: Sun, 24 Oct 2021 13:41:39 +0900 Subject: [PATCH 10/18] modified again in header --- src/Container.js | 1 + src/Header.js | 33 ++++++++++++++------------------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/Container.js b/src/Container.js index 10ec745..26a33b3 100644 --- a/src/Container.js +++ b/src/Container.js @@ -11,6 +11,7 @@ function Container({ children }) { const styles = { container: { + width : 900, margin: '0 auto', '& h1': { textAlign: 'left' diff --git a/src/Header.js b/src/Header.js index 2d829a7..cd97b03 100644 --- a/src/Header.js +++ b/src/Header.js @@ -10,18 +10,9 @@ class Header extends React.Component { const isLoaded = this.context.isLoaded return (
- -
- -

ホーム

- - - { - isLoaded ? isAuthenticated ? ( -
+ { + isLoaded ? isAuthenticated ? ( +

プロフィール

@@ -31,14 +22,18 @@ class Header extends React.Component {

メール

-
- ) : ( + +

ホーム

+ +
+ ) : ( +

ログイン

- ) : null - } -
+
+ ) : null + }
) } @@ -59,7 +54,7 @@ const styles = { navContainer: { display: 'flex', flex: 1, - paddingLeft: 50, + paddingLeft: 10, marginTop: 6 }, link: { @@ -75,7 +70,7 @@ const styles = { } }, container: { - height: '80px', + height: '50px', alignItems: 'center', width: '100%', backgroundColor: '#FF9900', From 9db1e63c150e4b89cefe1c2af4ffa26c07df48a9 Mon Sep 17 00:00:00 2001 From: haru Date: Sun, 24 Oct 2021 13:49:29 +0900 Subject: [PATCH 11/18] Modified Header --- src/Container.js | 1 - src/Header.js | 41 ++++++++++++++++++++--------------------- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/src/Container.js b/src/Container.js index 26a33b3..10ec745 100644 --- a/src/Container.js +++ b/src/Container.js @@ -11,7 +11,6 @@ function Container({ children }) { const styles = { container: { - width : 900, margin: '0 auto', '& h1': { textAlign: 'left' diff --git a/src/Header.js b/src/Header.js index cd97b03..0a77fa5 100644 --- a/src/Header.js +++ b/src/Header.js @@ -10,30 +10,29 @@ class Header extends React.Component { const isLoaded = this.context.isLoaded return (
- { - isLoaded ? isAuthenticated ? ( -
- -

プロフィール

- - -

掲示板

- + +
+ +

ホーム

+ + +

Private

+ + { + isLoaded ? isAuthenticated ? ( -

メール

- - -

ホーム

+

Profile

-
- ) : ( -
+ ) : (

ログイン

-
- ) : null - } + ) : null + } +
) } @@ -54,7 +53,7 @@ const styles = { navContainer: { display: 'flex', flex: 1, - paddingLeft: 10, + paddingLeft: 50, marginTop: 6 }, link: { @@ -70,7 +69,7 @@ const styles = { } }, container: { - height: '50px', + height: '80px', alignItems: 'center', width: '100%', backgroundColor: '#FF9900', From d0f443eabeb48cb45e62982327fa825252a83c6c Mon Sep 17 00:00:00 2001 From: haru Date: Sun, 24 Oct 2021 14:12:49 +0900 Subject: [PATCH 12/18] Revert to success --- src/Container.js | 1 - src/Header.js | 4 ++-- src/SignIn.js | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Container.js b/src/Container.js index b66d983..10ec745 100644 --- a/src/Container.js +++ b/src/Container.js @@ -11,7 +11,6 @@ function Container({ children }) { const styles = { container: { - width: 400, margin: '0 auto', '& h1': { textAlign: 'left' diff --git a/src/Header.js b/src/Header.js index d98c00a..0a77fa5 100644 --- a/src/Header.js +++ b/src/Header.js @@ -16,7 +16,7 @@ class Header extends React.Component { />
-

Home

+

ホーム

Private

@@ -28,7 +28,7 @@ class Header extends React.Component { ) : ( -

Sign In

+

ログイン

) : null } diff --git a/src/SignIn.js b/src/SignIn.js index 306f573..ab77150 100644 --- a/src/SignIn.js +++ b/src/SignIn.js @@ -32,7 +32,7 @@ class SignIn extends React.Component { }) .catch(err => { console.log('error signing in...: ', err) - this.props.updateErrorMessage(err.message) + this.props.updateErrorMessage('メールアドレス、電話番号又はパスワードが違います') }) } confirmSignIn = () => { @@ -52,7 +52,7 @@ class SignIn extends React.Component { this.onChange('username', evt.target.value)} {...css(styles.input)} - placeholder='ユーザー名' + placeholder='メールアドレス又は電話番号' /> Date: Sun, 24 Oct 2021 14:18:22 +0900 Subject: [PATCH 13/18] Revert "Revert to success" This reverts commit d0f443eabeb48cb45e62982327fa825252a83c6c. --- src/Container.js | 1 + src/Header.js | 4 ++-- src/SignIn.js | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Container.js b/src/Container.js index 10ec745..b66d983 100644 --- a/src/Container.js +++ b/src/Container.js @@ -11,6 +11,7 @@ function Container({ children }) { const styles = { container: { + width: 400, margin: '0 auto', '& h1': { textAlign: 'left' diff --git a/src/Header.js b/src/Header.js index 0a77fa5..d98c00a 100644 --- a/src/Header.js +++ b/src/Header.js @@ -16,7 +16,7 @@ class Header extends React.Component { />
-

ホーム

+

Home

Private

@@ -28,7 +28,7 @@ class Header extends React.Component { ) : ( -

ログイン

+

Sign In

) : null } diff --git a/src/SignIn.js b/src/SignIn.js index ab77150..306f573 100644 --- a/src/SignIn.js +++ b/src/SignIn.js @@ -32,7 +32,7 @@ class SignIn extends React.Component { }) .catch(err => { console.log('error signing in...: ', err) - this.props.updateErrorMessage('メールアドレス、電話番号又はパスワードが違います') + this.props.updateErrorMessage(err.message) }) } confirmSignIn = () => { @@ -52,7 +52,7 @@ class SignIn extends React.Component { this.onChange('username', evt.target.value)} {...css(styles.input)} - placeholder='メールアドレス又は電話番号' + placeholder='ユーザー名' /> Date: Sun, 24 Oct 2021 14:26:24 +0900 Subject: [PATCH 14/18] Change header --- src/Header.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Header.js b/src/Header.js index d98c00a..7ac53e2 100644 --- a/src/Header.js +++ b/src/Header.js @@ -10,10 +10,6 @@ class Header extends React.Component { const isLoaded = this.context.isLoaded return (
-

Home

@@ -53,7 +49,7 @@ const styles = { navContainer: { display: 'flex', flex: 1, - paddingLeft: 50, + paddingLeft: 10, marginTop: 6 }, link: { @@ -69,7 +65,7 @@ const styles = { } }, container: { - height: '80px', + height: '50px', alignItems: 'center', width: '100%', backgroundColor: '#FF9900', From aa2561bfd9b03d6d7737c44bdebd278903e7cfe1 Mon Sep 17 00:00:00 2001 From: haru Date: Sun, 24 Oct 2021 14:37:10 +0900 Subject: [PATCH 15/18] Change header and width --- src/Container.js | 1 - src/Header.js | 12 ++++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Container.js b/src/Container.js index b66d983..10ec745 100644 --- a/src/Container.js +++ b/src/Container.js @@ -11,7 +11,6 @@ function Container({ children }) { const styles = { container: { - width: 400, margin: '0 auto', '& h1': { textAlign: 'left' diff --git a/src/Header.js b/src/Header.js index 7ac53e2..2de176a 100644 --- a/src/Header.js +++ b/src/Header.js @@ -11,12 +11,6 @@ class Header extends React.Component { return (
- -

Home

- - -

Private

- { isLoaded ? isAuthenticated ? ( @@ -28,6 +22,12 @@ class Header extends React.Component { ) : null } + +

Home

+ + +

Private

+
) From eab5b358fe5edd468a08a5e785cc09bd4b898e71 Mon Sep 17 00:00:00 2001 From: haru Date: Sun, 24 Oct 2021 14:46:48 +0900 Subject: [PATCH 16/18] Change header --- src/Header.js | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/Header.js b/src/Header.js index 2de176a..6ef3137 100644 --- a/src/Header.js +++ b/src/Header.js @@ -13,21 +13,24 @@ class Header extends React.Component {
{ isLoaded ? isAuthenticated ? ( - -

Profile

- + <> + +

Profile

+ + +

ホーム

+ + +

Private

+ + ) : ( -

Sign In

+

ログイン

) : null } - -

Home

- - -

Private

- +
) From ee1158028a7a66fed9de2bf6605eb41ff599e0a1 Mon Sep 17 00:00:00 2001 From: haru Date: Sun, 24 Oct 2021 14:54:25 +0900 Subject: [PATCH 17/18] Update header --- src/Header.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Header.js b/src/Header.js index 6ef3137..054e30c 100644 --- a/src/Header.js +++ b/src/Header.js @@ -15,13 +15,13 @@ class Header extends React.Component { isLoaded ? isAuthenticated ? ( <> -

Profile

+

検索

-

ホーム

+

掲示板

-

Private

+

メール

) : ( From 8a9b0ebeca01c8a4336a62f24632ca1fc24c628c Mon Sep 17 00:00:00 2001 From: haru Date: Sun, 31 Oct 2021 10:20:11 +0900 Subject: [PATCH 18/18] Change private page --- src/Private.js | 109 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 107 insertions(+), 2 deletions(-) diff --git a/src/Private.js b/src/Private.js index b7af2b4..243e9ab 100644 --- a/src/Private.js +++ b/src/Private.js @@ -1,15 +1,120 @@ import React from 'react' - +import { css } from 'glamor' import Container from './Container' +import UserContext from './UserContext' class Private extends React.Component { + state = { + message: '', + receiverID: '' + } + + static contextType = UserContext + + sendMsg = () => { + // var docClient = new AWS.DynamoDB.DocumentClient(); + // var params = { + // TableName: Chatting001, + // Item:{ + // identityId: identityId, // ★prime partition key + // email: _self.state.email, + // username: _self.state.username, + // filename: filepath, + // thumbnail: thumbnail, + // type: fileType, + // title: title, + // story: story, + // imageOverwrite: _self.state.imageOverwrite, + // mapUse: _self.state.mapUse, + // position: _self.state.position, + // uploadTime: uploadTime, // ★prime & secondary sort key + // uploadDate: uploadDate, + // partitionYear: partitionYear, //★secondary partition key + // refCounter: 0 + // } + // }; + // docClient.put(params, function(err, data) { + // if(err) { + // console.log("Err: table put :" +err); + // } else { + // console.log("Success: table put ok"); + // } + // }); + } + + onChange = (key, value) => { + this.props.updateErrorMessage(null) + this.setState({ + [key]: value + }) + } + render() { return ( -

Private Route

+

メッセージ

+ +
+ { +
+ this.onChange('message', evt.target.value)} + {...css(styles.input)} + placeholder='メッセージ' + /> +
+

送信

+
+
+ } +
) } } +const styles = { + button: { + padding: '10px 60px', + backgroundColor: '#ffb102', + marginTop: 10, + marginBottom: 10, + cursor: 'pointer', + borderRadius: '30px', + ':hover': { + backgroundColor: '#ffbb22' + } + }, + buttonText: { + margin: 0, + color: 'white' + }, + input: { + height: 40, + marginBottom: '10px', + border: 'none', + outline: 'none', + borderBottom: '2px solid #ffb102', + fontSize: '16px', + '::placeholder': { + color: 'rgba(0, 0, 0, .3)' + } + }, + container: { + flex: 1, + paddingTop: '15px', + display: 'flex', + flexDirection: 'column', + alignItems: 'center' + }, + formContainer: { + padding: 20, + width: 400, + display: 'flex', + flexDirection: 'column', + boxShadow: "0px 0px 2px rgba(0, 0, 0, .2)", + borderRadius: 20 + } +} + export default Private