diff --git a/packages/components/src/components/form/SelectBar/SelectBar.stories.tsx b/packages/components/src/components/form/SelectBar/SelectBar.stories.tsx index 8b1418a1dd62..282f3fdea67f 100644 --- a/packages/components/src/components/form/SelectBar/SelectBar.stories.tsx +++ b/packages/components/src/components/form/SelectBar/SelectBar.stories.tsx @@ -7,7 +7,7 @@ const options = [ { label: 'low', value: 'low' }, { label: 'medium', value: 'medium' }, { label: 'high', value: 'high' }, - { label: 'custom', value: 'custom' }, + { label: 'custom', value: 'custom', icon: 'clock' }, ]; const meta: Meta = { diff --git a/packages/components/src/components/form/SelectBar/SelectBar.tsx b/packages/components/src/components/form/SelectBar/SelectBar.tsx index e173d3079cee..dd2a9a62e62e 100644 --- a/packages/components/src/components/form/SelectBar/SelectBar.tsx +++ b/packages/components/src/components/form/SelectBar/SelectBar.tsx @@ -22,6 +22,8 @@ import { withFrameProps, } from '../../../utils/frameProps'; import { TransientProps } from '../../../utils/transientProps'; +import { Icon, IconName } from '../../Icon/Icon'; +import { Row } from '../../Flex/Flex'; export const allowedSelectBarFrameProps = ['margin', 'width'] as const satisfies FramePropsKeys[]; type AllowedFrameProps = Pick; @@ -156,6 +158,7 @@ type ValueTypes = number | string | boolean; type Option = { label: ReactNode; value: V; + icon?: IconName; }; export type SelectBarProps = { @@ -256,22 +259,38 @@ export const SelectBar = ({ onKeyDown={handleKeyboardNav} /> - {options.map(option => ( - - ))} + ); + + return ( + + ); + })} ); diff --git a/packages/suite/src/views/wallet/coinmarket/common/CoinmarketLayout/CoinmarketLayoutNavigation/CoinmarketLayoutNavigation.tsx b/packages/suite/src/views/wallet/coinmarket/common/CoinmarketLayout/CoinmarketLayoutNavigation/CoinmarketLayoutNavigation.tsx index 19f052f47fd7..c6779ac02451 100644 --- a/packages/suite/src/views/wallet/coinmarket/common/CoinmarketLayout/CoinmarketLayoutNavigation/CoinmarketLayoutNavigation.tsx +++ b/packages/suite/src/views/wallet/coinmarket/common/CoinmarketLayout/CoinmarketLayoutNavigation/CoinmarketLayoutNavigation.tsx @@ -1,23 +1,34 @@ -import { Row } from '@trezor/components'; +import { IconName, SelectBar } from '@trezor/components'; +import { Route } from '@suite-common/suite-types'; -import { CoinmarketLayoutNavigationItem } from 'src/views/wallet/coinmarket/common/CoinmarketLayout/CoinmarketLayoutNavigation/CoinmarketLayoutNavigationItem'; +import { Translation } from '../../../../../../components/suite'; +import { goto } from '../../../../../../actions/suite/routerActions'; +import { useDispatch, useSelector } from '../../../../../../hooks/suite'; -export const CoinmarketLayoutNavigation = () => ( - - - - - -); +const options = [ + { + label: , + value: 'wallet-coinmarket-buy' as Route['name'], + icon: 'plus' as IconName, + }, + { + label: , + value: 'wallet-coinmarket-sell' as Route['name'], + icon: 'minus' as IconName, + }, + { + label: , + value: 'wallet-coinmarket-dca' as Route['name'], + icon: 'clock' as IconName, + }, +]; + +export const CoinmarketLayoutNavigation = () => { + const dispatch = useDispatch(); + const routeName = useSelector(state => state.router.route?.name); + const onChange = (newRoute: Route['name']) => { + dispatch(goto(newRoute)); + }; + + return ; +};