From b0a4958e836c524effcc7492a84f9489cfb3801e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Zbytovsk=C3=BD?= Date: Sat, 1 Feb 2025 16:42:32 +0100 Subject: [PATCH] FeaturePanel: move NwrIcon to footer + polish (#917) --- .../FeaturePanel/FeatureDescription.tsx | 20 +++++++-- .../FeaturePanel/FeatureHeading.tsx | 43 ++++++------------- src/components/FeaturePanel/FeaturePanel.tsx | 1 + .../FeaturePanel/FeaturePanelFooter.tsx | 12 +++--- src/components/FeaturePanel/OsmError.tsx | 6 ++- 5 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/components/FeaturePanel/FeatureDescription.tsx b/src/components/FeaturePanel/FeatureDescription.tsx index e1aa1e43..78ddcbf7 100644 --- a/src/components/FeaturePanel/FeatureDescription.tsx +++ b/src/components/FeaturePanel/FeatureDescription.tsx @@ -7,6 +7,7 @@ import { useFeatureContext } from '../utils/FeatureContext'; import { TooltipButton } from '../utils/TooltipButton'; import { Feature } from '../../services/types'; import { OSM_WEBSITE } from '../../services/osm/consts'; +import { NwrIcon } from './NwrIcon'; const A = ({ href, children }) => href ? ( @@ -42,7 +43,7 @@ const Urls = () => { ); }; -const FromOsm = () => ( +export const FromOsm = () => ( <> @@ -66,11 +67,22 @@ export const FeatureDescription = () => { const { type } = osmMeta; if (point) { - return
{t('featurepanel.feature_description_point')}
; + return <>{t('featurepanel.feature_description_point')}; } if (nonOsmObject) { - return
{t('featurepanel.feature_description_nonosm', { type })}
; + return <>{t('featurepanel.feature_description_nonosm', { type })}; } - return ; + return ( + <> + + + + {t('featurepanel.feature_description_osm', { + type: capitalize(type), + })} + + ); }; diff --git a/src/components/FeaturePanel/FeatureHeading.tsx b/src/components/FeaturePanel/FeatureHeading.tsx index cc804d11..24570ab6 100644 --- a/src/components/FeaturePanel/FeatureHeading.tsx +++ b/src/components/FeaturePanel/FeatureHeading.tsx @@ -52,22 +52,24 @@ const Container = styled.div<{ isStandalone: boolean }>` ${({ isStandalone }) => isStandalone && 'padding-bottom: 8px;'} `; -const HeadingContainer = styled.div` +const HeadingsWrapper = styled.div` margin: 0 0 12px 0; - - display: flex; - align-items: center; - justify-content: space-between; position: relative; -`; - -const HeadingsWrapper = styled.div` display: flex; flex-direction: column; flex: 1; `; -const Headings = ({ onMouseEnter, onMouseLeave, isHovered }) => { +const Headings = () => { + const [isHovered, setIsHovered] = React.useState(false); + + const onMouseEnter = () => { + setIsHovered(true); + }; + const onMouseLeave = () => { + setIsHovered(false); + }; + const { feature } = useFeatureContext(); const label = getLabel(feature); const secondaryLabel = getSecondaryLabel(feature); @@ -85,7 +87,7 @@ const Headings = ({ onMouseEnter, onMouseLeave, isHovered }) => { }; const Heading = styled.h1<{ $deleted: boolean }>` - font-size: 46px; + font-size: 36px; line-height: 1.2; ${isOpenClimbing && ` @@ -112,29 +114,10 @@ export const FeatureHeading = React.forwardRef((_, ref) => { const isStandalone = useMediaQuery('(display-mode: standalone)'); const { feature } = useFeatureContext(); - const [isHovered, setIsHovered] = React.useState(false); - - const onMouseEnter = () => { - setIsHovered(true); - }; - const onMouseLeave = () => { - setIsHovered(false); - }; - return ( - - - - - - - + diff --git a/src/components/FeaturePanel/FeaturePanel.tsx b/src/components/FeaturePanel/FeaturePanel.tsx index 9ddac008..99f4efed 100644 --- a/src/components/FeaturePanel/FeaturePanel.tsx +++ b/src/components/FeaturePanel/FeaturePanel.tsx @@ -33,6 +33,7 @@ import { climbingTagValues } from './Climbing/utils/climbingTagValues'; const Flex = styled.div` flex: 1; + margin-bottom: 40px; `; type FeaturePanelProps = { diff --git a/src/components/FeaturePanel/FeaturePanelFooter.tsx b/src/components/FeaturePanel/FeaturePanelFooter.tsx index 60be56fd..bb285113 100644 --- a/src/components/FeaturePanel/FeaturePanelFooter.tsx +++ b/src/components/FeaturePanel/FeaturePanelFooter.tsx @@ -1,8 +1,7 @@ import { useToggleState } from '../helpers'; import { useFeatureContext } from '../utils/FeatureContext'; -import { getFullOsmappLink } from '../../services/helpers'; import { PanelFooterWrapper, PanelSidePadding } from '../utils/PanelHelpers'; -import { FeatureDescription } from './FeatureDescription'; +import { FeatureDescription, FromOsm } from './FeatureDescription'; import Coordinates from './Coordinates'; import { t } from '../../services/intl'; import { ObjectsAround } from './ObjectsAround'; @@ -14,7 +13,8 @@ import { Box, Typography, } from '@mui/material'; -import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; +import { NwrIcon } from './NwrIcon'; +import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown'; type Props = { advanced: boolean; @@ -41,15 +41,15 @@ export const FeaturePanelFooter = ({ return ( - }> + }> - {t('featurepanel.footer_title')} + - + {feature.point ? null : }