Better styles for buttons (vs. links)

This commit is contained in:
David Larlet 2023-09-15 21:27:44 -04:00
parent 7695906c38
commit 79117f2a66
No known key found for this signature in database
GPG key ID: 3E2953A359E7E7BD
4 changed files with 54 additions and 27 deletions

View file

@ -864,7 +864,8 @@ L.U.Map.include({
'umap-main-edit-toolbox with-transition dark', 'umap-main-edit-toolbox with-transition dark',
this._controlContainer this._controlContainer
) )
L.DomUtil.createLink('logo', container, '/') const logo = L.DomUtil.create('div', 'logo', container)
L.DomUtil.createLink('', logo, 'uMap', '/', null, L._('Go to the homepage'))
const nameButton = L.DomUtil.createButton( const nameButton = L.DomUtil.createButton(
'map-name', 'map-name',
container, container,

View file

@ -129,7 +129,10 @@ L.Util.toHTML = (r, options) => {
// images // images
r = r.replace(/{{([^\]|]*?)}}/g, '<img src="$1">') r = r.replace(/{{([^\]|]*?)}}/g, '<img src="$1">')
r = r.replace(/{{([^|]*?)\|(\d*?)(px)?}}/g, '<img src="$1" style="width:$2px;min-width:$2px;">') r = r.replace(
/{{([^|]*?)\|(\d*?)(px)?}}/g,
'<img src="$1" style="width:$2px;min-width:$2px;">'
)
//Unescape http //Unescape http
r = r.replace(/(h_t_t_p)/g, 'http') r = r.replace(/(h_t_t_p)/g, 'http')
@ -325,12 +328,15 @@ L.DomUtil.createButton = (className, container, content, callback, context) => {
return el return el
} }
L.DomUtil.createLink = (className, container, content, url, target) => { L.DomUtil.createLink = (className, container, content, url, target, title) => {
const el = L.DomUtil.add('a', className, container, content) const el = L.DomUtil.add('a', className, container, content)
el.href = url el.href = url
if (target) { if (target) {
el.target = target el.target = target
} }
if (title) {
el.title = title
}
return el return el
} }

View file

