Skip to content

UI: Make banner width match content + round corners #782

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 34 additions & 26 deletions src/components/banner.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
AlertTitle,
Box,
CloseButton,
Container,
useDisclosure,
} from '@chakra-ui/react'

Expand All @@ -16,34 +17,41 @@ export const Banner = ({ title, description, children }) => {
} = useDisclosure({ defaultIsOpen: true })

return isVisible ? (
<Box pt={16} px={20}>
<Alert
status='info'
variant='solid'
alignItems='flex-start' // Align icon nicely with multi-line text
>
<AlertIcon />
<Box flex='1' ml={3}>
{' '}
{/* Container for text content, allows vertical flow */}
<AlertTitle>{title}</AlertTitle>
{description && (
<AlertDescription mt={1}>{description}</AlertDescription>
)}
<Box mt={2}>
<Box pt={16}>
{' '}
{/* This Box provides top padding to clear the header */}
<Container maxW='container.lg'>
{' '}
{/* Constrains the width of the banner */}
<Alert
status='info'
variant='solid'
alignItems='flex-start' // Align icon nicely with multi-line text
borderRadius='md' // Added rounded corners
>
<AlertIcon />
<Box flex='1' ml={3}>
{' '}
{/* Wrapper for children, e.g., links */}
{children}
{/* Container for text content, allows vertical flow */}
<AlertTitle>{title}</AlertTitle>
{description && (
<AlertDescription mt={1}>{description}</AlertDescription>
)}
<Box mt={2}>
{' '}
{/* Wrapper for children, e.g., links */}
{children}
</Box>
</Box>
</Box>
<CloseButton
position='absolute' // Position absolutely within the Alert
alignSelf='flex-start'
right='8px' // Adjust as needed
top='8px' // Adjust as needed
onClick={onClose}
/>
</Alert>
<CloseButton
position='absolute' // Position absolutely within the Alert
alignSelf='flex-start'
right='8px' // Adjust as needed
top='8px' // Adjust as needed
onClick={onClose}
/>
</Alert>
</Container>
</Box>
) : (
<></>
Expand Down