Skip to content
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
13 changes: 7 additions & 6 deletions src/components/CardBase/CardBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@ import {
DefaultEventNames,
ImageProps,
MetrikaGoal,
WithChildren,
} from '../../models';
import {block, getQaAttrubutes} from '../../utils';
import BackgroundImage from '../BackgroundImage/BackgroundImage';
import RouterLink from '../RouterLink/RouterLink';

import './CardBase.scss';

export interface CardBaseProps extends AnalyticsEventsBase, CardBaseParams, PropsWithChildren {
interface CardBaseProps extends AnalyticsEventsBase, CardBaseParams {
className?: string;
bodyClassName?: string;
contentClassName?: string;
Expand All @@ -39,6 +38,8 @@ export interface CardBaseProps extends AnalyticsEventsBase, CardBaseParams, Prop
extraProps?: React.HTMLAttributes<HTMLElement>;
}

export type CardBasePropsType = PropsWithChildren<CardBaseProps>;

export interface CardHeaderBaseProps {
className?: string;
image?: ImageProps | null;
Expand All @@ -50,11 +51,11 @@ export interface CardFooterBaseProps {

const b = block('card-base-block');

const Header: React.FC<WithChildren<CardHeaderBaseProps>> = () => null;
const Content: React.FC<WithChildren<{}>> = () => null;
const Footer: React.FC<WithChildren<CardFooterBaseProps>> = () => null;
const Header: React.FC<PropsWithChildren<CardHeaderBaseProps>> = () => null;
const Content: React.FC<PropsWithChildren<{}>> = () => null;
const Footer: React.FC<PropsWithChildren<CardFooterBaseProps>> = () => null;

export const Layout = (props: CardBaseProps) => {
export const Layout = (props: CardBasePropsType) => {
const {
className,
bodyClassName,
Expand Down
4 changes: 2 additions & 2 deletions src/components/CardBase/__tests__/CardBase.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {AnalyticsContextProps} from '../../../context/analyticsContext';
import {MetrikaContextProps} from '../../../context/metrikaContext';
import {CardBorder, PixelEventType} from '../../../models';
import {getQaAttrubutes} from '../../../utils';
import CardBase, {CardBaseProps} from '../CardBase';
import CardBase, {CardBasePropsType} from '../CardBase';

const qaId = 'card-base-component';
const qaAttributes = getQaAttrubutes(qaId, 'header', 'footer', 'body', 'content');
Expand Down Expand Up @@ -65,7 +65,7 @@ describe('CardBase', () => {

test('add className', () => {
const children = <CardBase.Content>text</CardBase.Content>;
testCustomClassName<CardBaseProps>({
testCustomClassName<CardBasePropsType>({
component: CardBase,
props: {children, qa: qaId},
});
Expand Down