Files
iD/modules/ui/data_header.js
Quincy Morgan 32f8274929 Make t function return a span element with a lang attribute unless html: false is specified in the options (re: #7963)
Update `text` functions to `html` to support inserting the `span` elements
Specify `html: false` for various instances where a `span` is not desired, e.g. `placeholder` and `title` attributes
2020-09-15 21:56:22 -04:00

48 lines
1.1 KiB
JavaScript

import { t } from '../core/localizer';
import { svgIcon } from '../svg/icon';
export function uiDataHeader() {
var _datum;
function dataHeader(selection) {
var header = selection.selectAll('.data-header')
.data(
(_datum ? [_datum] : []),
function(d) { return d.__featurehash__; }
);
header.exit()
.remove();
var headerEnter = header.enter()
.append('div')
.attr('class', 'data-header');
var iconEnter = headerEnter
.append('div')
.attr('class', 'data-header-icon');
iconEnter
.append('div')
.attr('class', 'preset-icon-28')
.call(svgIcon('#iD-icon-data', 'note-fill'));
headerEnter
.append('div')
.attr('class', 'data-header-label')
.html(t('map_data.layers.custom.title'));
}
dataHeader.datum = function(val) {
if (!arguments.length) return _datum;
_datum = val;
return this;
};
return dataHeader;
}