Skip to content

Commit a5e9b34

Browse files
committed
Fixed Header design and Enabled multilingual support for locale in ComplexCard
1 parent 791b92d commit a5e9b34

4 files changed

Lines changed: 30 additions & 15 deletions

File tree

frontend/src/components/common/molecules/Header.tsx

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ const HeaderWrapper = styled.header`
1616
const NavContainer = styled.div`
1717
max-width: 1200px;
1818
margin: 0 auto;
19-
padding: 0 1rem; /* 16px */
19+
padding: 0 2rem;
2020
display: flex;
2121
align-items: center;
2222
justify-content: space-between;
23-
height: 4rem; /* 64px */
23+
height: 4rem;
2424
`;
2525

2626
const Logo = styled.h1`
@@ -49,11 +49,14 @@ const Header: React.FC<HeaderProps> = ({ onAddNewComplex }) => {
4949
return (
5050
<HeaderWrapper>
5151
<NavContainer>
52-
<Logo>{t('headerTitle')}</Logo>
53-
<div style={{ display: 'flex', alignItems: 'center' }}>
54-
<Button variant="primary" size="small" onClick={onAddNewComplex}>
55-
{t('addNewComplexButton')}
56-
</Button>
52+
<div
53+
style={{
54+
display: 'flex',
55+
alignItems: 'center',
56+
gap: '1rem',
57+
}}
58+
>
59+
<Logo>{t('headerTitle')}</Logo>
5760
<LanguageSwitcher>
5861
<Button
5962
size="small"
@@ -73,6 +76,11 @@ const Header: React.FC<HeaderProps> = ({ onAddNewComplex }) => {
7376
</Button>
7477
</LanguageSwitcher>
7578
</div>
79+
<div style={{ display: 'flex', alignItems: 'center' }}>
80+
<Button variant="primary" size="small" onClick={onAddNewComplex}>
81+
+ {t('addNewComplexButton')}
82+
</Button>
83+
</div>
7684
</NavContainer>
7785
</HeaderWrapper>
7886
);

frontend/src/components/complexes/organisms/ComplexCard.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react';
22
import styled from 'styled-components';
3+
import { useTranslation } from 'react-i18next';
34
import type { Complex } from '../../../types/complex';
45
import Button from '../../common/atoms/Button';
56

@@ -88,6 +89,7 @@ const ComplexCard: React.FC<ComplexCardProps> = ({
8889
onDelete,
8990
animationDelay,
9091
}) => {
92+
const { t } = useTranslation();
9193
const formatDate = (dateString: string) => {
9294
const options: Intl.DateTimeFormatOptions = {
9395
year: 'numeric',
@@ -104,29 +106,32 @@ const ComplexCard: React.FC<ComplexCardProps> = ({
104106
<ContentText>{complex.content}</ContentText>
105107
</div>
106108
<div>
107-
<MetaText>最終更新: {formatDate(complex.updated_at)}</MetaText>
109+
<MetaText>
110+
{t('lastUpdated')}
111+
{formatDate(complex.updated_at)}
112+
</MetaText>
108113
<ActionsWrapper>
109114
<Button
110115
variant="primary"
111116
size="small"
112117
onClick={() => onViewGoals(complex.id)}
113118
style={{ flexGrow: 1 }}
114119
>
115-
目標を見る/設定
120+
{t('viewSetGoalsButton')}
116121
</Button>
117122
<Button
118123
variant="secondary"
119124
size="small"
120125
onClick={() => onEdit(complex.id)}
121126
>
122-
編集
127+
{t('editButton')}
123128
</Button>
124129
<Button
125130
variant="danger"
126131
size="small"
127132
onClick={() => onDelete(complex.id)}
128133
>
129-
削除
134+
{t('deleteButton')}
130135
</Button>
131136
</ActionsWrapper>
132137
</div>

frontend/src/locales/en/translation.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"headerTitle": "Re:Fuel",
3-
"addNewComplexButton": "Register New Complex",
3+
"addNewComplexButton": "Add",
44
"complexesPageTitle": "Your Complexes",
55
"complexesPageSubtitle": "Here you can review your registered complexes and take the first step to turn them into fuel for growth.",
66
"loading": "Now Loading...",
@@ -11,5 +11,6 @@
1111
"viewSetGoalsButton": "View/Set Goals",
1212
"editButton": "Edit",
1313
"deleteButton": "Delete",
14-
"deleteConfirmation": "Are you sure you want to delete Complex ID {{id}}?"
14+
"deleteConfirmation": "Are you sure you want to delete Complex ID {{id}}?",
15+
"lastUpdated": "Last updated: "
1516
}

frontend/src/locales/ja/translation.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"headerTitle": "Re:Fuel",
3-
"addNewComplexButton": "新しいコンプレックスを登録",
3+
"addNewComplexButton": "追加",
44
"complexesPageTitle": "あなたのコンプレックス",
55
"complexesPageSubtitle": "ここでは、あなたが登録したコンプレックスを確認し、それらを成長の糧に変えるための第一歩を踏み出せます。",
66
"loading": "読み込み中...",
@@ -11,5 +11,6 @@
1111
"viewSetGoalsButton": "目標を見る/設定",
1212
"editButton": "編集",
1313
"deleteButton": "削除",
14-
"deleteConfirmation": "コンプレックスID {{id}} を本当に削除しますか?"
14+
"deleteConfirmation": "コンプレックスID {{id}} を本当に削除しますか?",
15+
"lastUpdated": "最終更新: "
1516
}

0 commit comments

Comments
 (0)