diff --git a/CHANGELOG.mdx b/CHANGELOG.mdx index 6021d9421..72f131e1c 100644 --- a/CHANGELOG.mdx +++ b/CHANGELOG.mdx @@ -16,6 +16,14 @@ Prefix the change with one of these keywords: ## [Unreleased] +### Added + +- Check in alert if content exists + +### Changed + +- PageHeader padding and margin + ## [0.8.10] ### Added diff --git a/lib/components/Alert/Alert.tsx b/lib/components/Alert/Alert.tsx index 661f8c10a..a493f445a 100644 --- a/lib/components/Alert/Alert.tsx +++ b/lib/components/Alert/Alert.tsx @@ -52,7 +52,7 @@ export const Alert = ({ title, content, type, textSize = 'small' }: PropsWithChi })}
{title}
-{content}
+ {content &&{content}
} {
const HeaderComponent = as
+
+ // Set spacing for header with underline
+ let headerPadding
+ let headerMargin
+ let contentStyle
+
+ switch (size) {
+ case 'xs':
+ headerPadding = 'pb-4'
+ headerMargin = 'mb-6'
+ contentStyle = 'prose-md md:prose-lg'
+ break
+ case 'sm':
+ headerPadding = 'pb-5'
+ headerMargin = 'mb-6'
+ contentStyle = 'prose-md md:prose-lg'
+ break
+ case 'md':
+ headerPadding = 'pb-6'
+ headerMargin = 'mb-10'
+ contentStyle = 'prose-lg md:prose-xl'
+ break
+ case 'lg':
+ headerPadding = 'pb-8'
+ headerMargin = 'mb-10'
+ contentStyle = 'prose-lg md:prose-xl'
+ break
+ default:
+ headerPadding = 'pb-8'
+ headerMargin = 'mb-10'
+ contentStyle = 'prose-lg md:prose-xl'
+ break
+ }
+
const hasUnderline = !noUnderline
- ? 'relative after:absolute after:w-10 after:h-px after:bottom-0 after:bg-cu-red after:left-px'
- : ''
+ ? `relative after:absolute after:w-10 after:h-px after:bottom-0 after:bg-cu-red after:left-px ${headerPadding} ${headerMargin}`
+ : headerMargin
return (
<>
- {content}