fix(environment): node switcher on mobile (#5455)

This commit is contained in:
Art 2023-12-06 14:31:08 +01:00 committed by GitHub
parent 1379366caa
commit f56d34fe6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 75 additions and 51 deletions

View File

@ -19,16 +19,27 @@ export const LayoutCell = ({
}: LayoutCellProps) => { }: LayoutCellProps) => {
const t = useT(); const t = useT();
const classes = [ const classes = [
'lg:text-right flex justify-between lg:block', 'lg:text-right flex lg:block justify-stretch gap-2',
'my-2 lg:my-0', 'my-2 lg:my-0',
]; ];
return ( return (
<div className={classnames(classes)}> <div className={classnames(classes)}>
{label && <span className="lg:hidden">{label}</span>} {label && (
<>
<span className="lg:hidden text-xs text-vega-clight-200 dark:text-vega-cdark-200 whitespace-nowrap">
{label}
</span>
<span
/* separator */
aria-hidden
className="border-b border-dashed border-b-vega-clight-400 dark:border-b-vega-cdark-400 w-full h-[9px]"
></span>
</>
)}
<span <span
data-testid={dataTestId} data-testid={dataTestId}
className={classnames('font-mono', { className={classnames('font-mono text-xs lg:text-sm', {
'text-danger': !isLoading && hasError, 'text-danger': !isLoading && hasError,
'text-muted': isLoading, 'text-muted': isLoading,
})} })}

View File

@ -89,6 +89,7 @@ export const NodeSwitcher = ({ closeDialog }: { closeDialog: () => void }) => {
<span className="text-right">{t('Block')}</span> <span className="text-right">{t('Block')}</span>
<span className="text-right">{t('Subscription')}</span> <span className="text-right">{t('Subscription')}</span>
</LayoutRow> </LayoutRow>
</div>
<div> <div>
{nodes.map((node, index) => { {nodes.map((node, index) => {
return ( return (
@ -113,7 +114,6 @@ export const NodeSwitcher = ({ closeDialog }: { closeDialog: () => void }) => {
nodeRadio={nodeRadio} nodeRadio={nodeRadio}
/> />
</div> </div>
</div>
</TradingRadioGroup> </TradingRadioGroup>
<div className="mt-4"> <div className="mt-4">
<Button <Button

View File

@ -37,8 +37,6 @@ export function Dialog({
'w-full h-full' 'w-full h-full'
); );
const wrapperClasses = classNames( const wrapperClasses = classNames(
// Positions the modal in the center of screen
'z-20 relative rounded top-[10vh]',
// Dimensions // Dimensions
'max-w-[90vw] p-4 md:p-8', 'max-w-[90vw] p-4 md:p-8',
// Need to apply background and text colors again as content is rendered in a portal // Need to apply background and text colors again as content is rendered in a portal
@ -71,6 +69,12 @@ export function Dialog({
onCloseAutoFocus={onCloseAutoFocus} onCloseAutoFocus={onCloseAutoFocus}
onInteractOutside={onInteractOutside} onInteractOutside={onInteractOutside}
data-testid={dataTestId} data-testid={dataTestId}
>
<div
className={classNames(
// Positions the modal in the center of screen
'z-20 relative rounded top-[5vw] pb-[5vw] lg:top-[10vh] lg:pb-[10vh]'
)}
> >
<div className={wrapperClasses}> <div className={wrapperClasses}>
{onChange && ( {onChange && (
@ -96,6 +100,7 @@ export function Dialog({
</div> </div>
</div> </div>
</div> </div>
</div>
</DialogPrimitives.Content> </DialogPrimitives.Content>
</DialogPrimitives.Portal> </DialogPrimitives.Portal>
</DialogPrimitives.Root> </DialogPrimitives.Root>

View File

@ -57,12 +57,20 @@ interface RadioProps {
value: string; value: string;
label: string; label: string;
disabled?: boolean; disabled?: boolean;
className?: string;
} }
export const TradingRadio = ({ id, value, label, disabled }: RadioProps) => { export const TradingRadio = ({
id,
value,
label,
disabled,
className,
}: RadioProps) => {
const wrapperClasses = classNames( const wrapperClasses = classNames(
'flex items-center gap-1.5 text-xs', 'flex items-center gap-1.5 text-xs',
labelClasses labelClasses,
className
); );
const itemClasses = classNames( const itemClasses = classNames(
'flex justify-center items-center', 'flex justify-center items-center',