Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
chore: migrate Abbr to tailwind
  • Loading branch information
aslilac committed Aug 7, 2025
commit 285780804554bef1541e643bc072d279a61335a9
15 changes: 4 additions & 11 deletions site/src/components/Abbr/Abbr.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ export const InlinedShorthand: Story = {
},
decorators: [
(Story) => (
<p css={{ maxWidth: "40em" }}>
<p className="max-w-[40em]">
The physical pain of getting bonked on the head with a cartoon mallet
lasts precisely 593{" "}
<span css={styles.underlined}>
<span className="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) => (
<span css={styles.underlined}>
<span className="underline decoration-dotted">
<Story />
</span>
),
Expand All @@ -60,16 +60,9 @@ export const Initialism: Story = {
},
decorators: [
(Story) => (
<span css={styles.underlined}>
<span className="underline decoration-dotted">
<Story />
</span>
),
],
};

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

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

Expand Down Expand Up @@ -29,10 +30,7 @@ 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