mirror of
https://github.com/maputnik/editor.git
synced 2026-08-25 22:47:39 +00:00
Fix colum misalignemnt
This commit is contained in:
@@ -19,25 +19,25 @@ function displayValue(value: string | number | Date | object) {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function renderKeyValueTableRow(key: string, value: string) {
|
||||||
|
return <tr key={key}>
|
||||||
|
<td className="maputnik-popup-table-cell">{key}</td>
|
||||||
|
<td className="maputnik-popup-table-cell">{value}</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
|
||||||
function renderFeature(feature: InspectFeature, idx: number) {
|
function renderFeature(feature: InspectFeature, idx: number) {
|
||||||
return <div key={`${feature.sourceLayer}-${idx}`}>
|
return <>
|
||||||
<div className="maputnik-popup-layer-id">{feature.layer['source']}: {feature.layer['source-layer']}{feature.inspectModeCounter && <span> × {feature.inspectModeCounter}</span>}</div>
|
<tr key={`${feature.sourceLayer}-${idx}`}>
|
||||||
<div className="maputnik-popup-layer">
|
<td colSpan={2} className="maputnik-popup-layer-id">{feature.layer['source']}: {feature.layer['source-layer']}{feature.inspectModeCounter && <span> × {feature.inspectModeCounter}</span>}</td>
|
||||||
<div className="maputnik-popup-feature-left">$type</div>
|
</tr>
|
||||||
<div className="maputnik-popup-feature-right">{feature.geometry.type}</div>
|
{renderKeyValueTableRow("$type", feature.geometry.type)}
|
||||||
</div>
|
{renderKeyValueTableRow("Feature ID", displayValue(feature.id))}
|
||||||
<div className="maputnik-popup-layer">
|
|
||||||
<div className="maputnik-popup-feature-left">feature_id</div>
|
|
||||||
<div className="maputnik-popup-feature-right">{displayValue(feature.id)}</div>
|
|
||||||
</div>
|
|
||||||
{Object.keys(feature.properties).map(propertyName => {
|
{Object.keys(feature.properties).map(propertyName => {
|
||||||
const property = feature.properties[propertyName];
|
const property = feature.properties[propertyName];
|
||||||
return <div key={propertyName} className="maputnik-popup-layer">
|
return renderKeyValueTableRow(propertyName, displayValue(property))
|
||||||
<div className="maputnik-popup-feature-left">{propertyName}</div>
|
|
||||||
<div className="maputnik-popup-feature-right">{displayValue(property)}</div>
|
|
||||||
</div>
|
|
||||||
})}
|
})}
|
||||||
</div>
|
</>
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeDuplicatedFeatures(features: InspectFeature[]) {
|
function removeDuplicatedFeatures(features: InspectFeature[]) {
|
||||||
@@ -71,7 +71,9 @@ class FeaturePropertyPopup extends React.Component<FeaturePropertyPopupProps> {
|
|||||||
render() {
|
render() {
|
||||||
const features = removeDuplicatedFeatures(this.props.features)
|
const features = removeDuplicatedFeatures(this.props.features)
|
||||||
return <div className="maputnik-feature-property-popup">
|
return <div className="maputnik-feature-property-popup">
|
||||||
{features.map(renderFeature)}
|
<table className="maputnik-popup-table">
|
||||||
|
{features.map(renderFeature)}
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,12 +37,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.maputnik-popup-feature-left {
|
.maputnik-popup-table {
|
||||||
margin-left: $margin-2;
|
width: 100%;
|
||||||
color: $color-lowgray;
|
|
||||||
flex: 1;
|
|
||||||
}
|
}
|
||||||
.maputnik-popup-feature-right {
|
|
||||||
flex: 1;
|
.maputnik-popup-table-cell {
|
||||||
color: $color-lowgray;
|
color: $color-lowgray;
|
||||||
|
padding-left: $margin-2;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user