添加记忆上一个
Some checks reported errors
continuous-integration/drone/push Build encountered an error

This commit is contained in:
2025-11-22 09:16:51 +08:00
parent bc0dab64c6
commit baf7265bf8
3 changed files with 21 additions and 7 deletions

View File

@@ -48,7 +48,9 @@ const Memorize: React.FC<MemorizeProps> = ({ textPairs }) => {
<Container className="p-6 flex flex-col gap-8 h-96 justify-center items-center">
{(getTextPairs().length > 0 && (
<>
<div className={`h-36 flex flex-col gap-2 justify-start items-center ${myFont.className} text-3xl`}>
<div
className={`h-36 flex flex-col gap-2 justify-start items-center ${myFont.className} text-3xl`}
>
<div className="text-sm text-gray-500">
{t("progress", {
current: index + 1,
@@ -91,7 +93,7 @@ const Memorize: React.FC<MemorizeProps> = ({ textPairs }) => {
</div>
<div className="flex flex-row gap-2 items-center justify-center">
<LightButton
className="w-32"
className="w-20"
onClick={async () => {
if (show === "answer") {
const newIndex = (index + 1) % getTextPairs().length;
@@ -114,7 +116,17 @@ const Memorize: React.FC<MemorizeProps> = ({ textPairs }) => {
setShow(show === "question" ? "answer" : "question");
}}
>
{show === "question" ? t("showAnswer") : t("next")}
{show === "question" ? t("answer") : t("next")}
</LightButton>
<LightButton
onClick={() => {
setIndex(
(index - 1 + getTextPairs().length) % getTextPairs().length,
);
setShow("question");
}}
>
{t("previous")}
</LightButton>
<LightButton
onClick={() => {