diff --git a/packages/redux-devtools-rtk-query-monitor/src/components/NoRtkQueryApi.tsx b/packages/redux-devtools-rtk-query-monitor/src/components/NoRtkQueryApi.tsx index 9f9d14ee..f48be2c6 100644 --- a/packages/redux-devtools-rtk-query-monitor/src/components/NoRtkQueryApi.tsx +++ b/packages/redux-devtools-rtk-query-monitor/src/components/NoRtkQueryApi.tsx @@ -1,36 +1,31 @@ import React from 'react'; -import { StyleUtilsContext } from '../styles/createStylingFromTheme'; export function NoRtkQueryApi(): JSX.Element { return ( - - {({ styling }) => ( -
({ - width: '100%', - textAlign: 'center', - color: theme.TEXT_COLOR, - padding: '1.4em', - '& a': { - fontSize: 'inherit', - color: theme.TEXT_COLOR, - textDecoration: 'underline', - }, - })} - > - No rtk-query api found. -
- Make sure to follow{' '} - - the instructions - - . -
- )} -
+
({ + width: '100%', + textAlign: 'center', + color: theme.TEXT_COLOR, + padding: '1.4em', + '& a': { + fontSize: 'inherit', + color: theme.TEXT_COLOR, + textDecoration: 'underline', + }, + })} + > + No rtk-query api found. +
+ Make sure to follow{' '} + + the instructions + + . +
); } diff --git a/packages/redux-devtools-rtk-query-monitor/src/components/QueryForm.tsx b/packages/redux-devtools-rtk-query-monitor/src/components/QueryForm.tsx index 24e21749..c6680342 100644 --- a/packages/redux-devtools-rtk-query-monitor/src/components/QueryForm.tsx +++ b/packages/redux-devtools-rtk-query-monitor/src/components/QueryForm.tsx @@ -137,7 +137,7 @@ export class QueryForm extends React.PureComponent< return ( - {({ styling, base16Theme }) => { + {({ base16Theme }) => { return (
{ const { resInfos, selectedQueryKey, onSelectQuery } = this.props; return ( - - {({ styling }) => ( -
    - {resInfos.map((resInfo) => { - const isSelected = isQuerySelected(selectedQueryKey, resInfo); +
      + {resInfos.map((resInfo) => { + const isSelected = isQuerySelected(selectedQueryKey, resInfo); - return ( -
    • onSelectQuery(resInfo)} - css={[ - (theme) => ({ - borderBottomWidth: '1px', - borderBottomStyle: 'solid', - display: 'flex', - justifyContent: 'space-between', - padding: '5px 10px', - cursor: 'pointer', - userSelect: 'none', - '&:last-child': { - borderBottomWidth: 0, - }, - overflow: 'hidden', - maxHeight: 47, - borderBottomColor: theme.BORDER_COLOR, - }), - isSelected && - ((theme) => ({ - backgroundColor: theme.SELECTED_BACKGROUND_COLOR, - })), - ]} - > -

      - {QueryList.formatQuery(resInfo)} -

      -
      - - {resInfo.type === 'query' ? 'Q' : 'M'} - -

      {resInfo.state.status}

      -
      -
    • - ); - })} -
    - )} - + return ( +
  • onSelectQuery(resInfo)} + css={[ + (theme) => ({ + borderBottomWidth: '1px', + borderBottomStyle: 'solid', + display: 'flex', + justifyContent: 'space-between', + padding: '5px 10px', + cursor: 'pointer', + userSelect: 'none', + '&:last-child': { + borderBottomWidth: 0, + }, + overflow: 'hidden', + maxHeight: 47, + borderBottomColor: theme.BORDER_COLOR, + }), + isSelected && + ((theme) => ({ + backgroundColor: theme.SELECTED_BACKGROUND_COLOR, + })), + ]} + > +

    + {QueryList.formatQuery(resInfo)} +

    +
    + + {resInfo.type === 'query' ? 'Q' : 'M'} + +

    {resInfo.state.status}

    +
    +
  • + ); + })} +
); } } diff --git a/packages/redux-devtools-rtk-query-monitor/src/components/QueryPreviewApi.tsx b/packages/redux-devtools-rtk-query-monitor/src/components/QueryPreviewApi.tsx index 9c65c105..7714f102 100644 --- a/packages/redux-devtools-rtk-query-monitor/src/components/QueryPreviewApi.tsx +++ b/packages/redux-devtools-rtk-query-monitor/src/components/QueryPreviewApi.tsx @@ -1,7 +1,6 @@ import React, { ReactNode, PureComponent } from 'react'; import type { ShouldExpandNodeInitially } from 'react-json-tree'; import { ApiStats, QueryPreviewTabs, RtkQueryApiState } from '../types'; -import { StyleUtilsContext } from '../styles/createStylingFromTheme'; import { TreeView, TreeViewProps } from './TreeView'; import { renderTabPanelId, renderTabPanelButtonId } from '../utils/a11y'; @@ -39,58 +38,54 @@ export class QueryPreviewApi extends PureComponent { const hasQueries = Object.keys(apiState.queries).length > 0; return ( - - {({ styling }) => ( -
({ - display: 'block', - overflowY: 'auto', - padding: '0.5em 0', - color: theme.TAB_CONTENT_COLOR, - '& h2': { - color: theme.ULIST_STRONG_COLOR, - padding: '0.5em 1em', - fontWeight: 700, - }, - '& h3': { - color: theme.ULIST_STRONG_COLOR, - }, - })} - > -

{apiState.config.reducerPath}

+
({ + display: 'block', + overflowY: 'auto', + padding: '0.5em 0', + color: theme.TAB_CONTENT_COLOR, + '& h2': { + color: theme.ULIST_STRONG_COLOR, + padding: '0.5em 1em', + fontWeight: 700, + }, + '& h3': { + color: theme.ULIST_STRONG_COLOR, + }, + })} + > +

{apiState.config.reducerPath}

+ State} + data={apiState} + shouldExpandNodeInitially={this.shouldExpandApiStateNode} + isWideLayout={isWideLayout} + /> + {apiStats && ( + <> State} - data={apiState} - shouldExpandNodeInitially={this.shouldExpandApiStateNode} + before={

Tally

} + data={apiStats.tally} isWideLayout={isWideLayout} /> - {apiStats && ( - <> - Tally} - data={apiStats.tally} - isWideLayout={isWideLayout} - /> - {hasQueries && ( - Queries Timings} - data={apiStats.timings.queries} - isWideLayout={isWideLayout} - /> - )} - {hasMutations && ( - Mutations Timings} - data={apiStats.timings.mutations} - isWideLayout={isWideLayout} - /> - )} - + {hasQueries && ( + Queries Timings} + data={apiStats.timings.queries} + isWideLayout={isWideLayout} + /> )} -
+ {hasMutations && ( + Mutations Timings} + data={apiStats.timings.mutations} + isWideLayout={isWideLayout} + /> + )} + )} - +
); } } diff --git a/packages/redux-devtools-rtk-query-monitor/src/components/QueryPreviewHeader.tsx b/packages/redux-devtools-rtk-query-monitor/src/components/QueryPreviewHeader.tsx index b1b1f816..29a104de 100644 --- a/packages/redux-devtools-rtk-query-monitor/src/components/QueryPreviewHeader.tsx +++ b/packages/redux-devtools-rtk-query-monitor/src/components/QueryPreviewHeader.tsx @@ -1,5 +1,4 @@ import React, { ReactNode } from 'react'; -import { StyleUtilsContext } from '../styles/createStylingFromTheme'; import { QueryPreviewTabs, TabOption } from '../types'; import { renderTabPanelButtonId } from '../utils/a11y'; import { emptyArray } from '../utils/object'; @@ -24,98 +23,92 @@ export class QueryPreviewHeader extends React.Component const { tabs, selectedTab, renderTabLabel } = this.props; return ( - - {({ styling }) => ( -
({ - flex: '0 0 30px', - padding: '5px 4px', - alignItems: 'center', - borderBottomWidth: '1px', - borderBottomStyle: 'solid', +
({ + flex: '0 0 30px', + padding: '5px 4px', + alignItems: 'center', + borderBottomWidth: '1px', + borderBottomStyle: 'solid', - backgroundColor: theme.HEADER_BACKGROUND_COLOR, - borderBottomColor: theme.HEADER_BORDER_COLOR, - })} - > -
*': { - flex: '0 1 auto', - }, - }} + backgroundColor: theme.HEADER_BACKGROUND_COLOR, + borderBottomColor: theme.HEADER_BORDER_COLOR, + })} + > +
*': { + flex: '0 1 auto', + }, + }} + > + {tabs.map((tab) => ( + - ))} -
-
- )} - + {renderTabLabel ? renderTabLabel(tab) : tab.label} + + ))} +
+
); } diff --git a/packages/redux-devtools-rtk-query-monitor/src/components/SortOrderButton.tsx b/packages/redux-devtools-rtk-query-monitor/src/components/SortOrderButton.tsx index d8edb0bb..2ba577c7 100644 --- a/packages/redux-devtools-rtk-query-monitor/src/components/SortOrderButton.tsx +++ b/packages/redux-devtools-rtk-query-monitor/src/components/SortOrderButton.tsx @@ -1,6 +1,5 @@ import React, { CSSProperties } from 'react'; import { ArrowUpIcon } from './ArrowUpIcon'; -import { StyleUtilsContext } from '../styles/createStylingFromTheme'; export interface SortOrderButtonProps { readonly isAsc?: boolean; @@ -28,40 +27,36 @@ export function SortOrderButton({ }; return ( - - {({ styling }) => ( - - )} - + '&:active': { + backgroundColor: theme.TAB_BACK_SELECTED_COLOR, + }, + })} + > + + {buttonLabel} + ); } diff --git a/packages/redux-devtools-rtk-query-monitor/src/components/UList.tsx b/packages/redux-devtools-rtk-query-monitor/src/components/UList.tsx index 0ffaad32..d7029302 100644 --- a/packages/redux-devtools-rtk-query-monitor/src/components/UList.tsx +++ b/packages/redux-devtools-rtk-query-monitor/src/components/UList.tsx @@ -1,35 +1,30 @@ import * as React from 'react'; -import { StyleUtilsContext } from '../styles/createStylingFromTheme'; export type UListProps = React.HTMLAttributes; export function UList(props: UListProps): JSX.Element { return ( - - {({ styling }) => ( -
    ({ - listStyle: 'none', - padding: '0 0 0 1em', - color: theme.ULIST_COLOR, - '& > li': { - listStyle: 'none', - }, - '& > li::before': { - content: '"\\2022"', - display: 'inline-block', - paddingRight: '0.5em', - color: theme.ULIST_DISC_COLOR, - fontSize: '0.8em', - }, +
      ({ + listStyle: 'none', + padding: '0 0 0 1em', + color: theme.ULIST_COLOR, + '& > li': { + listStyle: 'none', + }, + '& > li::before': { + content: '"\\2022"', + display: 'inline-block', + paddingRight: '0.5em', + color: theme.ULIST_DISC_COLOR, + fontSize: '0.8em', + }, - '& strong': { - color: theme.ULIST_STRONG_COLOR, - }, - })} - /> - )} - + '& strong': { + color: theme.ULIST_STRONG_COLOR, + }, + })} + /> ); } diff --git a/packages/redux-devtools-rtk-query-monitor/src/containers/QueryPreview.tsx b/packages/redux-devtools-rtk-query-monitor/src/containers/QueryPreview.tsx index 2655777d..05ed2173 100644 --- a/packages/redux-devtools-rtk-query-monitor/src/containers/QueryPreview.tsx +++ b/packages/redux-devtools-rtk-query-monitor/src/containers/QueryPreview.tsx @@ -1,6 +1,5 @@ import React, { ReactNode } from 'react'; import type { Interpolation, Theme } from '@emotion/react'; -import { StyleUtilsContext } from '../styles/createStylingFromTheme'; import { createTreeItemLabelRenderer } from '../styles/tree'; import { QueryPreviewTabs, @@ -186,7 +185,7 @@ export class QueryPreview extends React.PureComponent> { constructor(props: QueryPreviewProps) { super(props); - this.labelRenderer = createTreeItemLabelRenderer(this.props.styling); + this.labelRenderer = createTreeItemLabelRenderer(); } renderLabelWithCounter = ( @@ -229,58 +228,40 @@ export class QueryPreview extends React.PureComponent> { if (!resInfo) { return ( - - {({ styling }) => ( -
      - - isTabVisible(tab, 'default'), - ) as ReadonlyArray< - TabOption< - QueryPreviewTabs, - unknown, - RtkResourceInfo['type'] - > - > - } - renderTabLabel={this.renderTabLabel} - /> - {hasNoApis && } -
      - )} -
      +
      + + isTabVisible(tab, 'default'), + ) as ReadonlyArray< + TabOption + > + } + renderTabLabel={this.renderTabLabel} + /> + {hasNoApis && } +
      ); } return ( - - {({ styling }) => { - return ( -
      - - isTabVisible(tab, resInfo.type), - ) as ReadonlyArray< - TabOption< - QueryPreviewTabs, - unknown, - RtkResourceInfo['type'] - > - > - } - renderTabLabel={this.renderTabLabel} - /> - -
      - ); - }} -
      +
      + + isTabVisible(tab, resInfo.type), + ) as ReadonlyArray< + TabOption + > + } + renderTabLabel={this.renderTabLabel} + /> + +
      ); } } diff --git a/packages/redux-devtools-rtk-query-monitor/src/styles/tree.tsx b/packages/redux-devtools-rtk-query-monitor/src/styles/tree.tsx index 27ed90be..7aa4f375 100644 --- a/packages/redux-devtools-rtk-query-monitor/src/styles/tree.tsx +++ b/packages/redux-devtools-rtk-query-monitor/src/styles/tree.tsx @@ -92,9 +92,7 @@ export function getItemString( ); } -export function createTreeItemLabelRenderer( - styling: StylingFunction, -): LabelRenderer { +export function createTreeItemLabelRenderer(): LabelRenderer { return function labelRenderer([key], nodeType, expanded) { return (