From 6a27913114690b6ffaf0af7a9b24a74be53cefc8 Mon Sep 17 00:00:00 2001 From: Harel M Date: Wed, 7 Feb 2024 09:12:25 +0000 Subject: [PATCH] Fix colum misalignemnt --- .../MapMaplibreGlFeaturePropertyPopup.tsx | 34 ++++++++++--------- src/styles/_popup.scss | 11 +++--- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/components/MapMaplibreGlFeaturePropertyPopup.tsx b/src/components/MapMaplibreGlFeaturePropertyPopup.tsx index d77ab0c1..cec5d504 100644 --- a/src/components/MapMaplibreGlFeaturePropertyPopup.tsx +++ b/src/components/MapMaplibreGlFeaturePropertyPopup.tsx @@ -19,25 +19,25 @@ function displayValue(value: string | number | Date | object) { return value; } +function renderKeyValueTableRow(key: string, value: string) { + return + {key} + {value} + +} + function renderFeature(feature: InspectFeature, idx: number) { - return
-
{feature.layer['source']}: {feature.layer['source-layer']}{feature.inspectModeCounter && × {feature.inspectModeCounter}}
-
-
$type
-
{feature.geometry.type}
-
-
-
feature_id
-
{displayValue(feature.id)}
-
+ return <> + + {feature.layer['source']}: {feature.layer['source-layer']}{feature.inspectModeCounter && × {feature.inspectModeCounter}} + + {renderKeyValueTableRow("$type", feature.geometry.type)} + {renderKeyValueTableRow("Feature ID", displayValue(feature.id))} {Object.keys(feature.properties).map(propertyName => { const property = feature.properties[propertyName]; - return
-
{propertyName}
-
{displayValue(property)}
-
+ return renderKeyValueTableRow(propertyName, displayValue(property)) })} -
+ } function removeDuplicatedFeatures(features: InspectFeature[]) { @@ -71,7 +71,9 @@ class FeaturePropertyPopup extends React.Component { render() { const features = removeDuplicatedFeatures(this.props.features) return
- {features.map(renderFeature)} + + {features.map(renderFeature)} +
} } diff --git a/src/styles/_popup.scss b/src/styles/_popup.scss index df685c3f..a500efb5 100644 --- a/src/styles/_popup.scss +++ b/src/styles/_popup.scss @@ -37,12 +37,11 @@ } } -.maputnik-popup-feature-left { - margin-left: $margin-2; - color: $color-lowgray; - flex: 1; +.maputnik-popup-table { + width: 100%; } -.maputnik-popup-feature-right { - flex: 1; + +.maputnik-popup-table-cell { color: $color-lowgray; + padding-left: $margin-2; }