Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

henry/92021/fix: make trade types clickable in responsive for digits contracts #8046

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,9 @@
display: flex;
padding: 1.6rem 0.8rem;
justify-content: space-between;

&--is-expanded {
bottom: 98px;
henry-deriv marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
import classNames from 'classnames';
import React from 'react';
import { SwipeableProps, useSwipeable } from 'react-swipeable';
import Icon from '../icon';
import classNames from 'classnames';

type TSwipeableWrapper = {
className?: string;
onChange?: (prop?: number) => void;
is_disabled?: boolean;
is_trade_params_expanded?: boolean;
} & SwipeableProps;

const SwipeableWrapper = ({ children, className, onChange, ...props }: React.PropsWithChildren<TSwipeableWrapper>) => {
const SwipeableWrapper = ({
children,
className,
onChange,
is_trade_params_expanded = false,
...props
}: React.PropsWithChildren<TSwipeableWrapper>) => {
const [active_index, setActiveIndex] = React.useState(0);

React.useEffect(() => {
Expand Down Expand Up @@ -44,7 +51,6 @@ const SwipeableWrapper = ({ children, className, onChange, ...props }: React.Pro
onSwipedRight: swipedRight,
...props,
});

return (
<div className='dc-swipeable'>
<div
Expand All @@ -58,7 +64,11 @@ const SwipeableWrapper = ({ children, className, onChange, ...props }: React.Pro
{childrenWithWrapperDiv}
</div>
{!props.is_disabled && (
<nav className='dc-swipeable__nav'>
<nav
className={classNames('dc-swipeable__nav', {
'dc-swipeable__nav--is-expanded': is_trade_params_expanded,
})}
>
<Icon
className='dc-swipeable__nav__item'
icon='IcChevronDoubleLeft'
Expand Down
3 changes: 3 additions & 0 deletions packages/trader/src/Modules/Trading/Containers/trade.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const Trade = ({
symbol,
is_synthetics_available,
is_synthetics_trading_market_available,
is_trade_params_expanded,
is_vanilla,
}) => {
const [digits, setDigits] = React.useState([]);
Expand Down Expand Up @@ -199,6 +200,7 @@ const Trade = ({
should_show_active_symbols_loading
}
className={classNames({ 'vanilla-trade-chart': is_vanilla })}
is_trade_params_expanded={is_trade_params_expanded}
>
{show_digits_stats && <DigitsWidget digits={digits} tick={tick} />}
<ChartTrade
Expand Down Expand Up @@ -253,6 +255,7 @@ export default connect(({ client, common, modules, ui }) => ({
should_show_active_symbols_loading: modules.trade.should_show_active_symbols_loading,
is_chart_loading: modules.trade.is_chart_loading,
is_market_closed: modules.trade.is_market_closed,
is_trade_params_expanded: modules.trade.is_trade_params_expanded,
show_digits_stats: modules.trade.show_digits_stats,
is_trade_enabled: modules.trade.is_trade_enabled,
prepareTradeStore: modules.trade.prepareTradeStore,
Expand Down