Skip to content

Commit 43776be

Browse files
authored
[Banner] Fix content size (#8256)
### WHY are these changes introduced? Fixes some unexpected behaviour with the `Bleed` component content width ### WHAT is this pull request doing? Content inside `Bleed` shouldn't extend past the intended content area
1 parent 31abdab commit 43776be

File tree

5 files changed

+34
-4
lines changed

5 files changed

+34
-4
lines changed

.changeset/blue-queens-walk.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@shopify/polaris': patch
3+
---
4+
5+
- Fixed `Bleed` width behavior
6+
- Fixed `Banner` content width

polaris-react/src/components/Banner/Banner.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,11 @@
158158
// stylelint-enable selector-max-class, selector-max-specificity
159159
}
160160

161+
.ContentWrapper {
162+
margin-top: calc(-1 * var(--p-space-05));
163+
flex: 1 1 auto;
164+
}
165+
161166
.withinContentContainer {
162167
padding: var(--p-space-4);
163168

polaris-react/src/components/Banner/Banner.stories.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
import React, {useCallback, useEffect, useRef, useState} from 'react';
22
import type {ComponentMeta} from '@storybook/react';
33
import {
4+
AlphaStack,
45
Banner,
56
Button,
67
Card,
8+
Inline,
79
Link,
810
List,
911
Modal,
12+
Text,
1013
TextContainer,
1114
} from '@shopify/polaris';
1215

@@ -186,3 +189,21 @@ export function InACard() {
186189
</Card>
187190
);
188191
}
192+
193+
export function WithEndJustifiedContent() {
194+
return (
195+
<Banner status="critical">
196+
<AlphaStack gap="1" fullWidth>
197+
<Inline align="space-between">
198+
<Text variant="headingMd" fontWeight="semibold" as="h3">
199+
Deployment failed in 5min
200+
</Text>
201+
<Link external url="https://example.com">
202+
Logs
203+
</Link>
204+
</Inline>
205+
<p>This order was archived on March 7, 2017 at 3:12pm EDT.</p>
206+
</AlphaStack>
207+
</Banner>
208+
);
209+
}

polaris-react/src/components/Banner/Banner.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import {Icon, IconProps} from '../Icon';
2626
import {WithinContentContext} from '../../utilities/within-content-context';
2727
import {Text} from '../Text';
2828
import {Box} from '../Box';
29-
import {Bleed} from '../Bleed';
3029

3130
import styles from './Banner.scss';
3231

@@ -174,10 +173,10 @@ export const Banner = forwardRef<BannerHandles, BannerProps>(function Banner(
174173
<Icon source={iconName} color={iconColor} />
175174
</Box>
176175

177-
<Bleed marginInline="0" marginBlockStart="05">
176+
<div className={styles.ContentWrapper}>
178177
{headingMarkup}
179178
{contentMarkup}
180-
</Bleed>
179+
</div>
181180
</div>
182181
</BannerContext.Provider>
183182
);

polaris-react/src/components/Bleed/Bleed.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
@import '../../styles/common';
22

33
.Bleed {
4-
min-width: 100%;
54
// stylelint-disable -- Polaris component custom properties
65
--pc-bleed-margin-block-start-xs: initial;
76
--pc-bleed-margin-block-start-sm: var(--pc-bleed-margin-block-start-xs);

0 commit comments

Comments
 (0)