Skip to content

Commit d10aff9

Browse files
committed
feat: add variant prop to Layout.Section
1 parent 4004305 commit d10aff9

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

.changeset/silly-ligers-heal.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@shopify/polaris': minor
3+
---
4+
5+
Deprecated `secondary`, `fullWidth`, `oneHalf`, `oneThird` props on Layout.Section
6+
Added variant prop to Layout.Section to replace boolean props

polaris-react/src/components/Layout/components/Section/Section.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@ import styles from '../../Layout.scss';
55

66
export interface SectionProps {
77
children?: React.ReactNode;
8+
/** @deprecated Use `variant === 'oneThird'` instead */
89
secondary?: boolean;
10+
/** @deprecated Use `variant === 'fullWidth'` instead */
911
fullWidth?: boolean;
12+
/** @deprecated Use `variant === 'oneHalf'` instead */
1013
oneHalf?: boolean;
14+
/** @deprecated Use `variant === 'oneThird'` instead */
1115
oneThird?: boolean;
16+
variant?: 'oneHalf' | 'oneThird' | 'fullWidth';
1217
}
1318

1419
export function Section({
@@ -17,13 +22,14 @@ export function Section({
1722
fullWidth,
1823
oneHalf,
1924
oneThird,
25+
variant,
2026
}: SectionProps) {
2127
const className = classNames(
2228
styles.Section,
2329
secondary && styles['Section-secondary'],
24-
fullWidth && styles['Section-fullWidth'],
25-
oneHalf && styles['Section-oneHalf'],
26-
oneThird && styles['Section-oneThird'],
30+
(oneHalf || variant === 'oneHalf') && styles['Section-oneHalf'],
31+
(oneThird || variant === 'oneThird') && styles['Section-oneThird'],
32+
(fullWidth || variant === 'fullWidth') && styles['Section-fullWidth'],
2733
);
2834

2935
return <div className={className}>{children}</div>;

0 commit comments

Comments
 (0)