- {useContainer ? (
-
- {innerContent}
- {dismissableContent}
+ const descriptionChild = childArray.find(
+ (child) =>
+ React.isValidElement(child) &&
+ (child.type === AlertDescription ||
+ (child.type as { displayName?: string })?.displayName ===
+ 'Alert.Description')
+ )
+
+ const footerChild = childArray.find(
+ (child) =>
+ React.isValidElement(child) &&
+ (child.type === AlertFooter ||
+ (child.type as { displayName?: string })?.displayName ===
+ 'Alert.Footer')
+ )
+
+ return (
+
+ {iconChild}
+
+
+ {titleChild}
+ {descriptionChild}
+
+ {footerChild}
- ) : (
- <>
- {innerContent}
- {dismissableContent}
- >
- )}
-
- )
-}
+ {dismissChild}
+
+ )
+ }
+)
+
+// Create compound component
+export const Alert = Object.assign(BaseAlert, {
+ Icon: AlertIcon,
+ Title: AlertTitle,
+ Description: AlertDescription,
+ Footer: AlertFooter,
+ Dismiss: AlertDismiss,
+})
diff --git a/src/components/Alert/types.ts b/src/components/Alert/types.ts
index 6e48fcc9..ebb6c796 100644
--- a/src/components/Alert/types.ts
+++ b/src/components/Alert/types.ts
@@ -4,7 +4,7 @@ export const variants = [
'error',
'warning',
'info',
- 'feature',
+ 'brand',
] as const
export type Variant = (typeof variants)[number]