Skip to content

Commit

Permalink
Merge pull request #79 from Siumauricio/refactor/#39
Browse files Browse the repository at this point in the history
refactor: change tokens colors to not clash with tailwind colors
  • Loading branch information
Siumauricio committed Mar 4, 2023
2 parents 30f898a + 77b8ede commit d0a1caf
Show file tree
Hide file tree
Showing 68 changed files with 746 additions and 730 deletions.
8 changes: 4 additions & 4 deletions __test__/newVariables.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ import { expect, test } from "vitest";

test("Should return colors with -- in each property", (t) => {
const colorsMap1: any = {
"blue-100": "#fff",
"blue-2": "#fff",
};

const colorsMap2: any = {
"blue-200": "#fff",
"blue-3": "#fff",
};
const result = extractNewVariables(colorsMap1, colorsMap2);

expect(result).toEqual({
"blue-200": expect.any(Function),
"blue-3": expect.any(Function),
});
});

test("Should return empty obj is obj1 is empty", (t) => {
const colorsMap1: any = {
"blue-100": "#fff",
"blue-2": "#fff",
};

const colorsMap2: any = {};
Expand Down
4 changes: 2 additions & 2 deletions __test__/safeList.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ test("should accept the following colors", (t) => {
expect(regex.pattern.test("bg-black")).toBe(true);
expect(regex.pattern.test("bg-blackInverted")).toBe(true);
expect(regex.pattern.test("bg-whiteInverted")).toBe(true);
expect(regex.pattern.test("bg-blue-50")).toBe(true);
expect(regex.pattern.test("bg-blue-100")).toBe(true);
expect(regex.pattern.test("bg-blue-1")).toBe(true);
expect(regex.pattern.test("bg-blue-2")).toBe(true);
});

test("should not accept the following colors", (t) => {
Expand Down
4 changes: 2 additions & 2 deletions __test__/theme.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ test("it should merge 2 object", (t) => {
prefersColorScheme: false,
// @ts-ignore
colors: {
"gray-400": "#4a5568",
"gray-500": "#718096",
"gray-5": "#4a5568",
"gray-6": "#718096",
},
};

Expand Down
18 changes: 9 additions & 9 deletions components/informational/accordion.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
}

.accordion {
@apply relative flex flex-col focus:outline-2 focus-visible:outline focus-visible:outline-offset-2 focus-visible:outline-gray-500;
@apply focus-visible:outline-gray-6 relative flex flex-col focus:outline-2 focus-visible:outline focus-visible:outline-offset-2;
}

.accordion-group-secondary .accordion-title {
@apply bg-gray-200;
@apply bg-gray-3;
}

.accordion-group-bordered {
@apply overflow-auto rounded-xl border border-gray-500;
@apply border-gray-6 overflow-auto rounded-xl border;
}

.accordion-title {
@apply relative flex w-full cursor-pointer flex-col border-b border-gray-500 bg-gray-50 py-5 text-left text-xl font-semibold transition-none;
@apply border-gray-6 bg-gray-1 relative flex w-full cursor-pointer flex-col border-b py-5 text-left text-xl font-semibold transition-none;
}

.accordion-group.accordion-group-bordered
Expand Down Expand Up @@ -54,15 +54,15 @@
}

.accordion-group .accordion.accordion-open .accordion-content {
@apply grid-rows-[1fr] border-b border-gray-500 py-5;
@apply border-gray-6 grid-rows-[1fr] border-b py-5;
}

.accordion-toggle:checked ~ .accordion-content {
@apply grid-rows-[1fr] border-b border-gray-500 py-5;
@apply border-gray-6 grid-rows-[1fr] border-b py-5;
}

.accordion:focus .accordion-content {
@apply grid-rows-[1fr] border-b border-gray-500 py-5;
@apply border-gray-6 grid-rows-[1fr] border-b py-5;
}

.accordion-group.accordion-group-hover .accordion-title,
Expand All @@ -80,11 +80,11 @@
.accordion-group.accordion-group-hover
> .accordion.accordion-open
.accordion-title {
@apply bg-gray-200;
@apply bg-gray-3;
}

.accordion-group.accordion-group-hover > .accordion .accordion-title {
@apply hover:bg-gray-200;
@apply hover:bg-gray-3;
}

.accordion-icon {
Expand Down
10 changes: 5 additions & 5 deletions components/informational/alert.css
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
.alert {
@apply relative flex w-full flex-row items-center gap-3 rounded-xl bg-gray-300 p-4;
@apply bg-gray-4 relative flex w-full flex-row items-center gap-3 rounded-xl p-4;
}

.alert-info {
@apply bg-blue-300;
@apply bg-blue-4;
}

.alert-success {
@apply bg-green-300;
@apply bg-green-4;
}

.alert-warning {
@apply bg-yellow-300;
@apply bg-yellow-4;
}

.alert-error {
@apply bg-red-300;
@apply bg-red-4;
}
10 changes: 5 additions & 5 deletions components/informational/avatar.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.avatar {
@apply relative inline-flex h-10 w-10 max-w-xs bg-gray-200 align-top text-xs;
@apply bg-gray-3 relative inline-flex h-10 w-10 max-w-xs align-top text-xs;
}

.avatar > * {
Expand All @@ -23,7 +23,7 @@
}

.avatar-ring {
@apply ring-2 ring-gray-500;
@apply ring-gray-6 ring-2;
}
.avatar-ring-primary {
@apply ring-2 ring-primary;
Expand Down Expand Up @@ -56,11 +56,11 @@

.avatar-online.avatar-squared::before {
transform: translate(50%, -50%);
@apply absolute right-0 top-0 flex h-2 w-2 items-center justify-center overflow-auto rounded-full border-2 border-success bg-green-500 content-[""];
@apply bg-green-6 absolute right-0 top-0 flex h-2 w-2 items-center justify-center overflow-auto rounded-full border-2 border-success content-[""];
}

.avatar-online:not(.avatar-squared)::before {
@apply absolute right-0 block h-2 w-2 overflow-auto rounded-full border-2 border-success bg-green-500 content-[""];
@apply bg-green-6 absolute right-0 block h-2 w-2 overflow-auto rounded-full border-2 border-success content-[""];
}

.avatar-group {
Expand All @@ -81,7 +81,7 @@
.avatar-ring-warning
)
) {
@apply ring-gray-500;
@apply ring-gray-6;
}

.avatar-xs {
Expand Down
16 changes: 8 additions & 8 deletions components/informational/badge.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.badge {
@apply inline-flex items-center whitespace-nowrap rounded-full border border-gray-200 bg-gray-200 py-[0.3rem] px-2 text-center align-middle text-xs font-bold leading-none text-content1;
@apply border-gray-3 bg-gray-3 inline-flex items-center whitespace-nowrap rounded-full border py-[0.3rem] px-2 text-center align-middle text-xs font-bold leading-none text-content1;
}

.badge-primary {
Expand All @@ -23,7 +23,7 @@
}

.badge-outline {
@apply border border-gray-500 bg-transparent text-content1;
@apply border-gray-6 border bg-transparent text-content1;
}

.badge-outline-primary {
Expand All @@ -47,27 +47,27 @@
}

.badge-flat {
@apply border-none bg-transparent bg-gray-300 text-gray-1000;
@apply text-gray-11 bg-gray-4 border-none bg-transparent;
}

.badge-flat-primary {
@apply border-none bg-blue-300 text-blue-1000;
@apply text-blue-11 bg-blue-4 border-none;
}

.badge-flat-secondary {
@apply border-none bg-purple-300 text-purple-1000;
@apply text-purple-11 bg-purple-4 border-none;
}

.badge-flat-success {
@apply border-none bg-green-300 text-green-1000;
@apply text-green-11 bg-green-4 border-none;
}

.badge-flat-error {
@apply border-none bg-red-300 text-red-1000;
@apply text-red-11 bg-red-4 border-none;
}

.badge-flat-warning {
@apply border-none bg-yellow-300 text-yellow-1000;
@apply text-yellow-11 bg-yellow-4 border-none;
}

.badge-xs {
Expand Down
2 changes: 1 addition & 1 deletion components/informational/card.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.card {
@apply flex w-full max-w-sm flex-col gap-2 rounded-xl bg-gray-200 shadow-md;
@apply bg-gray-3 flex w-full max-w-sm flex-col gap-2 rounded-xl shadow-md;
}

.card.card-image-cover img:first-child {
Expand Down
8 changes: 4 additions & 4 deletions components/informational/divider.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@

.divider::before,
.divider-horizontal::before {
@apply h-px w-full bg-gray-500 content-[""];
@apply bg-gray-6 h-px w-full content-[""];
}

.divider::after,
.divider-horizontal::after {
@apply h-px w-full bg-gray-500 content-[""];
@apply bg-gray-6 h-px w-full content-[""];
}

.divider-vertical {
@apply my-0 mx-4 h-full w-4 flex-col;
}

.divider-vertical::before {
@apply h-full w-px bg-gray-500 content-[""];
@apply bg-gray-6 h-full w-px content-[""];
}

.divider-vertical::after {
@apply h-full w-px bg-gray-500 content-[""];
@apply bg-gray-6 h-full w-px content-[""];
}
2 changes: 1 addition & 1 deletion components/informational/dot.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.dot {
@apply inline-flex h-2.5 min-h-[10px] w-2.5 min-w-[10px] select-none rounded-[50%] bg-gray-700 leading-3;
@apply bg-gray-8 inline-flex h-2.5 min-h-[10px] w-2.5 min-w-[10px] select-none rounded-[50%] leading-3;
}

.dot-primary {
Expand Down
2 changes: 1 addition & 1 deletion components/informational/kbd.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.kbd {
@apply inline-flex h-fit items-center justify-center whitespace-nowrap rounded-md border border-gray-500 bg-gray-200 py-1.5 px-2.5 text-xs font-semibold shadow-[0px_1.5px_0px_rgba(0,0,0,0.1)];
@apply border-gray-6 bg-gray-3 inline-flex h-fit items-center justify-center whitespace-nowrap rounded-md border py-1.5 px-2.5 text-xs font-semibold shadow-[0px_1.5px_0px_rgba(0,0,0,0.1)];
}

.kbd-xs {
Expand Down
11 changes: 6 additions & 5 deletions components/informational/menu.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
}

.menu-item {
transition: transform 0.12s ease;
@apply flex cursor-pointer select-none flex-row items-center gap-2 rounded-lg px-4 py-2 text-sm text-content1 hover:bg-gray-300 active:scale-[0.97] active:bg-gray-400;
transition-property: transform, opacity, visibility;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
@apply flex cursor-pointer select-none flex-row items-center gap-2 rounded-lg px-4 py-2 text-sm text-content1 duration-150 will-change-transform hover:bg-gray-4 active:scale-[0.97] active:bg-gray-5;
}

.menu-item-disabled {
Expand All @@ -28,15 +29,15 @@
}

.menu-item.menu-active {
@apply bg-gray-400 transition-none active:scale-[1];
@apply bg-gray-5 transition-none active:scale-[1];
}

.menu-toggle {
@apply hidden;
}

.menu-item-collapse {
transition: padding 0.2s, grid-template-rows 0.2s;
transition: padding 0.15s, grid-template-rows 0.15s;
@apply grid grid-rows-[0fr] overflow-hidden;
}

Expand All @@ -49,7 +50,7 @@
}

.menu-icon {
@apply transition-transform duration-200;
@apply transition-transform duration-300;
}

.menu-toggle:checked ~ .menu-item .menu-icon {
Expand Down
2 changes: 1 addition & 1 deletion components/informational/modal.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ html:has(.modal-state:checked) {
}

.modal-content {
@apply relative h-max max-h-[calc(100%-10%)] max-w-lg scale-90 overflow-auto rounded-xl bg-gray-50 p-6 transition duration-75 ease-in-out;
@apply bg-gray-1 relative h-max max-h-[calc(100%-10%)] max-w-lg scale-90 overflow-auto rounded-xl p-6 transition duration-75 ease-in-out;
}
4 changes: 2 additions & 2 deletions components/informational/pagination.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
}

.pagination .btn {
@apply min-w-[2.5rem] border border-transparent px-0 py-2 hover:bg-gray-300;
@apply hover:bg-gray-4 min-w-[2.5rem] border border-transparent px-0 py-2;
}

.pagination .btn.btn-active {
Expand Down Expand Up @@ -31,7 +31,7 @@
}

.pagination.pagination-bordered .btn {
@apply border border-gray-500;
@apply border-gray-6 border;
}

.pagination.pagination-bordered .btn.btn-active {
Expand Down
5 changes: 2 additions & 3 deletions components/informational/popover.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
.popover-content {
transition-property: transform, opacity, visibility;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 150ms;
@apply invisible absolute left-1/2 right-full z-[49] flex w-56 origin-top -translate-y-2 -translate-x-1/2 scale-95 transform flex-col rounded-xl border border-transparent bg-gray-200 p-2 opacity-0 shadow-lg outline-none;
@apply invisible absolute left-1/2 right-full z-[49] flex w-56 origin-top -translate-y-2 -translate-x-1/2 scale-95 transform flex-col rounded-xl border border-transparent bg-gray-3 p-2 opacity-0 shadow-lg outline-none duration-150 will-change-transform;
}

.popover-bottom-center {
Expand Down Expand Up @@ -149,7 +148,7 @@
@apply visible translate-x-0 translate-y-0 scale-100 opacity-100;
}
.popover-arrow {
@apply absolute h-[0.7rem] w-[0.7rem] border-transparent bg-gray-200;
@apply absolute h-[0.7rem] w-[0.7rem] border-transparent bg-gray-3;
}
.popover-border .popover-content .popover-arrow,
.popover-border .popover-content {
Expand Down

0 comments on commit d0a1caf

Please sign in to comment.