Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

Hasan/chore: added click handler for live market buy sell button #267

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions libs/components/src/lib/card/live-market/buy-sell.buttons.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import { Text, TradeButton } from '@deriv/quill-design';
import { MarketStatus } from '../types';

export type BuySellButtonsProps = {
status: MarketStatus;
spread: string;
textClass: string;
onClickBuyButton?: () => void;
onClickSellButton?: () => void;
};

export const BuySellButtons = ({
status,
spread,
textClass,
}: {
status: MarketStatus;
spread: string;
textClass: string;
}) => {
onClickBuyButton,
onClickSellButton,
}: BuySellButtonsProps) => {
return (
<div className="flex flex-col gap-gap-md">
<div className="flex flex-row gap-gap-md">
Expand All @@ -26,6 +32,7 @@ export const BuySellButtons = ({
variant="secondary"
disabled={status === 'closed'}
className="flex-1"
onClick={onClickBuyButton}
>
Buy
</TradeButton>
Expand All @@ -34,6 +41,7 @@ export const BuySellButtons = ({
variant="secondary"
disabled={status === 'closed'}
className="flex-1"
onClick={onClickSellButton}
>
Sell
</TradeButton>
Expand Down
4 changes: 4 additions & 0 deletions libs/components/src/lib/card/live-market/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ export const LiveMarketCard: React.FC<LiveMarketCardProps> = ({
bidPrice,
askPrice,
spread,
onClickBuyButton,
onClickSellButton,
}) => {
const textClassName =
status === 'closed'
Expand Down Expand Up @@ -101,6 +103,8 @@ export const LiveMarketCard: React.FC<LiveMarketCardProps> = ({
status={status}
spread={spread}
textClass={textClassName}
onClickBuyButton={onClickBuyButton}
onClickSellButton={onClickSellButton}
/>
</div>
);
Expand Down
2 changes: 2 additions & 0 deletions libs/components/src/lib/card/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,6 @@ export interface LiveMarketContent {
bidPrice: string;
askPrice: string;
spread: string;
onClickBuyButton?: () => void;
onClickSellButton?: () => void;
}
Loading