Skip to content

birthdayPageの作成#89

Merged
TsubasaOura merged 6 commits intodevelopfrom
feature/fujisaki/87-create-birthdat.tsx
Jul 12, 2023
Merged

birthdayPageの作成#89
TsubasaOura merged 6 commits intodevelopfrom
feature/fujisaki/87-create-birthdat.tsx

Conversation

@ryuseifujisaki
Copy link
Copy Markdown
Contributor

@ryuseifujisaki ryuseifujisaki commented Jul 3, 2023

対応 Issue

resolve #87

概要

birthdayページの作成を行いました。

MUI Date Pickerを利用して実装しました。

## なぜData Pickerを利用したか?
Date Calendarを公式通り実装したが、どうしてもHydration Errorが消す事ができなかったため、Data Pickerを利用した。
Hydration Errorを消せるなら、Date Calendarを利用するのが良さそう

レビュー後の実装↓

Date Calendarでの実装 fb999b7

Date Calendarを利用して、日時の選択を可能にした。
image

ボタンのデザインとポジションの修正 783a230 5b7f15c

  • ボタンのデザインを以下に修正
    variant="contained"
  • 右下に配置
position: "absolute",
bottom: "-200px",

image

今後実装するもの

  • 誕生日を保存する機能の実装
    現時点では、保存ボタンを押すと、カレンダーで選択した日をコンソールに出力する処理になっています。
    APIが存在するなら実装するので、言ってください。🙇

  • 登録してある誕生日の取得機能の実装
    現時点は2020年8月21日で定義しています。

テスト項目

  • 誕生日を選択することができ、コンソールに出力されるか
  • デザイン面について
  • コード面について

URL・スクリーンショット

備考

今回起きた不具合として、host.docker.internalで利用するポートが別のサービスと重複しているとkeycloak関連で動かなくなるので注意する。

@github-actions github-actions Bot added frontend Next.jsやKeycloakのテーマに関して enhancement 新しい機能またはリクエスト labels Jul 3, 2023
@TsubasaOura
Copy link
Copy Markdown

TsubasaOura commented Jul 4, 2023

  • Rebaseお願いします
  • date-calender使えそう
<LocalizationProvider dateAdapter={AdapterDayjs}>
  <DateCalendar
    value={birthday}
    onChange={(newBirthday) => setBirthday(newBirthday)}
  />
</LocalizationProvider>
<Button variant="contained" 
  • 保存・キャンセルボタンはカードの右下揃えで配置したい

@ryuseifujisaki ryuseifujisaki force-pushed the feature/fujisaki/87-create-birthdat.tsx branch from dc47081 to 2977a0d Compare July 5, 2023 02:11
Copy link
Copy Markdown

@TsubasaOura TsubasaOura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ryuseifujisaki ryuseifujisaki force-pushed the feature/fujisaki/87-create-birthdat.tsx branch from 2977a0d to 5b7f15c Compare July 11, 2023 10:02
@ryuseifujisaki
Copy link
Copy Markdown
Contributor Author

コメントされたものは基本的に修正したので確認お願いします。🙇

Copy link
Copy Markdown

@TsubasaOura TsubasaOura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebaseでほしいとこが消されてしまってそう

Comment thread frontend/package.json
"dev": "next dev -p 12345",
"dev": "next dev",
"build": "next build",
"start": "next start -p 12345",
Copy link
Copy Markdown

@TsubasaOura TsubasaOura Jul 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

devと同様

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

理解

Comment thread frontend/package.json
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev -p 12345",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これ消したら動かなそう

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

理解

Comment thread frontend/src/pages/birthday.tsx
};

return (
<DetailLayout {...details}>
Copy link
Copy Markdown

@TsubasaOura TsubasaOura Jul 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここで詳細を適応してます!

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

動くので今回はマージします!
が、
{...details}
のスプレッド構文って書き方魅力的なので
目を通しておくとよき
https://qiita.com/Yametaro/items/814f40d08e9d30584e20#props%E3%81%AF%E3%82%B9%E3%83%97%E3%83%AC%E3%83%83%E3%83%89%E6%A7%8B%E6%96%87%E3%81%A7%E6%B8%A1%E3%81%9B%E3%82%8B

Comment thread frontend/src/pages/birthday.tsx Outdated
Comment on lines +15 to +20
const details = {
// TODO: 今後constansに移行する
title: "生年月日",
description:
"生年月日は、Google サービスでアカウントのセキュリティ保護とカスタマイズに使用される場合があります。 この Google アカウントを企業または組織で使用する場合は、アカウントの管理者の生年月日を指定してください。",
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

constansに移行したので削除でおけ!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

理解

Comment thread frontend/src/pages/birthday.tsx Outdated
sx={{
width: 1,
maxWidth: 589,
position: "absolute",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

absoluteは親要素とか無視して
「絶対ここに配置」
みたいな挙動になるから良くないかも

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

relativeとabsolute完全に理解した
https://qiita.com/ChiJ_SeaW/items/b18b2dc98443ab988ecb

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

relativeにして、親要素のbottomから40px離れた場所に設定

Comment thread frontend/src/pages/birthday.tsx Outdated
<Button onClick={() => handleClick("/")}>Return to Home</Button>
<DetailLayout title={details.title} description={details.description}>
<div className="pt-4">
<div className="h-screen w-full items-center justify-center">
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここでh-screenを使用するとdetailLayoutのカード全体がPCの画面の縦幅になるから
ヘッダーとかを合わせるとPCの画面以上の縦幅になり
余計なスクロールが発生してしまう

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

h-autoで中の要素に合わせるように設定

Comment thread frontend/src/pages/birthday.tsx Outdated
import { LocalizationProvider } from "@mui/x-date-pickers";
import { AdapterDateFns } from "@mui/x-date-pickers/AdapterDateFns";
import { DateCalendar } from "@mui/x-date-pickers/DateCalendar";
import ja from "date-fns/locale/ja";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import ja from "date-fns/locale/ja";
import { ja } from "date-fns/locale";

の方がいいらしい

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ライブラリが追加する可能性があるからかな?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これはちょっとなんでかわからない

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

型定義ファイルが
"date-fns/locale"
にあるから?

};

return (
<DetailLayout {...details}>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

動くので今回はマージします!
が、
{...details}
のスプレッド構文って書き方魅力的なので
目を通しておくとよき
https://qiita.com/Yametaro/items/814f40d08e9d30584e20#props%E3%81%AF%E3%82%B9%E3%83%97%E3%83%AC%E3%83%83%E3%83%89%E6%A7%8B%E6%96%87%E3%81%A7%E6%B8%A1%E3%81%9B%E3%82%8B

@TsubasaOura TsubasaOura merged commit d718472 into develop Jul 12, 2023
@TsubasaOura TsubasaOura deleted the feature/fujisaki/87-create-birthdat.tsx branch July 12, 2023 04:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement 新しい機能またはリクエスト frontend Next.jsやKeycloakのテーマに関して

Projects

None yet

Development

Successfully merging this pull request may close these issues.

birthdaypageの作成

2 participants