import { useTheme } from '@arcblock/ux/lib/Theme'; import type { TCheckoutSessionExpanded } from '@blocklet/payment-types'; import { Avatar, Stack, Typography } from '@mui/material'; import { useCreation, useLocalStorageState, useSize } from 'ahooks'; import Livemode from '../components/livemode'; import { getStatementDescriptor } from '../libs/util'; import UserButtons from './form/addon'; type Props = { checkoutSession: TCheckoutSessionExpanded; }; export default function PaymentHeader({ checkoutSession }: Props) { const [livemode] = useLocalStorageState('livemode', { defaultValue: true }); const brand = getStatementDescriptor(checkoutSession.line_items); const theme = useTheme(); const domSize = useSize(document.body); const isColumnLayout = useCreation(() => { if (domSize) { if (domSize?.width <= theme.breakpoints.values.md) { return true; } } return false; }, [domSize, theme]); return ( {brand} {!livemode && } {isColumnLayout ? : null} ); }