Skip to content

Conversation

snaka
Copy link
Member

@snaka snaka commented Feb 23, 2023

※ 2022 spring では「パートナー」という呼称を使用していたので、それにならって URL やコードでは partner という表現にしています。

※ Next.js の SSG はじめて触ったので変なことしてる可能性があります。気になる箇所あればご指摘ください 🙏

参考にしたページ (2022 Spring)

https://gocon.jp/2022spring/partners/platinum/v-standard/

image

現在の実装 (2023)

イメージ

image

ページ生成に利用するデータについて

next build 時に data/patners.json 読み取って、その内容に従って platinum および gold パートナーのページが生成されるようになっています。

data/patners.json はスポンサー一覧にも利用することを想定して、silver, blonze も登録することを想定しています。

データ構造

{
  "platinum": [
    {  "id": string, "name": string, "description": string },
    {  "id": string, "name": string, "description": string }
  ],
  "gold": [
    {  "id": string, "name": string, "description": string },
    {  "id": string, "name": string, "description": string }
  ],
  "silver": [
    string,
   ...
  ],
  "bronze": [
    string,
   ...
  ]
}

URL (path) の構造

/2023/partners/{rank}/{id}/
  • rank : platinum | gold
  • id: (任意) パートナーを一意に識別する id ( パートナーのロゴ画像の名にも使用される)

この PR に含まれるサンプルデータでは以下のページが生成されるようになっています。 ( main マージ前に取り除く予定 )

/2023/partners/platinum/platinum-1/
/2023/partners/platinum/platinum-2/
/2023/partners/gold/gold-1/
/2023/partners/gold/gold-2/

パートナーロゴ画像の配置場所

/public/images/partners/{id}.png

パートナーの id に拡張子 .png を付与したものがそのまま画像ファイル名となります。
サンプルデータに対応した画像は以下のようになってます。

public/images/partners/
├── gold-1.png
├── gold-2.png
├── platinum-1.png
└── platinum-2.png

ローカルで SSG の動作確認

ローカルで yarn serve を実行すると、ビルドが実行されて ./out/2023 にレンダリング結果が出力され http サーバでその内容が参照できるようになります。

yarn build && yarn starthttp://localhost:3000/2023 にアクセスすることで確認できます。

