Skip to content

Commit d7df20e

Browse files
Nemobotgabro
Nemobot
authored andcommitted
expose default config
1 parent 0fb8555 commit d7df20e

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

Diff for: src/Chip/createChip.tsx

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { ComponentProps, FunctionComponent } from "react";
22
import { IconProps } from "../Icons/IconProps";
33
import { Label, LocalizedString, IconButton, BoxProps, BoxType } from "..";
4+
import { IconClose } from "../Icons/IconClose";
45
import { Column, Columns, BentoSprinkles, bentoSprinkles } from "../internal";
56
import { chip } from "./Chip.css";
67
import { useDefaultMessages } from "../util/useDefaultMessages";
@@ -44,7 +45,7 @@ type ChipConfig<AtomsFn extends typeof bentoSprinkles, CustomColor extends strin
4445
};
4546
};
4647

47-
const defaultColorsMapping: { [k in DefaultColor]: BentoSprinkles["background"] } = {
48+
const defaultColorsMapping: Record<DefaultColor, BentoSprinkles["background"]> = {
4849
grey: "softGrey",
4950
red: "softRed",
5051
orange: "softOrange",
@@ -92,3 +93,13 @@ export function createChip<AtomsFn extends typeof bentoSprinkles, CustomColors e
9293
);
9394
};
9495
}
96+
97+
export const defaultChipConfig: ChipConfig<typeof bentoSprinkles, string> = {
98+
paddingX: 8,
99+
paddingY: 4,
100+
labelSize: "small",
101+
closeIcon: IconClose,
102+
closeIconSize: 8,
103+
internalSpacing: 8,
104+
customColors: {},
105+
};

Diff for: stories/index.tsx

+2-7
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import {
2626
createFeedback,
2727
IllustrationNegative,
2828
IllustrationPositive,
29-
IconClose,
29+
defaultChipConfig,
3030
} from "../src";
3131
import { sprinkles } from "./sprinkles.css";
3232

@@ -52,12 +52,7 @@ export const Link = createLink();
5252
export const Breadcrumb = createBreadcrumb(Link);
5353
export const Modal = createModal(Actions);
5454
export const Chip = createChip(Box, {
55-
paddingX: 8,
56-
paddingY: 4,
57-
labelSize: "small",
58-
closeIcon: IconClose,
59-
closeIconSize: 8,
60-
internalSpacing: 8,
55+
...defaultChipConfig,
6156
customColors: {
6257
custom: "customColor1",
6358
},

0 commit comments

Comments
 (0)