Skip to content
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

BannerCallout: Revert BannerCallout: message width adjustments (#4007) #4024

Merged
merged 1 commit into from
Mar 3, 2025
Merged
Show file tree
Hide file tree
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
10 changes: 3 additions & 7 deletions packages/gestalt/src/BannerCallout/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@ type Props = {
marginTop: 0 | 4 | 6;
buttonSize: 'md' | 'lg';
fullHeight?: boolean;
wrap?: boolean;
selfAlign?: 'center';
};

export default function Footer({
Expand All @@ -128,8 +126,6 @@ export default function Footer({
checkWrapped = false,
marginTop,
buttonSize,
wrap = true,
selfAlign,
}: Props) {
const wrappedRef = useRef<null | HTMLDivElement>(null);

Expand All @@ -144,14 +140,14 @@ export default function Footer({
marginTop={marginTop}
position="relative"
>
<Flex alignContent="center" gap={2} justifyContent="end" wrap={wrap}>
<Flex alignContent="center" gap={2} justifyContent="end" wrap>
{secondaryAction && (
<Flex.Item alignSelf={selfAlign} flex={isWrapped && checkWrapped ? 'grow' : undefined}>
<Flex.Item flex={isWrapped && checkWrapped ? 'grow' : undefined}>
<Action data={secondaryAction} level="secondary" size={buttonSize} type={type} />
</Flex.Item>
)}
{primaryAction && (
<Flex.Item alignSelf={selfAlign} flex={isWrapped && checkWrapped ? 'grow' : undefined}>
<Flex.Item flex={isWrapped && checkWrapped ? 'grow' : undefined}>
<Box ref={wrappedRef} width="100%">
<Action data={primaryAction} level="primary" size={buttonSize} type={type} />
</Box>
Expand Down
19 changes: 11 additions & 8 deletions packages/gestalt/src/BannerCallout/VRBannerCallout.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { ComponentProps, ReactElement } from 'react';
import { ComponentProps, ReactElement, useRef } from 'react';
import {
SEMA_SPACE_800,
SEMA_SPACE_1200,
} from 'gestalt-design-tokens/dist/js/vr-theme/constants.es';
import DismissButton from './DismissButton';
import Footer from './Footer';
import HeaderSection from './HeaderSection';
import useIsWrappedContainer from './useIsWrappedContainer';
import Box from '../Box';
import Button from '../Button';
import ButtonLink from '../ButtonLink';
Expand Down Expand Up @@ -75,6 +76,9 @@ export default function BannerCallout({

const backgroundColor = MESSAGING_TYPE_ATTRIBUTES[type]?.backgroundColor;

const wrappedRef = useRef<null | HTMLDivElement>(null);
const isWrapped = useIsWrappedContainer(wrappedRef, true);

return (
<Box width="100%">
{/*
Expand Down Expand Up @@ -174,10 +178,10 @@ export default function BannerCallout({
width="100%"
>
<Box position="relative">
<Flex height="100%" width="100%">
<Flex.Item flex="grow" minWidth={0}>
<Flex height="100%" width="100%" wrap>
<Flex.Item flex={isWrapped ? 'grow' : undefined} minWidth={isWrapped ? undefined : 0}>
<HeaderSection
fullWidth
fullWidth={isWrapped}
gap={6}
iconAccessibilityLabel={iconAccessibilityLabel}
iconSize={32}
Expand All @@ -188,15 +192,14 @@ export default function BannerCallout({
</Flex.Item>

{(primaryAction || secondaryAction) && (
<Flex.Item flex="none">
<Flex.Item ref={wrappedRef} flex="grow">
<Footer
buttonSize="lg"
marginTop={0}
fullHeight={isWrapped}
marginTop={isWrapped ? 6 : 0}
primaryAction={primaryAction}
secondaryAction={secondaryAction}
selfAlign="center"
type={type}
wrap={false}
/>
</Flex.Item>
)}
Expand Down
Loading