Skip to content

Commit

Permalink
fix(ds): translate
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoxAzrot committed Aug 13, 2024
1 parent bb05384 commit 4af490d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,32 +1,36 @@
import { ReactNode } from "react";

import { IconPort } from "@/design-system/atoms/icon";

import { Translate } from "@/shared/translation/components/translate/translate";

import { CardTransactionStatus } from "./card-transaction.types";

export function getComponentsVariants(status: CardTransactionStatus): {
icon: IconPort;
statusName: string;
statusName: ReactNode;
} {
const map: Record<CardTransactionStatus, { icon: IconPort; statusName: string }> = {
const map: Record<CardTransactionStatus, { icon: IconPort; statusName: ReactNode }> = {
granted: {
icon: {
name: "ri-arrow-right-line",
className: "text-label-blue",
},
statusName: "Granted",
statusName: <Translate token="cards:cardTransaction.status.granted" />,
},
allocated: {
icon: {
name: "ri-arrow-down-line",
className: "text-label-green",
},
statusName: "Allocated",
statusName: <Translate token="cards:cardTransaction.status.allocated" />,
},
returned: {
icon: {
name: "ri-arrow-turn-forward-line",
className: "text-label-red",
},
statusName: "Returned",
statusName: <Translate token="cards:cardTransaction.status.returned" />,
},
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"status": {
"granted": "Granted",
"allocated": "Allocated",
"returned": "Returned"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import enCardTransaction from "./card-transaction.en.json";

export const enCardTransactionTranslation = {
cardTransaction: enCardTransaction,
};
4 changes: 4 additions & 0 deletions shared/translation/en.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { enProgramsTranslation } from "@/app/programs/_translations/programs.translate";
import { enTestTranslation } from "@/app/test/_translations/test.translate";

import { enCardTransactionTranslation } from "@/design-system/molecules/cards/card-transaction/translations/card-transaction.translate";
import { enTableFilterTranslation } from "@/design-system/molecules/table-filter/translations/table-filter.translate";

import { enFeedbackDrawerTranslate } from "@/shared/features/feedback-drawer/_translations/feedback-drawer.translate";
Expand All @@ -14,4 +15,7 @@ export const en = {
...enFeedbackDrawerTranslate,
...enProgramsTranslation,
...enTableFilterTranslation,
cards: {
...enCardTransactionTranslation,
},
};

0 comments on commit 4af490d

Please sign in to comment.