Skip to content

Commit

Permalink
perf(component): adjust button hover style & transition.
Browse files Browse the repository at this point in the history
  • Loading branch information
riccox committed Feb 9, 2023
1 parent 520f74a commit 5a6803f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
5 changes: 5 additions & 0 deletions packages/tailwind/src/style/components/button-group.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
@apply flex w-full max-w-fit flex-row flex-wrap;
}

.btn-group > .btn:where(:hover, :focus) {
/* disable hover ring in group */
@apply ring-0;
}

.btn-group.scrollable {
@apply flex-nowrap overflow-auto;
}
Expand Down
16 changes: 12 additions & 4 deletions packages/tailwind/src/style/components/button.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
/* Base Button */
.btn {
@apply rounded-xl cursor-pointer select-none transition-transform outline-none active:scale-[0.97];
@apply rounded-xl cursor-pointer select-none outline-none active:scale-[0.97];
@apply inline-flex items-center justify-center;
@apply text-center font-semibold;
--tw-ring-opacity: 0;
--tw-ring-offset-color: transparent;
--tw-ring-color: rgba(var(--sira-color-400), var(--tw-ring-opacity));
@apply hover:ring focus:ring ease-in-out duration-300;
transition-property: all;
}
.btn:where(:hover, :focus) {
--tw-ring-opacity: 0.5;
}

/* Solid */
Expand All @@ -25,7 +33,7 @@

/* Outline */
.btn.outline {
@apply border-2 bg-transparent transition-all;
@apply border-2 bg-transparent;
border-color: rgb(var(--sira-color-500));
--tw-text-opacity: 1;
color: rgba(var(--sira-color-500), var(--tw-text-opacity));
Expand Down Expand Up @@ -58,12 +66,12 @@
.btn.ghost {
--tw-text-opacity: 1;
color: rgba(var(--sira-color-1000), var(--tw-text-opacity));
@apply border-none bg-transparent transition-all;
@apply border-none bg-transparent;
}

.btn.ghost:hover {
--tw-bg-opacity: 1;
background-color: rgba(var(--sira-color-300), var(--tw-bg-opacity));
background-color: rgba(var(--sira-color-400), var(--tw-bg-opacity));
}

/* Button Sizes */
Expand Down

0 comments on commit 5a6803f

Please sign in to comment.