File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,6 +9,14 @@ interface KeyProps {
99 onClick ?: ( ) => void ;
1010}
1111
12+ const shortenHeader = ( header : string ) => {
13+ if ( header . length > 9 ) {
14+ return header ?. split ( / [ \s , - ] + / ) . map ( ( word ) => ( word . substring ( 0 , 3 ) ) ) . join ( "" ) ;
15+ } else {
16+ return header ;
17+ }
18+ }
19+
1220export const Key = ( {
1321 selected = false ,
1422 width,
@@ -31,6 +39,7 @@ export const Key = ({
3139 } }
3240 onClick = { onClick }
3341 >
42+ < div className = { `absolute text-xs ${ selected ? "text-primary-content" : "z1text-base-content" } opacity-80 group-hover:opacity-0 top-1 text-nowrap left-1/2 font-light -translate-x-1/2 text-center transition-opacity` } > { header ? shortenHeader ( header ) : "" } </ div >
3443 < div className = { `absolute text-xs ${ selected ? "text-primary-content" : "z1text-base-content" } opacity-0 group-hover:opacity-80 top-1 text-nowrap left-1/2 font-light -translate-x-1/2 text-center transition-opacity` } > { header } </ div >
3544 { children }
3645 </ button >
You can’t perform that action at this time.
0 commit comments