diff --git a/src/components/Duration/DurationController.tsx b/src/components/Duration/DurationController.tsx index 0b26045..2100bb3 100644 --- a/src/components/Duration/DurationController.tsx +++ b/src/components/Duration/DurationController.tsx @@ -92,15 +92,13 @@ export const DurationController: React.FC = ({ <>
{!isDesktop && } -
- void} - variant={isDesktop ? "vertical" : "chip"} - /> -
-
+ void} + variant={isDesktop ? "vertical" : "chip"} + /> +
{selectedType === "hour" ? ( = ({ if (isDesktop) { return ( - -
{content}
+ +
{content}
); } diff --git a/src/components/Duration/DurationField.tsx b/src/components/Duration/DurationField.tsx index f6a918b..3eb0145 100644 --- a/src/components/Duration/DurationField.tsx +++ b/src/components/Duration/DurationField.tsx @@ -1,64 +1,75 @@ -import React, { useState, useRef } from "react"; -import { useTradeStore } from "@/stores/tradeStore"; -import { useBottomSheetStore } from "@/stores/bottomSheetStore"; -import { useDeviceDetection } from "@/hooks/useDeviceDetection"; -import TradeParam from "@/components/TradeFields/TradeParam"; -import { DurationController } from "./DurationController"; -import { Popover } from "@/components/ui/popover"; +import React, { useState, useRef } from "react" +import { useTradeStore } from "@/stores/tradeStore" +import { useBottomSheetStore } from "@/stores/bottomSheetStore" +import { useDeviceDetection } from "@/hooks/useDeviceDetection" +import TradeParam from "@/components/TradeFields/TradeParam" +import { DurationController } from "./DurationController" +import { Popover } from "@/components/ui/popover" +import { DesktopTradeFieldCard } from "@/components/ui/desktop-trade-field-card" interface DurationFieldProps { - className?: string; + className?: string } export const DurationField: React.FC = ({ className }) => { - const { duration } = useTradeStore(); - const { setBottomSheet } = useBottomSheetStore(); - const { isDesktop } = useDeviceDetection(); - const [isOpen, setIsOpen] = useState(false); - const popoverRef = useRef<{ isClosing: boolean }>({ isClosing: false }); + const { duration } = useTradeStore() + const { setBottomSheet } = useBottomSheetStore() + const { isDesktop } = useDeviceDetection() + const [isOpen, setIsOpen] = useState(false) + const popoverRef = useRef<{ isClosing: boolean }>({ isClosing: false }) const handleClick = () => { if (isDesktop) { if (!popoverRef.current.isClosing) { - setIsOpen(!isOpen); + setIsOpen(!isOpen) } } else { - setBottomSheet(true, "duration", "470px"); + setBottomSheet(true, "duration", "470px") } - }; + } const handleClose = () => { - popoverRef.current.isClosing = true; - setIsOpen(false); + popoverRef.current.isClosing = true + setIsOpen(false) // Reset after a longer delay setTimeout(() => { - popoverRef.current.isClosing = false; - }, 300); // 300ms should be enough for the animation to complete - }; + popoverRef.current.isClosing = false + }, 300) // 300ms should be enough for the animation to complete + } return (
- - + {isDesktop ? ( + + + + ) : ( + + )} {isDesktop && isOpen && ( )}
- ); -}; + ) +} diff --git a/src/components/MarketInfo/MarketInfo.tsx b/src/components/MarketInfo/MarketInfo.tsx index 127b47e..ffa8daa 100644 --- a/src/components/MarketInfo/MarketInfo.tsx +++ b/src/components/MarketInfo/MarketInfo.tsx @@ -25,7 +25,7 @@ export const MarketInfo: React.FC = ({ data-id="market-info" onClick={onClick} > -
+
{selectedMarket && (
{ ); const card = container.firstChild as HTMLElement; - expect(card).toHaveClass('bg-white', 'rounded-lg', 'p-2'); + expect(card).toHaveClass('rounded-lg', 'p-2','bg-[rgba(246,247,248,1)]','border','border-transparent'); }); it('merges custom className with default styles', () => { @@ -31,6 +31,6 @@ describe('DesktopTradeFieldCard', () => { ); const card = container.firstChild as HTMLElement; - expect(card).toHaveClass('bg-white p-2 rounded-lg'); + expect(card).toHaveClass('bg-[rgba(246,247,248,1)] rounded-lg p-2 border border-transparent custom-class'); }); }); diff --git a/src/components/ui/desktop-trade-field-card.tsx b/src/components/ui/desktop-trade-field-card.tsx index 4ce3f5a..4e4bf22 100644 --- a/src/components/ui/desktop-trade-field-card.tsx +++ b/src/components/ui/desktop-trade-field-card.tsx @@ -10,17 +10,15 @@ interface DesktopTradeFieldCardProps { export const DesktopTradeFieldCard = ({ children, className, isSelected, error }: DesktopTradeFieldCardProps) => { return ( -
{children}
-
); }; diff --git a/src/components/ui/tab-list.tsx b/src/components/ui/tab-list.tsx index 34b50eb..460edd5 100644 --- a/src/components/ui/tab-list.tsx +++ b/src/components/ui/tab-list.tsx @@ -57,17 +57,18 @@ const VerticalTabList: React.FC = ({ onSelect, }) => { return ( -
+
{tabs.map(({ label, value }) => (