Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

refactor: migrate Abbr to Tailwind#19242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
aslilac merged 3 commits intomainfromlilac/tw-abbr
Aug 7, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletionssite/src/components/Abbr/Abbr.stories.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,10 +25,10 @@ export const InlinedShorthand: Story = {
},
decorators: [
(Story) => (
<pcss={{ maxWidth: "40em" }}>
<pclassName="max-w-2xl">
The physical pain of getting bonked on the head with a cartoon mallet
lasts precisely 593{" "}
<spancss={styles.underlined}>
<spanclassName="underline decoration-dotted">
<Story />
</span>
. The emotional turmoil and complete embarrassment lasts forever.
Expand All@@ -45,7 +45,7 @@ export const Acronym: Story = {
},
decorators: [
(Story) => (
<spancss={styles.underlined}>
<spanclassName="underline decoration-dotted">
<Story />
</span>
),
Expand All@@ -60,16 +60,9 @@ export const Initialism: Story = {
},
decorators: [
(Story) => (
<spancss={styles.underlined}>
<spanclassName="underline decoration-dotted">
<Story />
</span>
),
],
};

const styles = {
// Just here to make the abbreviated part more obvious in the component library
underlined: {
textDecoration: "underline dotted",
},
};
11 changes: 7 additions & 4 deletionssite/src/components/Abbr/Abbr.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
import type { FC, HTMLAttributes } from "react";
import { cn } from "utils/cn";

export type Pronunciation = "shorthand" | "acronym" | "initialism";

Expand DownExpand Up@@ -29,10 +30,12 @@ export const Abbr: FC<AbbrProps> = ({
// always have to supplement with aria-label
title={title}
aria-label={getAccessibleLabel(children, title, pronunciation)}
css={{
textDecoration: "inherit",
letterSpacing: children === children.toUpperCase() ? "0.02em" : "0",
}}
className={cn(
"decoration-inherit",
children === children.toUpperCase()
? "tracking-wide"
: "tracking-normal",
)}
{...delegatedProps}
>
<span aria-hidden>{children}</span>
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp