11import type { FC , JSX , JSXNode } from "hono/jsx" ;
2- import { Translation , TranslationProps , t } from "../../translations " ;
2+ import { Translation , TranslationProps , translation } from "../../translation " ;
33import { CloseIcon , HelpCircleIcon } from "../icons" ;
44
55type TooltipProps = {
@@ -17,65 +17,65 @@ type TooltipProps = {
1717const tooltipContent : Record <
1818 TooltipProps [ "kind" ] ,
1919 {
20- label : JSXNode ;
21- desc : JSXNode ;
20+ label : ReturnType < typeof Translation > ;
21+ desc : ReturnType < typeof Translation > ;
2222 isShowLabel : boolean ;
2323 bgColor : string ;
2424 textColor : string ;
2525 }
2626> = {
2727 element : {
2828 label : < Translation translationKey = "elementFunction" /> ,
29- desc : < Translation translationKey = "elementFunctionDesc " /> ,
29+ desc : < Translation translationKey = "elementFunctionDescription " /> ,
3030 isShowLabel : true ,
3131 bgColor : "bg-blue-50" ,
3232 textColor : "text-blue-700" ,
3333 } ,
3434 contextual : {
3535 label : < Translation translationKey = "contextFunction" /> ,
36- desc : < Translation translationKey = "contextFunctionDesc " /> ,
36+ desc : < Translation translationKey = "contextFunctionDescription " /> ,
3737 isShowLabel : true ,
3838 bgColor : "bg-indigo-50" ,
3939 textColor : "text-indigo-700" ,
4040 } ,
4141 definitions : {
4242 label : < Translation translationKey = "definitionTooltip" /> ,
43- desc : < Translation translationKey = "definitionTooltipDesc " /> ,
43+ desc : < Translation translationKey = "definitionTooltipDescription " /> ,
4444 isShowLabel : false ,
4545 bgColor : "bg-gray-100" ,
4646 textColor : "text-gray-700" ,
4747 } ,
4848 parameters : {
4949 label : < Translation translationKey = "argument" /> ,
50- desc : < Translation translationKey = "argumentDesc " /> ,
50+ desc : < Translation translationKey = "argumentDescription " /> ,
5151 isShowLabel : false ,
5252 bgColor : "bg-gray-100" ,
5353 textColor : "text-gray-700" ,
5454 } ,
5555 variadic : {
5656 label : < Translation translationKey = "variadic" /> ,
57- desc : < Translation translationKey = "variadicDesc " /> ,
57+ desc : < Translation translationKey = "variadicDescription " /> ,
5858 isShowLabel : true ,
5959 bgColor : "bg-green-50" ,
6060 textColor : "text-green-700" ,
6161 } ,
6262 settable : {
6363 label : < Translation translationKey = "settable" /> ,
64- desc : < Translation translationKey = "settableDesc " /> ,
64+ desc : < Translation translationKey = "settableDescription " /> ,
6565 isShowLabel : true ,
6666 bgColor : "bg-amber-50" ,
6767 textColor : "text-amber-700" ,
6868 } ,
6969 positional : {
7070 label : < Translation translationKey = "positional" /> ,
71- desc : < Translation translationKey = "positionalDesc " /> ,
71+ desc : < Translation translationKey = "positionalDescription " /> ,
7272 isShowLabel : true ,
7373 bgColor : "bg-purple-50" ,
7474 textColor : "text-purple-700" ,
7575 } ,
7676 required : {
7777 label : < Translation translationKey = "required" /> ,
78- desc : < Translation translationKey = "requiredDesc " /> ,
78+ desc : < Translation translationKey = "requiredDescription " /> ,
7979 isShowLabel : true ,
8080 bgColor : "bg-rose-50" ,
8181 textColor : "text-rose-700" ,
@@ -101,7 +101,7 @@ export const Tooltip: FC<TooltipProps> = ({ kind }) => {
101101 < button
102102 type = "button"
103103 class = "w-4 h-4 hover:bg-black/10 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 cursor-pointer"
104- aria-label = { `${ content . label } ${ t ( "ariaShowInformation" ) } ` }
104+ aria-label = { `${ content . label } ${ translation . showInformation ( { name : String ( content . label ) } ) } ` }
105105 tabindex = { 0 }
106106 { ...{ "x-on:click" : "helpOpen = true" } }
107107 { ...{ "x-on:keydown.enter" : "helpOpen = true" } }
@@ -146,7 +146,7 @@ export const Tooltip: FC<TooltipProps> = ({ kind }) => {
146146 { ...{ "x-on:click" : "helpOpen = false" } }
147147 { ...{ "x-on:keydown.enter" : "helpOpen = false" } }
148148 { ...{ "x-on:keydown.space" : "helpOpen = false" } }
149- aria-label = { t ( "ariaClose" ) }
149+ aria-label = { translation . close ( ) }
150150 >
151151 < div class = "w-6 h-6" >
152152 < CloseIcon />
0 commit comments