@snaka snaka changed the title [wip] スポンサー(パートナー)ページの実装 スポンサー(パートナー)ページの実装 Feb 23, 2023
@@ -0,0 +1,50 @@
{
"platinum": [
Copy link
Member Author

Choose a reason for hiding this comment

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

Web ページなどの表記では Platinum "Go"ld ですが、
2022 Spring の URL 見ると platinum になっていたので、それにならってコード上では platinum という表記にしてます

<Header />
</Box>
<Box component="main" sx={{ minHeight: 'calc(100vh - 124px)' }}>
<Box component="main" sx={{ minHeight: 'calc(100vh - 300px)' }}>
Copy link
Member Author

Choose a reason for hiding this comment

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

パートナーページのようにコンテンツの高さが小さい場合に余白が大きく感じたので短くしてみました。

import { GetStaticPaths, GetStaticProps } from 'next'
import { PagePartner, PartnerRank } from 'src/components/pages/PagePartner'

import partners from 'data/partners.json'
Copy link
Member Author

Choose a reason for hiding this comment

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

パートナーの一覧を json から読み込む

@snaka snaka marked this pull request as ready for review February 23, 2023 05:23
Copy link
Contributor

@ahogappa ahogappa left a comment

Choose a reason for hiding this comment

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

動作は良さそうでした
コードの部分については自分はちょっと自信がないので、どなたかみていただけると助かります

{
"id": "platinum-1",
"name": "株式会社 プラチナワン",
"desc": "Sea tempor feugait et elit et sanctus kasd eirmod. Praesent amet qui iriure ipsum exerci clita sit et volutpat eos rebum elitr. Autem laoreet labore lorem commodo. At aliquyam sit est kasd diam nostrud adipiscing nonumy sit duo dolores in dolor suscipit. Consetetur quis ea dolore sed in magna facilisi delenit. Erat kasd at sea ex takimata feugiat. Eos tempor diam delenit adipiscing takimata. Autem diam accusam. Et nisl sanctus kasd ipsum diam odio nonumy amet. Nisl sed amet sea et clita autem nostrud dolore autem euismod invidunt. Augue blandit tempor no dolore. Et sit no duo. Diam takimata lobortis erat eos consetetur dolor ut ea amet justo eum eos invidunt ipsum nonummy justo ut."
Copy link
Contributor

Choose a reason for hiding this comment

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

[q]
ここのdescやnameの箇所の英/日切り替えって、この段階では実装しないという感じでしょうか?

Copy link
Contributor

Choose a reason for hiding this comment

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

やっても良さげですが、前年度でも会社説明の翻訳までは行ってないので、ひとまずこのままでも良いかなと思います

Copy link
Contributor

@maito1201 maito1201 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@taigakiyokawa taigakiyokawa left a comment

Choose a reason for hiding this comment

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

取り急ぎいくつかコメントしました!
getStaticProps 周りはのちほどみます 🙇

@snaka snaka force-pushed the feat/partner-page branch from 53cf524 to c66083c Compare February 25, 2023 08:29
@snaka
Copy link
Member Author

snaka commented Feb 25, 2023

@taigakiyokawa ひととおり対応しましたので、ご確認ください 🙏

/**
* partners.json から path params に対応した情報の抜き出し page の props として返す
*/
export const getStaticProps: GetStaticProps<PageProps> = async context => {
Copy link
Member

@taigakiyokawa taigakiyokawa Feb 25, 2023

Choose a reason for hiding this comment

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

imo

引数宣言の時点で context を展開して params にしてしまった方が読みやすいと思います。

引数を宣言する時にまとめて context にしてしまうと、関数内で context オブジェクトのどのプロパティを使っているのか分からないのですが、 { params } にすると params 以外のプロパティは使っていないことが分かるので良さそうです。

Suggested change
export const getStaticProps: GetStaticProps<PageProps> = async context => {
export const getStaticProps: GetStaticProps<PageProps> = async ({ params }) => {

@snaka snaka requested a review from taigakiyokawa February 25, 2023 09:54
Copy link
Member

@taigakiyokawa taigakiyokawa left a comment

Choose a reason for hiding this comment

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

LGTM です 🙆‍♂️
ご対応ありがとうございます!

@snaka
Copy link
Member Author

snaka commented Feb 25, 2023

ありがとうございました! 🙌

@taigakiyokawa taigakiyokawa merged commit c01d2b6 into develop Feb 26, 2023
@taigakiyokawa taigakiyokawa deleted the feat/partner-page branch February 26, 2023 01:14
maito1201 added a commit that referenced this pull request Apr 1, 2023
* [fix] Fix date for closing application from Sat to Tue (#65)

* feat: add GitHub template (#68)

* fix: template (#69)

* fix: file structure (#70)

* merge main into develop (#72)

* [fix] Fix date for closing application from Sat to Tue (#65) (#66)

* feat: community booth section (#67)

* feat: specified commercial transaction (#71)

* feat: specified commercial transaction

* fix typo

* fix: i18n locale

* fix: english explanation

---------

Co-authored-by: Taiga KIYOKAWA <[email protected]>

* Merge main into develop (#169)

* [fix] Fix date for closing application from Sat to Tue (#65) (#66)

* feat: community booth section (#67)

* feat: specified commercial transaction (#71)

* feat: specified commercial transaction

* fix typo

* fix: i18n locale

* fix: english explanation

* feat: add information about CfP result (#165)

---------

Co-authored-by: Taiga KIYOKAWA <[email protected]>

* feat: useSessionize (#171)

* feat: useSettionize

* add EOL

* スポンサー(パートナー)ページの実装 (#170)

* feat: partner page

* SAMPLE json / images

* fix: `desc` to `description`

* fix: simplify prop type name

* fix: `desc` to `description`

* fix: extract params from context

* feat: header with link (#172)

* chore: Remove CommunityBoothSection from PageTop (#174)

* chore: Temporarily change links of Header to the links to HTML pages build by Sessionize (#173)

* chore: Remove `next/link` temporary for forwarding to HTML pages build by Sessionize

* chore: Temporarily change links of Header to the links to HTML pages build by Sessionize

* fix(HeaderMenu): Use `next/link` when href is `/`

* Proposal feat: hide home label from header (#175)

* feat: hide home label from header

* fix header menu

* comment out unused import

---------

Co-authored-by: Taiga KIYOKAWA <[email protected]>
Co-authored-by: sivchari <[email protected]>
Co-authored-by: Shinji Nakamatsu <[email protected]>
maito1201 added a commit that referenced this pull request Apr 2, 2023
* [fix] Fix date for closing application from Sat to Tue (#65)

* feat: add GitHub template (#68)

* fix: template (#69)

* fix: file structure (#70)

* merge main into develop (#72)

* [fix] Fix date for closing application from Sat to Tue (#65) (#66)

* feat: community booth section (#67)

* feat: specified commercial transaction (#71)

* feat: specified commercial transaction

* fix typo

* fix: i18n locale

* fix: english explanation

---------

Co-authored-by: Taiga KIYOKAWA <[email protected]>

* Merge main into develop (#169)

* [fix] Fix date for closing application from Sat to Tue (#65) (#66)

* feat: community booth section (#67)

* feat: specified commercial transaction (#71)

* feat: specified commercial transaction

* fix typo

* fix: i18n locale

* fix: english explanation

* feat: add information about CfP result (#165)

---------

Co-authored-by: Taiga KIYOKAWA <[email protected]>

* feat: useSessionize (#171)

* feat: useSettionize

* add EOL

* スポンサー(パートナー)ページの実装 (#170)

* feat: partner page

* SAMPLE json / images

* fix: `desc` to `description`

* fix: simplify prop type name

* fix: `desc` to `description`

* fix: extract params from context

* feat: header with link (#172)

* chore: Remove CommunityBoothSection from PageTop (#174)

* chore: Temporarily change links of Header to the links to HTML pages build by Sessionize (#173)

* chore: Remove `next/link` temporary for forwarding to HTML pages build by Sessionize

* chore: Temporarily change links of Header to the links to HTML pages build by Sessionize

* fix(HeaderMenu): Use `next/link` when href is `/`

* Proposal feat: hide home label from header (#175)

* feat: hide home label from header

* fix header menu

* comment out unused import

* fix: remove community booth section (#177)

* feat: community booth section (#67)

* fix: remove community booth section

* chore: add eslint rule (#178)

* feat: community booth section (#67)

* fix: remove community booth section

* chore: add eslint rules

---------

Co-authored-by: Taiga KIYOKAWA <[email protected]>
Co-authored-by: sivchari <[email protected]>
Co-authored-by: Shinji Nakamatsu <[email protected]>
taigakiyokawa added a commit that referenced this pull request Apr 2, 2023
* [fix] Fix date for closing application from Sat to Tue (#65)

* feat: add GitHub template (#68)

* fix: template (#69)

* fix: file structure (#70)

* merge main into develop (#72)

* [fix] Fix date for closing application from Sat to Tue (#65) (#66)

* feat: community booth section (#67)

* feat: specified commercial transaction (#71)

* feat: specified commercial transaction

* fix typo

* fix: i18n locale

* fix: english explanation

---------

Co-authored-by: Taiga KIYOKAWA <[email protected]>

* Merge main into develop (#169)

* [fix] Fix date for closing application from Sat to Tue (#65) (#66)

* feat: community booth section (#67)

* feat: specified commercial transaction (#71)

* feat: specified commercial transaction

* fix typo

* fix: i18n locale

* fix: english explanation

* feat: add information about CfP result (#165)

---------

Co-authored-by: Taiga KIYOKAWA <[email protected]>

* feat: useSessionize (#171)

* feat: useSettionize

* add EOL

* スポンサー(パートナー)ページの実装 (#170)

* feat: partner page

* SAMPLE json / images

* fix: `desc` to `description`

* fix: simplify prop type name

* fix: `desc` to `description`

* fix: extract params from context

* feat: header with link (#172)

* chore: Remove CommunityBoothSection from PageTop (#174)

* chore: Temporarily change links of Header to the links to HTML pages build by Sessionize (#173)

* chore: Remove `next/link` temporary for forwarding to HTML pages build by Sessionize

* chore: Temporarily change links of Header to the links to HTML pages build by Sessionize

* fix(HeaderMenu): Use `next/link` when href is `/`

* Proposal feat: hide home label from header (#175)

* feat: hide home label from header

* fix header menu

* comment out unused import

* fix: remove community booth section (#177)

* feat: community booth section (#67)

* fix: remove community booth section

* chore: add eslint rule (#178)

* feat: community booth section (#67)

* fix: remove community booth section

* chore: add eslint rules

* chore: Close sponsors application (#180)

* chore: Remove the button for application to sponsors due to be already closed

* chore: Fix arrangement of Gophers due to remove the button

* chore: Change description to "Sponsors application has been closed.~"

---------

Co-authored-by: sivchari <[email protected]>
Co-authored-by: maito1201 <[email protected]>
Co-authored-by: Shinji Nakamatsu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants