Skip to content

Commit d1e64af

Browse files
authored
refactor: migrate Abbr to Tailwind (#19242)
1 parent 5225c56 commit d1e64af

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

site/src/components/Abbr/Abbr.stories.tsx

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ export const InlinedShorthand: Story = {
2525
},
2626
decorators: [
2727
(Story) => (
28-
<p css={{ maxWidth: "40em" }}>
28+
<p className="max-w-2xl">
2929
The physical pain of getting bonked on the head with a cartoon mallet
3030
lasts precisely 593{" "}
31-
<span css={styles.underlined}>
31+
<span className="underline decoration-dotted">
3232
<Story />
3333
</span>
3434
. The emotional turmoil and complete embarrassment lasts forever.
@@ -45,7 +45,7 @@ export const Acronym: Story = {
4545
},
4646
decorators: [
4747
(Story) => (
48-
<span css={styles.underlined}>
48+
<span className="underline decoration-dotted">
4949
<Story />
5050
</span>
5151
),
@@ -60,16 +60,9 @@ export const Initialism: Story = {
6060
},
6161
decorators: [
6262
(Story) => (
63-
<span css={styles.underlined}>
63+
<span className="underline decoration-dotted">
6464
<Story />
6565
</span>
6666
),
6767
],
6868
};
69-
70-
const styles = {
71-
// Just here to make the abbreviated part more obvious in the component library
72-
underlined: {
73-
textDecoration: "underline dotted",
74-
},
75-
};

site/src/components/Abbr/Abbr.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { FC, HTMLAttributes } from "react";
2+
import { cn } from "utils/cn";
23

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

@@ -29,10 +30,12 @@ export const Abbr: FC<AbbrProps> = ({
2930
// always have to supplement with aria-label
3031
title={title}
3132
aria-label={getAccessibleLabel(children, title, pronunciation)}
32-
css={{
33-
textDecoration: "inherit",
34-
letterSpacing: children === children.toUpperCase() ? "0.02em" : "0",
35-
}}
33+
className={cn(
34+
"decoration-inherit",
35+
children === children.toUpperCase()
36+
? "tracking-wide"
37+
: "tracking-normal",
38+
)}
3639
{...delegatedProps}
3740
>
3841
<span aria-hidden>{children}</span>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy