返回 CodeWhale
arrow-label.tsx
根目录 / web / components / arrow-label.tsx
1 /**
2 * A translated label that ends in a direction arrow ("Install →"). The arrow
3 * is decoration, so screen readers hear only the words.
4 */
5 export function ArrowLabel({ text }: { text: string }) {
6 const match = text.match(/^(.*?)\s*([→←])\s*$/u);
7 if (!match) return <>{text}</>;
8 return (
9 <>
10 {match[1]}
11 <span aria-hidden="true" style={{ marginInlineStart: "0.35em" }}>{match[2]}</span>
12 </>
13 );
14 }
15
15 lines Plain Text