Skip to content

Commit

Permalink
fix: cardBasePropTypes fix (#874)
Browse files Browse the repository at this point in the history
  • Loading branch information
NikitaCG authored Mar 26, 2024
1 parent ae8bd63 commit df11567
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
13 changes: 7 additions & 6 deletions src/components/CardBase/CardBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@ import {
CardBaseProps as CardBaseParams,
DefaultEventNames,
ImageProps,
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 @@ -34,6 +33,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 @@ -45,11 +46,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 @@ -9,7 +9,7 @@ import {PageConstructorProvider} from '../../../containers/PageConstructor';
import {AnalyticsContextProps} from '../../../context/analyticsContext';
import {CardBorder} 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 @@ -64,7 +64,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

0 comments on commit df11567

Please sign in to comment.