add ui components

This commit is contained in:
2025-07-10 21:01:59 +09:00
parent c89478c1db
commit 5804a6cbff
7 changed files with 239 additions and 4 deletions

21
src/i18n.ts Normal file
View File

@@ -0,0 +1,21 @@
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import en from './locales/en.json';
import jp from './locales/jp.json';
i18n
.use(initReactI18next)
.init({
resources: {
en: { translation: en },
jp: { translation: jp },
},
lng: 'jp', // 初期言語
fallbackLng: 'en',
interpolation: {
escapeValue: false,
},
});
export default i18n;

2
src/locales/en.json Normal file
View File

@@ -0,0 +1,2 @@
{
}

33
src/locales/jp.json Normal file
View File

@@ -0,0 +1,33 @@
{
"terms": {
"toshoGrowth": "東証グロース",
"toshoStandard": "東証スタンダード",
"toshoPrime": "東証プライム",
"stock": {
"price": "株価",
"volume": "時価総額"
}
},
"pages": {
"screening": {
"title": "銘柄スクリーニング",
"rerun": "再実行",
"universe": {
"title": "ユニバース",
"desc": "スクリーニング対象の銘柄の条件を設定してください",
"type": {
"listed": "全上場銘柄"
}
},
"evaluation": {
"title": "銘柄評価",
"desc": "銘柄一覧テーブルに表示する列を設定してください",
"columnName": "カラム名"
},
"filterOut": {
"title": "選別",
"desc": "銘柄の選別条件を設定してください"
}
}
}
}

View File

@@ -1,6 +1,7 @@
import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App";
import "./i18n";
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
<React.StrictMode>

View File

@@ -1,6 +1,96 @@
import { ReactNode } from "react";
import { useTranslation } from "react-i18next";
function Screening() {
const {t} = useTranslation();
return (
<h1>SCREENING</h1>
<>
<h1>{t("pages.screening.title")}</h1>
<UniverseSpec/>
<EvaluationSpec/>
<FilterOutSpec/>
</>
);
}
export default Screening;
function UniverseSpec() {
const {t} = useTranslation();
return (
<FilterBox
title={t("pages.screening.universe.title")}
desc={t("pages.screening.universe.desc")}
>
<select>
<option>{t("pages.screening.universe.type.listed")}</option>
</select>
<label><input type="checkbox" />{t("terms.toshoGrowth")}</label>
<label><input type="checkbox" />{t("terms.toshoStandard")}</label>
<label><input type="checkbox" />{t("terms.toshoPrime")}</label>
</FilterBox>
);
}
function EvaluationSpec() {
const {t} = useTranslation();
return (
<FilterBox
title={t("pages.screening.evaluation.title")}
desc={t("pages.screening.evaluation.desc")}
>
<ol>
{
[...Array(3)].map((_,i)=>(
<li>
<input type="text" placeholder={t("pages.screening.evaluation.columnName")} />
=
<select>
<option>{t("terms.stock.volume")}</option>
<option>{t("terms.stock.price")}</option>
</select>
<a href="#">remove</a>
</li>
))
}
<li>
<a href="#">add</a>
</li>
</ol>
</FilterBox>
);
}
function FilterOutSpec() {
const {t} = useTranslation();
return (
<FilterBox
title={t("pages.screening.filterOut.title")}
desc={t("pages.screening.filterOut.desc")}
>
<textarea />
</FilterBox>
);
}
type FilterBoxProps = {
title: string,
desc: string,
children: ReactNode,
};
function FilterBox({title, desc, children}: FilterBoxProps) {
const {t} = useTranslation();
return (
<div>
<div>
<div>
<h2>{title}</h2>
<p>{desc}</p>
</div>
<div>
<a href="#">{t("pages.screening.rerun")}</a>
</div>
</div>
<div>{children}</div>
</div>
);
}