Skip to content

Commit fc44210

Browse files
authored
fix: layout item content margin (#1104)
* fix: add layout item content right margin
1 parent dc04d43 commit fc44210

14 files changed

+35
-3
lines changed
1004 Bytes
Loading
3.33 KB
Loading
Loading
Loading

src/models/constructor-items/common.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export type ContentTextSize = 's' | 'm' | 'l';
8484
export type ContentTheme = 'default' | 'dark' | 'light';
8585
export type FileLinkType = 'vertical' | 'horizontal';
8686
export type ImageCardMargins = 's' | 'm';
87+
export type LayoutItemContentMargin = 'm' | 'l';
8788

8889
// modifiers
8990
export interface Themable {

src/models/constructor-items/sub-blocks.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
ImageCardMargins,
1515
ImageObjectProps,
1616
ImageProps,
17+
LayoutItemContentMargin,
1718
LinkProps,
1819
MediaProps,
1920
MediaView,
@@ -182,6 +183,7 @@ export interface PriceCardProps extends CardBaseProps, Pick<ContentBlockProps, '
182183

183184
export interface LayoutItemProps extends ClassNameProps, CardLayoutProps, AnalyticsEventsBase {
184185
content: Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size'>;
186+
contentMargin?: LayoutItemContentMargin;
185187
media?: ThemeSupporting<MediaProps>;
186188
metaInfo?: string[];
187189
border?: boolean;

src/sub-blocks/LayoutItem/LayoutItem.scss

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
$block: '.#{$ns}layout-item';
55

6+
$contentMarginM: 40px;
7+
$contentMarginL: 80px;
8+
69
#{$block} {
710
display: flex;
811
flex-direction: column;
@@ -26,14 +29,31 @@ $block: '.#{$ns}layout-item';
2629
display: flex;
2730

2831
flex: auto;
29-
margin: $indentXS $indentXS 0 0;
32+
margin-top: $indentXS;
33+
margin-left: 0;
34+
margin-bottom: 0;
3035

3136
&_no-media {
32-
margin: 0;
37+
margin-top: 0;
38+
}
39+
40+
&_margin {
41+
&_m {
42+
margin-right: $contentMarginM;
43+
}
44+
&_l {
45+
margin-right: $contentMarginL;
46+
}
3347
}
3448
}
3549

3650
&__wrapper {
3751
flex: auto;
3852
}
53+
54+
@media (max-width: map-get($gridBreakpoints, 'sm') - 1) {
55+
&__content {
56+
margin-right: 0;
57+
}
58+
}
3959
}

src/sub-blocks/LayoutItem/LayoutItem.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const b = block('layout-item');
1717

1818
const LayoutItem = ({
1919
content: {links, ...content},
20+
contentMargin = 'm',
2021
metaInfo,
2122
media,
2223
border,
@@ -77,7 +78,7 @@ const LayoutItem = ({
7778
<div className={b(null, className)}>
7879
{renderMedia()}
7980
{metaInfo && <MetaInfo items={metaInfo} className={b('meta-info')} />}
80-
<div className={b('content', {'no-media': !media})}>
81+
<div className={b('content', {'no-media': !media, margin: contentMargin})}>
8182
<IconWrapper icon={themedIcon} className={b('wrapper')}>
8283
<Content {...contentProps} titleId={titleId} />
8384
</IconWrapper>

src/sub-blocks/LayoutItem/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
`content: Partial<Content>` - `Content` props (size and justify props like `colSizes`, `centered`, `size` are omitted) (see [Content](?path=/story/components-content--default))
66

7+
`contentMargin?: 'm' | 'l'` — Content right margin ('m' by default)
8+
79
`metaInfo?: string[]` - segmented info string above the content (with YFM support)
810

911
`border?: boolean` — Image border
Loading

0 commit comments

Comments
 (0)