Skip to content

Commit

Permalink
Directions: Improve responsiveness
Browse files Browse the repository at this point in the history
  • Loading branch information
jvaclavik committed Nov 30, 2024
1 parent 2260755 commit 933cbe4
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/components/Directions/DirectionsBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,20 @@ import React, { useCallback, useState } from 'react';
import { Stack } from '@mui/material';
import { Result } from './Result';
import { RoutingResult } from './routing/types';
import { useBoolState, useMobileMode } from '../helpers';
import { isTabletResolution, useBoolState, useMobileMode } from '../helpers';
import { DirectionsForm } from './DirectionsForm';

const Wrapper = styled(Stack)`
const Wrapper = styled(Stack)<{ $isMobileMode: boolean }>`
position: absolute;
top: 8px;
left: 8px;
right: 8px;
z-index: 1001; // over the LayerSwitcherButton
width: 340px;
max-height: calc(100vh - 16px);
@media ${isTabletResolution} {
max-width: 340px;
}
`;

export const DirectionsBox = () => {
Expand All @@ -30,7 +34,7 @@ export const DirectionsBox = () => {
);

return (
<Wrapper spacing={1}>
<Wrapper spacing={1} $isMobileMode={isMobileMode}>
<DirectionsForm setResult={setResultAndHide} hideForm={hideForm} />
{result && (
<Result result={result} revealForm={!revealed && revealForm} />
Expand Down

0 comments on commit 933cbe4

Please sign in to comment.