diff --git a/apps/trading/components/welcome-dialog/welcome-landing-dialog.tsx b/apps/trading/components/welcome-dialog/welcome-landing-dialog.tsx index b65f0cbe3..32e93258b 100644 --- a/apps/trading/components/welcome-dialog/welcome-landing-dialog.tsx +++ b/apps/trading/components/welcome-dialog/welcome-landing-dialog.tsx @@ -2,7 +2,7 @@ import React, { useCallback } from 'react'; import { useMarketList } from '@vegaprotocol/market-list'; import { t } from '@vegaprotocol/i18n'; import { useAssetDetailsDialogStore } from '@vegaprotocol/assets'; -import { Link as UILink } from '@vegaprotocol/ui-toolkit'; +import { Link as UILink, TinyScroll } from '@vegaprotocol/ui-toolkit'; import type { OnCellClickHandler } from '../select-market'; import type { MarketMaybeWithDataAndCandles } from '@vegaprotocol/market-list'; import { @@ -55,8 +55,8 @@ export const SelectMarketLandingTable = ({ const showProposed = (markets?.length || 0) <= 5; return ( <> -

@@ -78,7 +78,7 @@ export const SelectMarketLandingTable = ({ ))} -

+
- ( - { - if (type === OrderType.TYPE_NETWORK) return; - update({ - type, - // when changing type also update the tif to what was last used of new type - timeInForce: lastTIF[type] || order.timeInForce, - expiresAt: undefined, - }); - clearErrors('expiresAt'); - }} - market={market} - marketData={marketData} - errorMessage={errors.type?.message} - /> - )} - /> - ( - { - update({ side }); - }} - /> - )} - /> - - ( - { - update({ timeInForce }); - // Set tif value for the given order type, so that when switching - // types we know the last used TIF for the given order type - setLastTIF((curr) => ({ - ...curr, - [order.type]: timeInForce, - expiresAt: undefined, - })); - clearErrors('expiresAt'); - }} - market={market} - marketData={marketData} - errorMessage={errors.timeInForce?.message} - /> - )} - /> - {order.type === Schema.OrderType.TYPE_LIMIT && - order.timeInForce === Schema.OrderTimeInForce.TIME_IN_FORCE_GTT && ( - ( - - update({ - expiresAt: expiresAt || undefined, - }) - } - errorMessage={errors.expiresAt?.message} - /> - )} - /> - )} - - = 1 || isReadOnly} - variant={order.side === Schema.Side.SIDE_BUY ? 'ternary' : 'secondary'} - /> - - + +
+ ( + { + if (type === OrderType.TYPE_NETWORK) return; + update({ + type, + // when changing type also update the tif to what was last used of new type + timeInForce: lastTIF[type] || order.timeInForce, + expiresAt: undefined, + }); + clearErrors('expiresAt'); + }} + market={market} + marketData={marketData} + errorMessage={errors.type?.message} + /> + )} + /> + ( + { + update({ side }); + }} + /> + )} + /> + + ( + { + update({ timeInForce }); + // Set tif value for the given order type, so that when switching + // types we know the last used TIF for the given order type + setLastTIF((curr) => ({ + ...curr, + [order.type]: timeInForce, + expiresAt: undefined, + })); + clearErrors('expiresAt'); + }} + market={market} + marketData={marketData} + errorMessage={errors.timeInForce?.message} + /> + )} + /> + {order.type === Schema.OrderType.TYPE_LIMIT && + order.timeInForce === Schema.OrderTimeInForce.TIME_IN_FORCE_GTT && ( + ( + + update({ + expiresAt: expiresAt || undefined, + }) + } + errorMessage={errors.expiresAt?.message} + /> + )} + /> + )} + + = 1 || isReadOnly} + variant={ + order.side === Schema.Side.SIDE_BUY ? 'ternary' : 'secondary' + } + /> + + +
); }; diff --git a/libs/market-depth/src/lib/orderbook.tsx b/libs/market-depth/src/lib/orderbook.tsx index 40d01cfa2..2f677a234 100644 --- a/libs/market-depth/src/lib/orderbook.tsx +++ b/libs/market-depth/src/lib/orderbook.tsx @@ -1,4 +1,3 @@ -import styles from './orderbook.module.scss'; import colors from 'tailwindcss/colors'; import { useEffect, useRef, useState, useCallback, Fragment } from 'react'; import classNames from 'classnames'; @@ -14,7 +13,7 @@ import { import * as Schema from '@vegaprotocol/types'; import { OrderbookRow } from './orderbook-row'; import { createRow } from './orderbook-data'; -import { Checkbox, Icon, Splash } from '@vegaprotocol/ui-toolkit'; +import { Checkbox, Icon, Splash, TinyScroll } from '@vegaprotocol/ui-toolkit'; import type { OrderbookData, OrderbookRowData } from './orderbook-data'; interface OrderbookProps extends OrderbookData { @@ -547,8 +546,8 @@ export const Orderbook = ({ {t('Cumulative vol')}
-
)} -
+
{data ? ( - onSelect?.(id)} /> + + onSelect?.(id)} /> + ) : (

{t('Could not load market')}

diff --git a/libs/ui-toolkit/src/components/index.ts b/libs/ui-toolkit/src/components/index.ts index 95fddfd41..897d3ee59 100644 --- a/libs/ui-toolkit/src/components/index.ts +++ b/libs/ui-toolkit/src/components/index.ts @@ -40,6 +40,7 @@ export * from './tabs'; export * from './text-area'; export * from './theme-switcher'; export * from './thumbs'; +export * from './tiny-scroll'; export * from './toast'; export * from './toggle'; export * from './tooltip'; diff --git a/libs/ui-toolkit/src/components/tiny-scroll/index.tsx b/libs/ui-toolkit/src/components/tiny-scroll/index.tsx new file mode 100644 index 000000000..06e4bbd13 --- /dev/null +++ b/libs/ui-toolkit/src/components/tiny-scroll/index.tsx @@ -0,0 +1 @@ +export * from './tiny-scroll'; diff --git a/libs/market-depth/src/lib/orderbook.module.scss b/libs/ui-toolkit/src/components/tiny-scroll/tiny-scroll.module.scss similarity index 100% rename from libs/market-depth/src/lib/orderbook.module.scss rename to libs/ui-toolkit/src/components/tiny-scroll/tiny-scroll.module.scss diff --git a/libs/ui-toolkit/src/components/tiny-scroll/tiny-scroll.tsx b/libs/ui-toolkit/src/components/tiny-scroll/tiny-scroll.tsx new file mode 100644 index 000000000..a03600164 --- /dev/null +++ b/libs/ui-toolkit/src/components/tiny-scroll/tiny-scroll.tsx @@ -0,0 +1,20 @@ +import styles from './tiny-scroll.module.scss'; +import { forwardRef } from 'react'; +import classNames from 'classnames'; +import type { HTMLAttributes, ReactNode } from 'react'; + +export interface Props extends HTMLAttributes { + children: ReactNode; +} + +export const TinyScroll = forwardRef( + ({ children, className, ...props }, ref) => ( +
+ {children} +
+ ) +);