@ -614,7 +614,7 @@ L.FormBuilder.IconUrl = L.FormBuilder.BlurInput.extend({
for (const idx in data.pictogram_list) { for (const idx in data.pictogram_list) {
this.addIconPreview(data.pictogram_list[idx]) this.addIconPreview(data.pictogram_list[idx])
} }
const cancelButton = L.DomUtil.createButton( const closeButton = L.DomUtil.createButton(
'button action-button', 'button action-button',
this.pictogramsContainer, this.pictogramsContainer,
L._('Close'), L._('Close'),
@ -624,8 +624,9 @@ L.FormBuilder.IconUrl = L.FormBuilder.BlurInput.extend({
}, },
this this
) )
cancelButton.style.display = 'block' closeButton.style.display = 'block'
cancelButton.style.clear = 'both' closeButton.style.clear = 'both'
const customButton = L.DomUtil.createButton( const customButton = L.DomUtil.createButton(
'', '',
this.pictogramsContainer, this.pictogramsContainer,

View file

@ -42,7 +42,8 @@
} }
.leaflet-measure-control a, .leaflet-measure-control a,
.leaflet-control-locate a, .leaflet-control-locate a,
.umap-control a { .umap-control a,
.umap-control [type="button"] {
background-position: 50% 50%; background-position: 50% 50%;
background-repeat: no-repeat; background-repeat: no-repeat;
display: block; display: block;
@ -50,15 +51,19 @@
width: 36px; width: 36px;
line-height: 36px; line-height: 36px;
background-image: url('./img/24.svg'); background-image: url('./img/24.svg');
text-indent: -9999px;
margin-bottom: 0;
} }
.leaflet-control.display-on-more, .leaflet-control.display-on-more,
a.umap-control-less { .umap-control-less {
display: none; display: none;
} }
.umap-control-more, .umap-control-more,
.umap-control-less { .umap-control-less {
background-image: url('./img/24-white.svg'); background-image: url('./img/24-white.svg');
background-position: -72px -474px; background-position: -72px -474px;
text-indent: -9999px;
margin-bottom: 0;
} }
.umap-control-less { .umap-control-less {
background-position: -108px -476px; background-position: -108px -476px;
@ -70,13 +75,13 @@ a.umap-control-less {
.umap-more-controls .umap-control-more { .umap-more-controls .umap-control-more {
display: none; display: none;
} }
.leaflet-control-embed a { .leaflet-control-embed [type="button"] {
background-position: -72px -108px; background-position: -72px -108px;
} }
.leaflet-control-tilelayers a { .leaflet-control-tilelayers [type="button"] {
background-position: -72px 0; background-position: -72px 0;
} }
.leaflet-control-home a { .leaflet-control-home [type="button"] {
background-position: -122px -82px; background-position: -122px -82px;
} }
.leaflet-control-locate a { .leaflet-control-locate a {
@ -88,17 +93,17 @@ a.umap-control-less {
background-position: -72px -144px; background-position: -72px -144px;
box-shadow: 0 0 4px 0 black inset; box-shadow: 0 0 4px 0 black inset;
} }
.leaflet-control-star a { .leaflet-control-star [type="button"] {
background-position: -108px -144px; background-position: -108px -144px;
} }
.leaflet-control-star.starred a { .leaflet-control-star.starred [type="button"] {
background-position: -144px -144px; background-position: -144px -144px;
} }
.leaflet-control-search a { .leaflet-control-search [type="button"] {
background-position: -36px -108px; background-position: -36px -108px;
display: block; display: block;
} }
.leaflet-control-search a.loading { .leaflet-control-search [type="button"].loading {
background-image: url('./img/search.gif'); background-image: url('./img/search.gif');
} }
.umap-control-text { .umap-control-text {
@ -109,14 +114,15 @@ a.umap-control-less {
text-align: center; text-align: center;
font-size: 0.8em; font-size: 0.8em;
} }
.umap-control-text a { .umap-control-text [type="button"] {
float: right; float: right;
background-color: #666;
margin: 0; margin: 0;
width: 36px; width: 36px;
min-height: 23px;
height: 23px; height: 23px;
line-height: 23px;
} }
.leaflet-control-edit-enable a:before { .leaflet-control-edit-enable [type="button"]:before {
content: ' '; content: ' ';
width: 24px; width: 24px;
height: 24px; height: 24px;
@ -126,7 +132,7 @@ a.umap-control-less {
background-position: -52px -49px; background-position: -52px -49px;
} }
.leaflet-control-edit-enable a { .leaflet-control-edit-enable [type="button"] {
width: initial; width: initial;
padding: 0 20px; padding: 0 20px;
background-color: #353c3e; background-color: #353c3e;
@ -138,7 +144,7 @@ a.umap-control-less {
display: block; display: block;
} }
.leaflet-control-toolbar .leaflet-toolbar-icon.dark:hover, .leaflet-control-toolbar .leaflet-toolbar-icon.dark:hover,
.leaflet-control-edit-enable a:hover { .leaflet-control-edit-enable [type="button"]:hover {
background-color: #4d5759; background-color: #4d5759;
} }
.umap-permanent-credits-container { .umap-permanent-credits-container {
@ -353,6 +359,7 @@ ul.photon-autocomplete {
} }
.umap-help-box .umap-close-link { .umap-help-box .umap-close-link {
float: right; float: right;
width: 100px;
} }
.umap-help-button { .umap-help-button {
display: inline-block; display: inline-block;
@ -362,7 +369,12 @@ ul.photon-autocomplete {
background-position: -4px -4px; background-position: -4px -4px;
background-repeat: no-repeat; background-repeat: no-repeat;
background-image: url('./img/16.svg'); background-image: url('./img/16.svg');
background-color: #323737 !important;
vertical-align: middle; vertical-align: middle;
text-indent: -9999px;
min-height: inherit;
padding-top: 5px;
border: none !important;
} }
.dark .umap-help-button { .dark .umap-help-button {
background-image: url('./img/16-white.svg'); background-image: url('./img/16-white.svg');
@ -485,7 +497,7 @@ ul.photon-autocomplete {
right: 0; right: 0;
height: 46px; height: 46px;
background-color: #323737; background-color: #323737;
padding: 5px 10px; padding: 0 10px;
text-align: left; text-align: left;
line-height: 36px; line-height: 36px;
cursor: auto; cursor: auto;
@ -493,22 +505,29 @@ ul.photon-autocomplete {
z-index: 1000; z-index: 1000;
opacity: 0.98; opacity: 0.98;
color: #fff; color: #fff;
display: flex;
} }
.umap-main-edit-toolbox .logo { .umap-main-edit-toolbox .logo {
width: 39px;
height: 100%;
}
.umap-main-edit-toolbox .logo a {
background-image: url('./img/logo_small.svg'); background-image: url('./img/logo_small.svg');
background-position: 0 center; background-position: 0 center;
background-repeat: no-repeat; background-repeat: no-repeat;
width: 60px;
display: inline-block; display: inline-block;
width: 39px;
height: 100%; height: 100%;
vertical-align: middle; vertical-align: middle;
text-indent: -9999px;
} }
.umap-main-edit-toolbox a { .umap-main-edit-toolbox [type="button"] {
color: #fff; color: #fff;
font-size: 1.2em; font-size: 1.2em;
vertical-align: middle; border: none;
background-color: #323737;
} }
.umap-main-edit-toolbox a:hover { .umap-main-edit-toolbox [type="button"]:hover {
text-decoration: underline; text-decoration: underline;
} }
.umap-main-edit-toolbox .map-name { .umap-main-edit-toolbox .map-name {
@ -520,13 +539,13 @@ ul.photon-autocomplete {
margin-right: 5px; margin-right: 5px;
font-weight: bold; font-weight: bold;
} }
a.map-name:after { .map-name:after {
content: '\00a0'; content: '\00a0';
padding-left: 3px; padding-left: 3px;
width: 1ch; width: 1ch;
display: inline-block; display: inline-block;
} }
.umap-is-dirty a.map-name:after { .umap-is-dirty .map-name:after {
content: '*'; content: '*';
} }
.umap-main-edit-toolbox .share-status { .umap-main-edit-toolbox .share-status {