Skip to content

Commit 8f7767b

Browse files
committed
Centralizes BootstrapVariant type definition
Moves the BootstrapVariant type definition to a common index file and imports it in the files that previously had duplicate definitions. Eliminates code duplication and ensures consistency across components by having a single source of truth for Bootstrap variant types. Adds missing "outline-link" variant to the centralized definition.
1 parent a0c3b51 commit 8f7767b

File tree

3 files changed

+26
-40
lines changed

3 files changed

+26
-40
lines changed

client/src/components/Common/GCard.types.ts

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,11 @@
11
import type { SizeProp } from "@fortawesome/fontawesome-svg-core";
22
import type { IconDefinition } from "@fortawesome/free-solid-svg-icons";
33

4+
import type { BootstrapVariant } from "@/components/Common";
5+
46
/** Card badge display styles */
57
export type CardBadgeType = "pill" | "badge";
68

7-
/** Bootstrap color variants for theming */
8-
export type BootstrapVariant =
9-
| "danger"
10-
| "dark"
11-
| "info"
12-
| "light"
13-
| "link"
14-
| "primary"
15-
| "secondary"
16-
| "success"
17-
| "warning"
18-
| "outline-danger"
19-
| "outline-dark"
20-
| "outline-info"
21-
| "outline-light"
22-
| "outline-primary"
23-
| "outline-secondary"
24-
| "outline-success"
25-
| "outline-warning";
26-
279
/** Bootstrap component sizes */
2810
export type BootstrapSize = "xs" | "sm" | "md" | "lg" | "xl";
2911

client/src/components/Common/index.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,29 @@
11
import type { IconDefinition } from "@fortawesome/fontawesome-svg-core";
22
import type { RawLocation } from "vue-router";
33

4+
/**
5+
* Bootstrap Vue variants for styling components.
6+
*/
7+
export type BootstrapVariant =
8+
| "primary"
9+
| "secondary"
10+
| "success"
11+
| "danger"
12+
| "warning"
13+
| "info"
14+
| "light"
15+
| "link"
16+
| "dark"
17+
| "outline-primary"
18+
| "outline-secondary"
19+
| "outline-success"
20+
| "outline-danger"
21+
| "outline-warning"
22+
| "outline-info"
23+
| "outline-light"
24+
| "outline-link"
25+
| "outline-dark";
26+
427
// TODO: Not sure if this is the best place for this type
528
export type ColorVariant = "primary" | "secondary" | "success" | "danger" | "warning" | "info" | "light" | "dark";
629

client/src/composables/confirmDialog.ts

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,6 @@
11
import { type Ref, ref } from "vue";
22

3-
/**
4-
* Bootstrap Vue variants for styling components.
5-
*/
6-
export type BootstrapVariant =
7-
| "primary"
8-
| "secondary"
9-
| "success"
10-
| "warning"
11-
| "danger"
12-
| "info"
13-
| "light"
14-
| "dark"
15-
| "outline-primary"
16-
| "outline-secondary"
17-
| "outline-success"
18-
| "outline-warning"
19-
| "outline-danger"
20-
| "outline-info"
21-
| "outline-light"
22-
| "outline-dark";
3+
import type { BootstrapVariant } from "@/components/Common";
234

245
/**
256
* Bootstrap Vue modal message box options interface.

0 commit comments

Comments
 (0)