Skip to content

Commit 887fa3e

Browse files
authored
Merge pull request #378 from belltalion/fix-button-css
2 parents 9ffe795 + c09438a commit 887fa3e

File tree

3 files changed

+51
-8
lines changed

3 files changed

+51
-8
lines changed

.changeset/mean-comics-kick.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@devup-ui/components": patch
3+
---
4+
5+
Fix button css
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
source: libs/extractor/src/lib.rs
3+
assertion_line: 7082
4+
expression: "ToBTreeSet::from(extract(\"test.tsx\",\nr##\"import { jsx as o, jsxs as s } from \"react/jsx-runtime\";\nimport { Button as y, Box as p, Center as F,css as f } from \"@devup-ui/react\";\nimport { clsx as E } from \"clsx\";\nconst g = f({\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\"\n});\n\"##,\nExtractOption\n{\n package: \"@devup-ui/react\".to_string(), css_dir:\n \"@devup-ui/react\".to_string(), single_css: false, import_main_css: false\n}).unwrap())"
5+
---
6+
ToBTreeSet {
7+
styles: {
8+
Static(
9+
ExtractStaticStyle {
10+
property: "overflow",
11+
value: "hidden",
12+
level: 0,
13+
selector: None,
14+
style_order: None,
15+
},
16+
),
17+
Static(
18+
ExtractStaticStyle {
19+
property: "text-overflow",
20+
value: "ellipsis",
21+
level: 0,
22+
selector: None,
23+
style_order: None,
24+
},
25+
),
26+
Static(
27+
ExtractStaticStyle {
28+
property: "white-space",
29+
value: "nowrap",
30+
level: 0,
31+
selector: None,
32+
style_order: None,
33+
},
34+
),
35+
},
36+
code: "import \"@devup-ui/react/devup-ui-0.css\";\nimport { jsx as o, jsxs as s } from \"react/jsx-runtime\";\nimport { clsx as E } from \"clsx\";\nconst g = \"a-a a-b a-c\";\n",
37+
}

packages/components/src/components/Button/index.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
css,
66
type DevupThemeTypography,
77
} from '@devup-ui/react'
8-
import { clsx } from 'clsx'
98

109
type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
1110
variant?: 'primary' | 'default'
@@ -24,12 +23,6 @@ type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
2423
ellipsis?: boolean
2524
}
2625

27-
const buttonTextEllipsis = css({
28-
overflow: 'hidden',
29-
textOverflow: 'ellipsis',
30-
whiteSpace: 'nowrap',
31-
})
32-
3326
export function Button({
3427
variant = 'default',
3528
type = 'button',
@@ -247,7 +240,15 @@ export function Button({
247240
</Center>
248241
)}
249242
<Box
250-
className={clsx(ellipsis && buttonTextEllipsis)}
243+
className={
244+
ellipsis
245+
? css({
246+
overflow: 'hidden',
247+
textOverflow: 'ellipsis',
248+
whiteSpace: 'nowrap',
249+
})
250+
: undefined
251+
}
251252
lineHeight="1.2"
252253
minH="1.2em"
253254
transform={!!icon && 'translateX(8px)'}

0 commit comments

Comments
 (0)