File tree 5 files changed +31
-23
lines changed 5 files changed +31
-23
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @programmer_network/yail" ,
3
- "version" : " 1.0.25 " ,
3
+ "version" : " 1.0.26 " ,
4
4
"description" : " Programmer Network's official UI library for React" ,
5
5
"author" : " Aleksandar Grbic - (https://programmer.network)" ,
6
6
"publishConfig" : {
Original file line number Diff line number Diff line change @@ -5,9 +5,6 @@ import Button from ".";
5
5
const meta = {
6
6
title : "Core/Button" ,
7
7
component : Button ,
8
- parameters : {
9
- layout : "centered"
10
- } ,
11
8
tags : [ "autodocs" ] ,
12
9
argTypes : { }
13
10
} satisfies Meta < typeof Button > ;
Original file line number Diff line number Diff line change @@ -43,7 +43,6 @@ describe("Button component", () => {
43
43
test ( "has correct styles when disabled and filled" , ( ) => {
44
44
render ( < Button disabled > Disabled Button</ Button > ) ;
45
45
const button = screen . getByRole ( "button" ) ;
46
- expect ( button ) . toHaveClass ( "text-primary-background-color" ) ;
47
46
expect ( button ) . toHaveClass ( "!text-bg-primary-background-color" ) ;
48
47
expect ( button ) . toHaveClass ( "!bg-primary" ) ;
49
48
} ) ;
Original file line number Diff line number Diff line change 3
3
exports [` Button component > renders correctly - snapshot test 1` ] = `
4
4
<DocumentFragment >
5
5
<button
6
- class = " select-none border-2 border-primary px-3 py-2 text-sm font-semibold uppercase tracking-tight shadow-lg text-primary-background-color bg-primary hover:bg-transparent hover:text-primary"
6
+ class = " relative select-none border-2 border-primary px-3 py-2 text-sm font-semibold uppercase tracking-tight shadow-lg bg-primary text-primary-background-color hover:bg-transparent hover:text-primary"
7
7
type = " button"
8
8
>
9
9
<div
Original file line number Diff line number Diff line change @@ -14,28 +14,40 @@ const Button: React.FC<IButtonProps> = ({
14
14
isLoading = false ,
15
15
outlined = false
16
16
} ) => {
17
+ let buttonClasses =
18
+ "select-none border-2 border-primary px-3 py-2 text-sm font-semibold uppercase tracking-tight shadow-lg" ;
19
+
20
+ if ( outlined ) {
21
+ if ( disabled ) {
22
+ buttonClasses +=
23
+ " cursor-not-allowed opacity-70 !bg-transparent !text-primary" ;
24
+ } else {
25
+ buttonClasses +=
26
+ " text-primary hover:bg-primary hover:text-primary-background-color" ;
27
+ }
28
+ } else {
29
+ if ( disabled ) {
30
+ buttonClasses +=
31
+ " cursor-not-allowed opacity-70 !text-bg-primary-background-color !bg-primary" ;
32
+ } else {
33
+ buttonClasses +=
34
+ " bg-primary text-primary-background-color hover:bg-transparent hover:text-primary" ;
35
+ if ( isLoading ) {
36
+ buttonClasses += " hover:bg-transparent" ;
37
+ }
38
+ }
39
+ }
40
+
41
+ if ( className ) {
42
+ buttonClasses += ` ${ className } ` ;
43
+ }
44
+
17
45
return (
18
46
< button
19
47
disabled = { disabled }
20
48
onClick = { onClick }
21
49
type = { type }
22
- className = { classNames (
23
- "select-none border-2 border-primary px-3 py-2 text-sm font-semibold uppercase tracking-tight shadow-lg" ,
24
- className ,
25
- {
26
- "cursor-not-allowed opacity-70" : disabled ,
27
- "text-primary" : outlined && ! disabled ,
28
- "text-primary-background-color" : ! outlined || disabled ,
29
- "!text-bg-primary-background-color !bg-primary" :
30
- ! outlined && disabled ,
31
- "hover:bg-transparent" : ! outlined && isLoading ,
32
- "bg-primary hover:bg-transparent hover:text-primary" :
33
- ! outlined && ! disabled ,
34
- "hover:bg-primary hover:text-primary-background-color" :
35
- outlined && ! disabled ,
36
- "!bg-transparent !text-primary" : outlined && disabled
37
- }
38
- ) }
50
+ className = { classNames ( "relative" , buttonClasses ) }
39
51
>
40
52
< div className = 'relative flex items-center justify-center' >
41
53
< span
You can’t perform that action at this time.
0 commit comments