Skip to content
This repository was archived by the owner on Jan 20, 2022. It is now read-only.

Update themed components to respect theme from SpaceKitProvider #352

Merged
merged 10 commits into from
Jun 2, 2021
6 changes: 5 additions & 1 deletion src/AlertBanner/AlertBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { IconInfoSolid } from "../icons/IconInfoSolid";
import { IconWarningSolid } from "../icons/IconWarningSolid";
import { IconErrorSolid } from "../icons/IconErrorSolid";
import { IconSuccessSolid } from "../icons/IconSuccessSolid";
import { useSpaceKitProvider } from "../SpaceKitProvider";

interface AlertBannerProps {
/**
Expand Down Expand Up @@ -45,10 +46,13 @@ interface AlertBannerProps {
export const AlertBanner: React.FC<AlertBannerProps> = ({
children,
childrenContainerAs = "div",
theme = "light",
theme: propTheme,
type,
...otherProps
}) => {
const { theme: providerTheme } = useSpaceKitProvider();
const theme = propTheme || providerTheme;

const { Icon, color } = useMemo(() => {
switch (type) {
case "info":
Expand Down
6 changes: 5 additions & 1 deletion src/AlertCard/AlertCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { IconWarningSolid } from "../icons/IconWarningSolid";
import { IconErrorSolid } from "../icons/IconErrorSolid";
import { IconSuccessSolid } from "../icons/IconSuccessSolid";
import { Button } from "../Button";
import { useSpaceKitProvider } from "../SpaceKitProvider";

interface AlertCardProps {
/**
Expand Down Expand Up @@ -83,11 +84,14 @@ export const AlertCard: React.FC<AlertCardProps> = ({
actions,
headingAs = "h2",
children,
theme = "light",
theme: propTheme,
extended = false,
type,
...otherProps
}) => {
const { theme: providerTheme } = useSpaceKitProvider();
const theme = propTheme || providerTheme;

const { Icon, color } = useMemo(() => {
switch (type) {
case "info":
Expand Down
Loading