diff --git a/src/sub-blocks/BackgroundCard/BackgroundCard.scss b/src/sub-blocks/BackgroundCard/BackgroundCard.scss
index 62862fab5..69dfbee80 100644
--- a/src/sub-blocks/BackgroundCard/BackgroundCard.scss
+++ b/src/sub-blocks/BackgroundCard/BackgroundCard.scss
@@ -55,6 +55,15 @@ $block: '.#{$ns}background-card';
object-position: left;
}
}
+
+ &__footer {
+ margin-top: 0px;
+ }
+
+ &__links,
+ &__buttons {
+ margin-top: $indentXS;
+ }
}
a#{$block} {
diff --git a/src/sub-blocks/BackgroundCard/BackgroundCard.tsx b/src/sub-blocks/BackgroundCard/BackgroundCard.tsx
index 66dc63467..24deca4a2 100644
--- a/src/sub-blocks/BackgroundCard/BackgroundCard.tsx
+++ b/src/sub-blocks/BackgroundCard/BackgroundCard.tsx
@@ -1,14 +1,12 @@
-import React, {useMemo} from 'react';
+import React from 'react';
import {useUniqId} from '@gravity-ui/uikit';
-import {BackgroundImage, CardBase} from '../../components/';
+import {BackgroundImage, Buttons, CardBase, Links} from '../../components/';
import {useTheme} from '../../context/theme';
import {BackgroundCardProps} from '../../models';
import {block, getThemedValue} from '../../utils';
-import renderContentControls from '../../utils/renderContentControls/renderContentControls';
import Content from '../Content/Content';
-import renderCardFooterControlsContainer from '../renderCardFooterControlsContainer/renderCardFooterControlsContainer';
import './BackgroundCard.scss';
@@ -39,20 +37,6 @@ const BackgroundCard = (props: BackgroundCardProps) => {
const borderType = hasBackgroundColor ? 'none' : border;
const areControlsInFooter = !paddingBottom && controlPosition === 'footer';
- const footerControls = useMemo(
- () =>
- renderContentControls(
- {
- links: areControlsInFooter ? links : undefined,
- buttons: areControlsInFooter ? buttons : undefined,
- size: 's',
- titleId,
- },
- renderCardFooterControlsContainer,
- ),
- [areControlsInFooter, links, buttons, titleId],
- );
-
return (
{
colSizes={{all: 12, md: 12}}
/>
- {footerControls}
+ {areControlsInFooter && (links || buttons) && (
+
+
+
+
+ )}
);
};
diff --git a/src/sub-blocks/BasicCard/BasicCard.scss b/src/sub-blocks/BasicCard/BasicCard.scss
index 70f51003d..93df4c64b 100644
--- a/src/sub-blocks/BasicCard/BasicCard.scss
+++ b/src/sub-blocks/BasicCard/BasicCard.scss
@@ -7,4 +7,13 @@ $block: '.#{$ns}basic-card';
@include add-specificity(&) {
min-height: auto;
}
+
+ &__footer {
+ margin-top: 0px;
+ }
+
+ &__links,
+ &__buttons {
+ margin-top: $indentXS;
+ }
}
diff --git a/src/sub-blocks/BasicCard/BasicCard.tsx b/src/sub-blocks/BasicCard/BasicCard.tsx
index 342adbcdd..8fb4622e9 100644
--- a/src/sub-blocks/BasicCard/BasicCard.tsx
+++ b/src/sub-blocks/BasicCard/BasicCard.tsx
@@ -1,14 +1,12 @@
-import React, {useMemo} from 'react';
+import React from 'react';
import {useUniqId} from '@gravity-ui/uikit';
-import {CardBase, IconWrapper} from '../../components';
+import {Buttons, CardBase, IconWrapper, Links} from '../../components';
import {BasicCardProps} from '../../models';
import {IconPosition} from '../../models/constructor-items/sub-blocks';
import {block} from '../../utils';
-import renderContentControls from '../../utils/renderContentControls/renderContentControls';
import Content from '../Content/Content';
-import renderCardFooterControlsContainer from '../renderCardFooterControlsContainer/renderCardFooterControlsContainer';
import './BasicCard.scss';
@@ -30,19 +28,6 @@ const BasicCard = (props: BasicCardProps) => {
const titleId = useUniqId();
const descriptionId = useUniqId();
const areControlsInFooter = controlPosition === 'footer';
- const footerControls = useMemo(
- () =>
- renderContentControls(
- {
- links: areControlsInFooter ? links : undefined,
- buttons: areControlsInFooter ? buttons : undefined,
- size: 's',
- titleId,
- },
- renderCardFooterControlsContainer,
- ),
- [areControlsInFooter, links, buttons, titleId],
- );
return (
{
/>
- {footerControls}
+ {areControlsInFooter && (buttons || links) && (
+
+
+
+
+ )}
);
};
diff --git a/src/sub-blocks/Content/Content.scss b/src/sub-blocks/Content/Content.scss
index 29328aa7e..c8ff1fbd9 100644
--- a/src/sub-blocks/Content/Content.scss
+++ b/src/sub-blocks/Content/Content.scss
@@ -87,7 +87,9 @@ $darkSecondary: var(--g-color-text-dark-secondary);
}
}
- #{$block}__list {
+ #{$block}__list,
+ #{$block}__links,
+ #{$block}__buttons {
margin-top: $indentXS;
}
}
@@ -110,7 +112,9 @@ $darkSecondary: var(--g-color-text-dark-secondary);
@include text-size(body-3);
}
- #{$block}__list {
+ #{$block}__list,
+ #{$block}__links,
+ #{$block}__buttons {
margin-top: $indentSM;
}
}
diff --git a/src/sub-blocks/Content/Content.tsx b/src/sub-blocks/Content/Content.tsx
index c49ff65c0..64d879159 100644
--- a/src/sub-blocks/Content/Content.tsx
+++ b/src/sub-blocks/Content/Content.tsx
@@ -1,14 +1,13 @@
-import React, {useMemo} from 'react';
+import React from 'react';
import {useUniqId} from '@gravity-ui/uikit';
-import {ContentList, Title, YFMWrapper} from '../../components';
+import {Buttons, ContentList, Links, Title, YFMWrapper} from '../../components';
import {Col} from '../../grid';
import {ClassNameProps, ContentBlockProps, ContentSize, TitleItemProps} from '../../models';
import {QAProps} from '../../models/common';
import {block} from '../../utils';
import {getQaAttrubutes} from '../../utils/blocks';
-import renderContentControls from '../../utils/renderContentControls/renderContentControls';
import './Content.scss';
@@ -54,18 +53,6 @@ const Content = (props: ContentProps) => {
const defaultTitleId = useUniqId();
const titleId = titleIdFromProps || defaultTitleId;
- const controls = useMemo(
- () =>
- renderContentControls({
- size,
- links,
- buttons,
- titleId,
- qa: qaAttributes,
- }),
- [size, links, buttons, titleId, qaAttributes],
- );
-
return (
{
/>
)}
- {controls}
+ {links && (
+
+ )}
+ {buttons && (
+
+ )}
);
};
diff --git a/src/sub-blocks/LayoutItem/LayoutItem.scss b/src/sub-blocks/LayoutItem/LayoutItem.scss
index 8370360b3..222a7d5c6 100644
--- a/src/sub-blocks/LayoutItem/LayoutItem.scss
+++ b/src/sub-blocks/LayoutItem/LayoutItem.scss
@@ -30,4 +30,9 @@ $block: '.#{$ns}layout-item';
margin: 0;
}
}
+
+ &__links,
+ &__buttons {
+ margin-top: $indentXS;
+ }
}
diff --git a/src/sub-blocks/LayoutItem/LayoutItem.tsx b/src/sub-blocks/LayoutItem/LayoutItem.tsx
index f26b054e5..d82d9c37e 100644
--- a/src/sub-blocks/LayoutItem/LayoutItem.tsx
+++ b/src/sub-blocks/LayoutItem/LayoutItem.tsx
@@ -2,10 +2,9 @@ import React, {useMemo} from 'react';
import {useUniqId} from '@gravity-ui/uikit';
-import {FullscreenMedia, IconWrapper, Media, MetaInfo} from '../../components';
+import {Buttons, FullscreenMedia, IconWrapper, Links, Media, MetaInfo} from '../../components';
import {ContentBlockProps, LayoutItemProps} from '../../models';
import {block} from '../../utils';
-import renderContentControls from '../../utils/renderContentControls/renderContentControls';
import Content from '../Content/Content';
import {getLayoutItemLinks, hasFullscreen, showFullscreenIcon} from './utils';
@@ -35,16 +34,6 @@ const LayoutItem = ({
colSizes: {all: 12, md: 12},
};
const titleId = useUniqId();
- const footerControls = useMemo(
- () =>
- renderContentControls({
- links: areControlsInFooter ? links : undefined,
- buttons: areControlsInFooter ? buttons : undefined,
- size: 's',
- titleId,
- }),
- [areControlsInFooter, links, buttons, titleId],
- );
const renderMedia = () => {
if (!media) {
return null;
@@ -77,7 +66,12 @@ const LayoutItem = ({
- {footerControls}
+ {areControlsInFooter && links && (
+
+ )}
+ {areControlsInFooter && buttons && (
+
+ )}
);
};
diff --git a/src/sub-blocks/renderCardFooterControlsContainer/CardFooterControlsContainer.scss b/src/sub-blocks/renderCardFooterControlsContainer/CardFooterControlsContainer.scss
deleted file mode 100644
index 557f7f2fb..000000000
--- a/src/sub-blocks/renderCardFooterControlsContainer/CardFooterControlsContainer.scss
+++ /dev/null
@@ -1,7 +0,0 @@
-@import '../../../styles/variables.scss';
-
-$block: '.#{$ns}card-footer-controls';
-
-#{$block} {
- margin-top: 0px;
-}
diff --git a/src/sub-blocks/renderCardFooterControlsContainer/renderCardFooterControlsContainer.tsx b/src/sub-blocks/renderCardFooterControlsContainer/renderCardFooterControlsContainer.tsx
deleted file mode 100644
index 1941a5260..000000000
--- a/src/sub-blocks/renderCardFooterControlsContainer/renderCardFooterControlsContainer.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import React from 'react';
-
-import {CardBase} from '../../components';
-import {block} from '../../utils';
-
-const b = block('card-footer-controls-containe');
-
-const renderCardFooterControlsContainer = (children: React.ReactElement) => (
- {children}
-);
-
-export default renderCardFooterControlsContainer;
diff --git a/src/utils/renderContentControls/ContentControls.scss b/src/utils/renderContentControls/ContentControls.scss
deleted file mode 100644
index 299cd924d..000000000
--- a/src/utils/renderContentControls/ContentControls.scss
+++ /dev/null
@@ -1,17 +0,0 @@
-@import '../../../styles/variables.scss';
-
-$block: '.#{$ns}content-controls';
-
-#{$block} {
- &__links,
- &__buttons {
- &_size {
- &_s {
- margin-top: $indentXS;
- }
- &_l {
- margin-top: $indentSM;
- }
- }
- }
-}
diff --git a/src/utils/renderContentControls/renderContentControls.tsx b/src/utils/renderContentControls/renderContentControls.tsx
deleted file mode 100644
index 860aa3a6c..000000000
--- a/src/utils/renderContentControls/renderContentControls.tsx
+++ /dev/null
@@ -1,48 +0,0 @@
-import React, {Fragment} from 'react';
-
-import {Buttons, Links} from '../../components';
-import {ButtonProps, ContentSize, LinkProps} from '../../models';
-import {block} from '../../utils';
-
-import './ContentControls.scss';
-
-const b = block('content-controls');
-
-type ContentControlsArgs = {
- links?: LinkProps[];
- buttons?: ButtonProps[];
- titleId?: string;
- size?: ContentSize;
- qa?: Record;
-};
-const renderContentControls = (
- {links, buttons, titleId, size = 's', qa = {}}: ContentControlsArgs,
- renderContainer: (children: React.ReactElement) => React.ReactElement = (children) => children,
-) => {
- const {links: linksQa, link: linkQa, buttons: buttonsQa, button: buttonQa} = qa;
-
- return links || buttons
- ? renderContainer(
-
-
-
- ,
- )
- : null;
-};
-
-export default renderContentControls;