Skip to content

Commit f0d0889

Browse files
committed
[update] メンバーページを作成
1 parent a68b38b commit f0d0889

File tree

10 files changed

+179
-1
lines changed

10 files changed

+179
-1
lines changed

app/members/layout.module.css

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.container {
2+
position: relative;
3+
background-color: #fff;
4+
width: 840px;
5+
margin: -40px auto 0;
6+
padding: 80px;
7+
border-radius: 8px;
8+
}
9+
10+
@media (max-width: 640px) {
11+
.container {
12+
width: calc(100% - 32px);
13+
margin: -40px auto 0;
14+
padding: 40px 16px;
15+
}
16+
}

app/members/layout.tsx

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import Hero from '@/components/Hero';
2+
import styles from './layout.module.css';
3+
4+
export const metadata = {
5+
title: 'メンバー|Simple Blog',
6+
};
7+
8+
type Props = {
9+
children: React.ReactNode;
10+
};
11+
12+
export default async function RootLayout({ children }: Props) {
13+
return (
14+
<>
15+
<Hero title="Members" sub="メンバー" />
16+
<div className={styles.container}>{children}</div>
17+
</>
18+
);
19+
}

app/members/page.module.css

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
.text {
2+
text-align: center;
3+
margin-bottom: 40px;
4+
}
5+
6+
.list {
7+
display: flex;
8+
gap: 40px;
9+
margin-bottom: 80px;
10+
}
11+
12+
.list:nth-child(even) {
13+
flex-direction: row-reverse;
14+
}
15+
16+
.image {
17+
width: 240px;
18+
height: 240px;
19+
border-radius: var(--border-radius);
20+
}
21+
22+
.name {
23+
font-size: 1.2rem;
24+
font-weight: bold;
25+
}
26+
27+
.position {
28+
margin-bottom: 8px;
29+
}
30+
31+
.profile {
32+
font-size: 0.9rem;
33+
}
34+
35+
.footer {
36+
display: flex;
37+
flex-direction: column;
38+
align-items: center;
39+
border-top: 1px solid var(--color-border);
40+
padding-top: 40px;
41+
text-align: center;
42+
gap: 24px;
43+
}
44+
45+
.message {
46+
font-size: 2rem;
47+
font-weight: bold;
48+
}
49+
50+
@media (max-width: 640px) {
51+
.text {
52+
text-align: left;
53+
}
54+
55+
.list {
56+
display: flex;
57+
flex-direction: column;
58+
align-items: center;
59+
gap: 24px;
60+
}
61+
62+
.list:nth-child(even) {
63+
flex-direction: column;
64+
}
65+
66+
.name {
67+
text-align: center;
68+
}
69+
70+
.position {
71+
text-align: center;
72+
}
73+
}

app/members/page.tsx

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import Image from 'next/image';
2+
import { getMembersList } from '@/libs/microcms';
3+
import styles from './page.module.css';
4+
import ButtonLink from '@/components/ButtonLink';
5+
6+
export const revalidate = 60;
7+
8+
export default async function Page() {
9+
const data = await getMembersList();
10+
return (
11+
<div className={styles.container}>
12+
<ul>
13+
{data.contents.map((member) => (
14+
<li key={member.id} className={styles.list}>
15+
<Image
16+
src={member.image?.url as string}
17+
alt=""
18+
width={member.image?.width}
19+
height={member.image?.height}
20+
className={styles.image}
21+
/>
22+
<dl>
23+
<dt className={styles.name}>{member.name}</dt>
24+
<dd className={styles.position}>{member.position}</dd>
25+
<dd className={styles.profile}>{member.profile}</dd>
26+
</dl>
27+
</li>
28+
))}
29+
</ul>
30+
<div className={styles.footer}>
31+
<h2 className={styles.message}>We are hiring</h2>
32+
<p>私たちは共にチャレンジする仲間を募集しています。</p>
33+
<ButtonLink href="">採用情報へ</ButtonLink>
34+
</div>
35+
</div>
36+
);
37+
}

components/Menu/index.tsx

+5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ export default function Menu() {
1818
ニュース
1919
</Link>
2020
</li>
21+
<li>
22+
<Link href="/members" onClick={close}>
23+
メンバー
24+
</Link>
25+
</li>
2126
<li>
2227
<Link href="/recruit" onClick={close}>
2328
採用情報

libs/microcms.ts

+19
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ export type News = {
2222
category: Category;
2323
};
2424

25+
// メンバーの型定義
26+
export type Member = {
27+
name: string;
28+
position: string;
29+
profile: string;
30+
image?: MicroCMSImage;
31+
};
32+
2533
export type Article = News & MicroCMSContentId & MicroCMSDate;
2634

2735
if (!process.env.MICROCMS_SERVICE_DOMAIN) {
@@ -86,3 +94,14 @@ export const getCategoryDetail = async (contentId: string, queries?: MicroCMSQue
8694

8795
return detailData;
8896
};
97+
98+
// メンバー一覧を取得
99+
export const getMembersList = async (queries?: MicroCMSQueries) => {
100+
const listData = await client
101+
.getList<Member>({
102+
endpoint: 'members',
103+
queries,
104+
})
105+
.catch(notFound);
106+
return listData;
107+
};

next.config.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
/** @type {import('next').NextConfig} */
2-
const nextConfig = {};
2+
const nextConfig = {
3+
images: {
4+
remotePatterns: [
5+
{
6+
protocol: 'https',
7+
hostname: 'images.microcms-assets.io',
8+
},
9+
],
10+
},
11+
};
312

413
module.exports = nextConfig;

public/img-member1.jpg

230 KB
Loading

public/img-member2.jpg

546 KB
Loading

public/img-member3.jpg

349 KB
Loading

0 commit comments

Comments
 (0)