-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DS-352] Map Lozenge orbiter variants to Badge (#480)
- Loading branch information
Showing
6 changed files
with
43 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@hopper-ui/components": patch | ||
--- | ||
|
||
- To ease the transition from Orbiter to Hopper, we want to be able to replace the Lozenge component from Orbiter with the one from Hopper. We have mapped Lozenge variants to their corresponding Badge variants for temporary compatibility. | ||
- Also moved the temporary mapping functions to utils files for maintainability and readability. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import type { BadgeVariant } from "../src/Badge.tsx"; | ||
|
||
// TODO: Remove this when Orbiter is not used anymore | ||
type OrbiterVariant = "informative" | "warning" | "positive" | "negative"; | ||
|
||
function isOrbiterVariant(variant: BadgeVariant | OrbiterVariant): variant is OrbiterVariant { | ||
return ["informative", "warning", "positive", "negative"].includes(variant); | ||
} | ||
|
||
export function mapOrbiterToHopperVariants(variant: BadgeVariant | OrbiterVariant): BadgeVariant { | ||
if (isOrbiterVariant(variant)) { | ||
return "primary"; | ||
} | ||
|
||
return variant; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import type { TagVariant } from "../src/Tag.tsx"; | ||
|
||
// TODO: Remove this when Orbiter is not used anymore | ||
type OrbiterVariant = "informative" | "warning"; | ||
|
||
export function mapOrbiterToHopperVariants(variant: TagVariant | OrbiterVariant): TagVariant { | ||
if (variant === "informative") { | ||
return "option1"; | ||
} | ||
|
||
if (variant === "warning") { | ||
return "option6"; | ||
} | ||
|
||
return variant; | ||
} |