Skip to content

Commit 3cb4366

Browse files
authored
Merge pull request #124 from buildo/4602108-area_loader_configuration_update
#4602108: Area Loader configuration update
2 parents dc52f8f + 8205b87 commit 3cb4366

File tree

3 files changed

+34
-9
lines changed

3 files changed

+34
-9
lines changed
+7-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1+
import { BentoSprinkles } from "../internal";
2+
13
type DotConfig = {
24
color: "brandPrimary" | "brandSecondary" | "brandTertiary";
35
};
46
export type AreaLoaderConfig = {
57
dots: DotConfig[];
6-
overlay: "light" | "dark";
7-
visibilityAreaColor: "primary" | "secondary" | "primary-inverse" | "secondary-inverse";
8+
scrimColor: "light" | "dark";
9+
messageSize: "small" | "medium" | "large";
10+
messageColor: "primary" | "primary-inverse";
11+
readabilityAreaColor: "primary" | "secondary" | "primary-inverse" | "secondary-inverse";
12+
readabilityAreaBorderRadius: BentoSprinkles["borderRadius"];
813
};

Diff for: packages/bento-design-system/src/AreaLoader/createAreaLoader.tsx

+22-5
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ import { BentoSprinkles, bentoSprinkles, Box, Inline, Stack } from "../internal"
33
import { container, dot, text } from "./AreaLoader.css";
44
import { Body, LocalizedString } from "..";
55
import { AreaLoaderConfig } from "./Config";
6+
import { BodyProps } from "../Typography/Body/Body";
67

7-
function visibilityAreaColorToBackground(
8-
color: AreaLoaderConfig["visibilityAreaColor"]
8+
function readabilityAreaColorToBackground(
9+
color: AreaLoaderConfig["readabilityAreaColor"]
910
): BentoSprinkles["background"] {
1011
switch (color) {
1112
case "primary":
@@ -19,6 +20,15 @@ function visibilityAreaColorToBackground(
1920
}
2021
}
2122

23+
function messageColorToBodyColor(color: AreaLoaderConfig["messageColor"]): BodyProps["color"] {
24+
switch (color) {
25+
case "primary":
26+
return "default";
27+
case "primary-inverse":
28+
return "primaryInverse";
29+
}
30+
}
31+
2232
type Props = {
2333
message?: LocalizedString;
2434
};
@@ -46,14 +56,16 @@ export function createAreaLoader(config: AreaLoaderConfig) {
4656
className={clsx(
4757
container,
4858
bentoSprinkles({
49-
background: config.overlay === "dark" ? "backgroundDarkScrim" : "backgroundLightScrim",
59+
background:
60+
config.scrimColor === "dark" ? "backgroundDarkScrim" : "backgroundLightScrim",
5061
})
5162
)}
5263
>
5364
<Box
5465
padding={80}
5566
className={bentoSprinkles({
56-
background: visibilityAreaColorToBackground(config.visibilityAreaColor),
67+
background: readabilityAreaColorToBackground(config.readabilityAreaColor),
68+
borderRadius: config.readabilityAreaBorderRadius,
5769
})}
5870
>
5971
<Stack space={32}>
@@ -70,7 +82,12 @@ export function createAreaLoader(config: AreaLoaderConfig) {
7082
</Inline>
7183
{message && (
7284
<Box className={text}>
73-
<Body size="medium">{message}</Body>
85+
<Body
86+
size={config.messageSize}
87+
color={messageColorToBodyColor(config.messageColor)}
88+
>
89+
{message}
90+
</Body>
7491
</Box>
7592
)}
7693
</Stack>

Diff for: packages/bento-design-system/src/util/defaultConfigs.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,11 @@ export const actions: ActionsConfig = {
5353

5454
export const areaLoader: AreaLoaderConfig = {
5555
dots: [{ color: "brandPrimary" }, { color: "brandSecondary" }, { color: "brandTertiary" }],
56-
overlay: "light",
57-
visibilityAreaColor: "primary",
56+
scrimColor: "light",
57+
messageColor: "primary",
58+
messageSize: "medium",
59+
readabilityAreaColor: "primary",
60+
readabilityAreaBorderRadius: undefined,
5861
};
5962

6063
export const avatar: AvatarConfig = {

0 commit comments

Comments
 (0)