Skip to content

Commit 107cf79

Browse files
authored
Merge pull request #12 from gravity-ui/add-react-18-types-support
feat: add react 18 types supporting
2 parents 933cbf1 + 339bbb4 commit 107cf79

File tree

102 files changed

+346
-386
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+346
-386
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ type FetchLoadableData<TData = any> = (blockKey: string) => Promise<TData>;
131131
```jsx
132132
import {Grid, Row, Col} from '@gravity-ui/page-constructor/';
133133

134-
const Page: React.FC<PageProps> = ({children}) => (
134+
const Page: WithChildren<PageProps> = ({children}) => (
135135
<Grid>
136136
<Row>
137137
<Col sizes={{lg: 4, sm: 6, all: 12}}>{children}</Col>

src/blocks/Banner/Banner.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import './Banner.scss';
99

1010
const b = block('banner-block');
1111

12-
export const BannerBlock: React.FC<BannerBlockProps> = (props) => {
12+
export const BannerBlock = (props: BannerBlockProps) => {
1313
const {animated, ...bannerProps} = props;
1414

1515
return (

src/blocks/CardLayout/CardLayout.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
import React from 'react';
22

33
import {block} from '../../utils';
4-
import {CardLayoutBlockProps} from '../../models';
4+
import {CardLayoutBlockProps as CardLayoutBlockParams} from '../../models';
55
import {Row, Col} from '../../grid';
66
import {BlockHeader, AnimateBlock} from '../../components';
77

88
import './CardLayout.scss';
99

10+
export interface CardLayoutBlockProps extends Omit<CardLayoutBlockParams, 'children'> {
11+
children?: React.ReactNode;
12+
}
13+
1014
const b = block('card-layout-block');
1115

1216
const DEFAULT_SIZES = {
@@ -15,13 +19,13 @@ const DEFAULT_SIZES = {
1519
md: 4,
1620
};
1721

18-
const CardLayout: React.FC<CardLayoutBlockProps> = ({
22+
const CardLayout = ({
1923
title,
2024
description,
2125
animated,
2226
colSizes = DEFAULT_SIZES,
2327
children,
24-
}) => (
28+
}: CardLayoutBlockProps) => (
2529
<AnimateBlock className={b()} animate={animated}>
2630
<BlockHeader title={title} description={description} />
2731
<div>

src/blocks/Companies/Companies.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import './Companies.scss';
1010

1111
const b = block('companies-block');
1212

13-
export const CompaniesBlock: React.FC<CompaniesBlockProps> = ({title, images, animated}) => {
13+
export const CompaniesBlock = ({title, images, animated}: CompaniesBlockProps) => {
1414
const {themeValue: theme} = useContext(ThemeValueContext);
1515
const themedImages = getThemedValue(images, theme) || {};
1616
const {desktop, mobile, tablet, alt} = themedImages;

src/blocks/ContentLayout/ContentLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function getTextWidth(size: ContentTextSize) {
3333
}
3434
}
3535

36-
export const ContentLayoutBlock: React.FC<ContentLayoutBlockProps> = (props) => {
36+
export const ContentLayoutBlock = (props: ContentLayoutBlockProps) => {
3737
const isMobile = useContext(MobileContext);
3838
const {textContent, fileContent, properties: cardLayoutProperties = {size: 'l'}} = props;
3939
const {

src/blocks/ExtendedFeatures/ExtendedFeatures.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ const DEFAULT_SIZES = {
1515
md: 4,
1616
};
1717

18-
export const ExtendedFeaturesBlock: React.FunctionComponent<ExtendedFeaturesProps> = ({
18+
export const ExtendedFeaturesBlock = ({
1919
title,
2020
description,
2121
items,
2222
colSizes = DEFAULT_SIZES,
2323
animated,
24-
}) => (
24+
}: ExtendedFeaturesProps) => (
2525
<AnimateBlock className={b()} animate={animated}>
2626
<BlockHeader title={title} description={description} className={b('header')} />
2727
<div className={b('items')}>

src/blocks/Header/Header.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, {useContext} from 'react';
22

33
import {block, getThemedValue} from '../../utils';
4-
import {ClassNameProps, HeaderBlockBackground, HeaderBlockProps} from '../../models';
4+
import {ClassNameProps, HeaderBlockBackground, HeaderBlockProps, WithChildren} from '../../models';
55
import {headerHasMediaBackground} from '../../models/guards';
66
import {Button, Media, BackgroundMedia, BackgroundImage, RouterLink, HTML} from '../../components';
77
import {Grid, Row, Col} from '../../grid';
@@ -21,7 +21,7 @@ interface BackgroundProps {
2121
background: HeaderBlockBackground;
2222
}
2323

24-
const Background: React.FC<BackgroundProps> = ({background}) => {
24+
const Background = ({background}: BackgroundProps) => {
2525
const {url, color, disableCompress, fullWidth, fullWidthMedia} = background;
2626

2727
return headerHasMediaBackground(background) ? (
@@ -44,14 +44,14 @@ interface FullWidthBackgroundProps {
4444
background: HeaderBlockBackground;
4545
}
4646

47-
const FullWidthBackground: React.FC<FullWidthBackgroundProps> = ({background}) => (
47+
const FullWidthBackground = ({background}: FullWidthBackgroundProps) => (
4848
<div
4949
className={b('background', {['full-width']: true})}
5050
style={{backgroundColor: background?.color}}
5151
/>
5252
);
5353

54-
export const HeaderBlock: React.FunctionComponent<HeaderBlockFullProps> = (props) => {
54+
export const HeaderBlock = (props: WithChildren<HeaderBlockFullProps>) => {
5555
const {
5656
title,
5757
overtitle,

src/blocks/HeaderSlider/HeaderSlider.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@ import './HeaderSlider.scss';
1010

1111
const b = block('header-slider-block');
1212

13-
export const HeaderSliderBlock: React.FunctionComponent<HeaderSliderBlockProps> = ({
14-
items,
15-
arrows,
16-
...props
17-
}) => {
13+
export const HeaderSliderBlock = ({items, arrows, ...props}: HeaderSliderBlockProps) => {
1814
const isMobile = useContext(MobileContext);
1915
const showArrows = isMobile ? false : arrows;
2016

src/blocks/Icons/Icons.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import './Icons.scss';
99

1010
const b = block('icons-block');
1111

12-
const Icons: React.FC<IconsBlockProps> = ({title, size = 's', items}) => {
12+
const Icons = ({title, size = 's', items}: IconsBlockProps) => {
1313
const {hostname} = useContext(LocationContext);
1414

1515
return (

src/blocks/Info/Info.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import './Info.scss';
1111

1212
const b = block('info-block');
1313

14-
export const InfoBlock: React.FC<InfoBlockProps> = (props) => {
14+
export const InfoBlock = (props: InfoBlockProps) => {
1515
const {
1616
backgroundColor,
1717
theme: textTheme = 'dark',

0 commit comments

Comments
 (0)