Skip to content

Commit 1daa1e4

Browse files
committed
機能一覧ページ追加
1 parent 4ef3245 commit 1daa1e4

5 files changed

Lines changed: 80 additions & 7 deletions

File tree

src/app/home/FeatureCard.tsx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import styled from '@emotion/styled';
2+
import { Card } from 'antd';
3+
import Link from 'next/link';
4+
import React, { FC } from 'react';
5+
import { FeatureItemType } from '@/components/common/Features';
6+
7+
type CardProps = FeatureItemType;
8+
export const FeatureCard: FC<CardProps> = ({ title, path, description }) => {
9+
return (
10+
<Link href={path} style={{ textDecoration: 'none' }}>
11+
<StyleCard style={{ width: 200 }} title={title}>
12+
{description}
13+
</StyleCard>
14+
</Link>
15+
);
16+
};
17+
18+
const StyleCard = styled(Card)`
19+
transition: 0.2s;
20+
21+
.ant-card-head {
22+
min-height: 38px;
23+
padding: 0 12px;
24+
font-size: 14px;
25+
}
26+
27+
.ant-card-body {
28+
height: 120px;
29+
}
30+
31+
&:hover {
32+
box-shadow:
33+
0 6px 16px -8px #00000014,
34+
0 9px 28px #0000000d,
35+
0 12px 48px 16px #00000008;
36+
transform: scale(1.02);
37+
}
38+
`;

src/app/home/Home.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'use client';
2+
import { Flex } from 'antd';
3+
import React, { FC } from 'react';
4+
import { AppLayout } from '@/Layout/App';
5+
import { FeatureCard } from '@/app/home/FeatureCard';
6+
import { features } from '@/components/common/Features';
7+
8+
export const HomePage: FC = () => {
9+
const list = features.map(({ items }) => [...items]).flat();
10+
console.log(list);
11+
12+
return (
13+
<AppLayout>
14+
<Flex style={{ margin: 8 }} wrap="wrap" gap="small">
15+
{list.map((feature) => (
16+
<FeatureCard key={feature.key} {...feature} />
17+
))}
18+
</Flex>
19+
</AppLayout>
20+
);
21+
};

src/app/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import React, { FC } from 'react';
2-
import { AppLayout } from '@/Layout/App';
2+
import { HomePage } from '@/app/home/Home';
33

44
export const metadata = {
55
title: 'Dev Toolkit',
66
};
77
const indexPage: FC = () => {
8-
return <AppLayout />;
8+
return <HomePage />;
99
};
1010

1111
export default indexPage;

src/components/common/Features.tsx

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ import GrowthIcon from '@rsuite/icons/Growth';
33
import ListOl from '@rsuite/icons/legacy/ListOl';
44
import React from 'react';
55

6-
type FeatureItemType = {
6+
export type FeatureItemType = {
77
key: string;
88
title: string;
9+
shortTitle?: string;
910
path: string;
1011
icon?: string;
12+
description?: React.ReactNode;
1113
};
1214

1315
type FeatureGroupType = {
@@ -25,18 +27,24 @@ export const features: FeatureGroupType[] = [
2527
items: [
2628
{
2729
key: 'punycode',
28-
title: 'Punycode',
30+
title: 'Punycodeエンコード',
31+
shortTitle: 'Punycode',
2932
path: '/punycode',
33+
description: '文字列をpunycodeエンコードします',
3034
},
3135
{
3236
key: 'base64',
33-
title: 'Base64',
37+
title: 'Base64エンコード',
38+
shortTitle: 'Base64',
3439
path: '/base64',
40+
description: '文字列をBase64エンコードします',
3541
},
3642
{
3743
key: 'urlencode',
38-
title: 'URL',
44+
title: 'URLエンコード',
45+
shortTitle: 'URL',
3946
path: '/urlencode',
47+
description: '文字列をURLエンコードします',
4048
},
4149
],
4250
},
@@ -49,6 +57,7 @@ export const features: FeatureGroupType[] = [
4957
key: 'character_count',
5058
title: '文字数カウント',
5159
path: '/character_count',
60+
description: '文字数や行数をカウントします',
5261
},
5362
{
5463
key: 'character_replace',
@@ -81,11 +90,13 @@ export const features: FeatureGroupType[] = [
8190
key: 'date_converter',
8291
title: '日時の変換',
8392
path: '/date_converter',
93+
description: '日付のフォーマットを変換します',
8494
},
8595
{
8696
key: 'date_diff',
8797
title: '日数計算',
8898
path: '/date_diff',
99+
description: '2つの時間から差分の時間を計算します',
89100
},
90101
],
91102
},
@@ -98,6 +109,7 @@ export const features: FeatureGroupType[] = [
98109
key: 'hash',
99110
title: 'Hash',
100111
path: '/hash',
112+
description: '文字列からハッシュを生成します',
101113
},
102114
// {
103115
// key: 'dummy',
@@ -108,11 +120,13 @@ export const features: FeatureGroupType[] = [
108120
key: 'uuid',
109121
title: 'UUID',
110122
path: '/uuid',
123+
description: '複数のUUIDを生成します',
111124
},
112125
{
113126
key: 'image_generator',
114127
title: '画像生成',
115128
path: '/image_generator',
129+
description: 'ダミー用の画像を生成します',
116130
},
117131
],
118132
},

src/components/common/SideNavBar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const SideNavBar: FC = () => {
3939
href={item.path}
4040
expanded={expanded}
4141
>
42-
{item.title}
42+
{item.shortTitle || item.title}
4343
</NavItem>
4444
))}
4545
</Nav.Menu>

0 commit comments

Comments
 (0)