From 7012811929173c4aed41996af0e49b352b05b003 Mon Sep 17 00:00:00 2001 From: Igor D Date: Sun, 24 Sep 2023 22:32:52 +0300 Subject: [PATCH] [chore] updated modal and panel title types to react 18 (#2334) --- src/components/src/common/modal.tsx | 9 +++++++-- src/components/src/side-panel/panel-title.tsx | 7 +++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/components/src/common/modal.tsx b/src/components/src/common/modal.tsx index 5621a63ef3..3433f8f45e 100644 --- a/src/components/src/common/modal.tsx +++ b/src/components/src/common/modal.tsx @@ -18,7 +18,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -import React, {Component, ReactNode} from 'react'; +import React, {Component, ReactNode, PropsWithChildren} from 'react'; import {FormattedMessage} from '@kepler.gl/localization'; import styled, {FlattenSimpleInterpolation} from 'styled-components'; @@ -65,7 +65,12 @@ const ModalContent = styled.div` z-index: ${props => props.theme.modalContentZ}; `; -export const ModalTitle = styled.div` +type ModalTitleProps = PropsWithChildren<{ + style?: React.CSSProperties; + className?: string; +}>; + +export const ModalTitle = styled.div` font-size: ${props => props.theme.modalTitleFontSize}; color: ${props => props.theme.modalTitleColor}; margin-bottom: 10px; diff --git a/src/components/src/side-panel/panel-title.tsx b/src/components/src/side-panel/panel-title.tsx index de99131f3f..b78a6b5830 100644 --- a/src/components/src/side-panel/panel-title.tsx +++ b/src/components/src/side-panel/panel-title.tsx @@ -18,7 +18,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -import React from 'react'; +import React, {PropsWithChildren} from 'react'; import styled from 'styled-components'; import classnames from 'classnames'; @@ -42,11 +42,10 @@ const PanelHeaderRow = styled.div.attrs({ margin-bottom: 32px; `; -export type PanelTitleProps = { +export type PanelTitleProps = PropsWithChildren<{ title: string; className?: string; - children?: React.ReactNode; -}; +}>; const PanelTitleFactory = () => { const PanelTitle: React.FC = ({title, className, children}) => (