Skip to content

Commit 7cd7fac

Browse files
committed
Cleans up some type definitions
1 parent 4250a03 commit 7cd7fac

File tree

5 files changed

+30
-27
lines changed

5 files changed

+30
-27
lines changed

theme/colors.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
import { ColorStates } from "./constants";
1+
import { States, Variants } from "./constants";
22
import { palette } from "./palette";
33

4-
interface ColorPalette extends ColorStates {
5-
default: string;
6-
hover: string;
7-
pressed: string;
4+
interface ColorPalette {
5+
[States.default]: string;
6+
[States.hover]: string;
7+
[States.pressed]: string;
88
}
99

10-
interface BackgroundPalette extends ColorStates {
11-
default: string;
12-
hover: string;
13-
disabled: string;
10+
interface BackgroundPalette {
11+
[States.default]: string;
12+
[States.hover]: string;
13+
[States.disabled]: string;
1414
}
1515

16-
interface TextPalette extends ColorStates {
17-
primary: string;
18-
secondary: string;
19-
disabled: string;
20-
pressed: string;
16+
interface TextPalette {
17+
[Variants.primary]: string;
18+
[Variants.secondary]: string;
19+
[States.disabled]: string;
20+
[States.pressed]: string;
2121
}
2222

2323
interface Colors {
2424
brand: string;
25-
primary: ColorPalette;
26-
secondary: ColorPalette;
25+
[Variants.primary]: ColorPalette;
26+
[Variants.secondary]: ColorPalette;
2727
success: string;
2828
warning: string;
2929
danger: string;

theme/constants.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
interface ColorStates {
2-
hover?: string;
3-
pressed?: string;
4-
disabled?: string;
1+
enum States {
2+
default = "default",
3+
hover = "hover",
4+
pressed = "pressed",
5+
disabled = "disabled"
56
}
67

78
enum Sizes {
@@ -25,4 +26,4 @@ enum Variants {
2526
inverse = "inverse"
2627
}
2728

28-
export { ColorStates, Sizes, Headers, Variants };
29+
export { States, Sizes, Headers, Variants };

theme/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Sizes, Variants, Headers } from "./constants";
1+
import { States, Sizes, Variants, Headers } from "./constants";
22
import { palette } from "./palette";
33
import { Theme } from "./theme";
44

5-
export { Theme, Sizes, Variants, Headers, palette };
5+
export { Theme, States, Sizes, Variants, Headers, palette };

theme/shadows.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
import { States } from "./constants";
2+
13
interface Shadows {
2-
default: string;
3-
hover: string;
4+
[States.default]: string;
5+
[States.hover]: string;
46
}
57

68
const SHADOW_DEFAULT = "0px 1px 3px rgba(0, 0, 0, 0.07)";

theme/units.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const space: number[] = [5, 10, 15, 20, 25, 30, 40, 50, 60, 70, 80, 90, 100];
2-
const radii: number[] = [6];
1+
const space = [5, 10, 15, 20, 25, 30, 40, 50, 60, 70, 80, 90, 100];
2+
const radii = [6];
33

44
export { space, radii };

0 commit comments

Comments
 (0)