Skip to content

Commit 6641f89

Browse files
Fixed overlap of field handle and map toggle
1 parent 0c2ecd6 commit 6641f89

File tree

6 files changed

+57065
-14
lines changed

6 files changed

+57065
-14
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Fixed
6+
- Fixed visual overlap of field handle and map toggle occurring in Craft 5.6+. ([#13](https://github.com/doublesecretagency/craft-mapbox/issues/13))
7+
38
## 2.0.0 - 2024-02-24
49

510
### Changed

src/web/assets/dist/css/address.css

+49-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,49 @@
1-
.field .copytextbtn.gm-toggle-both{margin-right:94px}.field .copytextbtn.gm-toggle-text{margin-right:79px}.field .copytextbtn.gm-toggle-icon{margin-right:21px}.address-field{width:101%}.address-field input{margin-bottom:2px;margin-right:1%}.mb-map{background-color:#f3f7fc;border:1px solid #d7dfe7;border-radius:3px;box-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px 0 rgba(0,0,0,.06);height:240px;margin-right:1%;margin-top:2px;text-align:center;width:99%}.mb-map>div{color:#606d7b;font-style:italic;font-weight:700}.errors .required{border:1px solid #cf1124!important}.superTableContainer.columnLayout .address-field,.superTableContainer.rowLayout .address-field{margin-bottom:3px;margin-top:27px}
1+
.field .copytextbtn.mb-toggle-both,
2+
.field .action-btn.mb-toggle-both,
3+
.field craft-copy-attribute.mb-toggle-both {
4+
margin-right: 94px;
5+
}
6+
.field .copytextbtn.mb-toggle-text,
7+
.field .action-btn.mb-toggle-text,
8+
.field craft-copy-attribute.mb-toggle-text {
9+
margin-right: 79px;
10+
}
11+
.field .copytextbtn.mb-toggle-icon,
12+
.field .action-btn.mb-toggle-icon,
13+
.field craft-copy-attribute.mb-toggle-icon {
14+
margin-right: 21px;
15+
}
16+
17+
.address-field {
18+
width: 101%;
19+
}
20+
.address-field input {
21+
margin-right: 1%;
22+
margin-bottom: 2px;
23+
}
24+
25+
.mb-map {
26+
height: 240px;
27+
width: 99%;
28+
margin-right: 1%;
29+
margin-top: 2px;
30+
text-align: center;
31+
background-color: #f3f7fc;
32+
border: 1px solid #d7dfe7;
33+
border-radius: 3px;
34+
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
35+
}
36+
.mb-map > div {
37+
color: #606d7b;
38+
font-weight: bold;
39+
font-style: italic;
40+
}
41+
42+
.errors .required {
43+
border: 1px solid #cf1124 !important;
44+
}
45+
46+
.superTableContainer.columnLayout .address-field, .superTableContainer.rowLayout .address-field {
47+
margin-top: 27px;
48+
margin-bottom: 3px;
49+
}

src/web/assets/dist/js/address-settings.js

+33,882-2
Large diffs are not rendered by default.

src/web/assets/dist/js/address.js

+23,106-2
Large diffs are not rendered by default.

src/web/assets/src/sass/address.scss

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
// To accommodate the map toggle, adjust margin of "copy" div
22
.field {
3-
.copytextbtn {
4-
&.gm-toggle-both {margin-right: 94px;}
5-
&.gm-toggle-text {margin-right: 79px;}
6-
&.gm-toggle-icon {margin-right: 21px;}
3+
.copytextbtn, // Craft < 5.6
4+
.action-btn, // Craft 5.6+ (menu button)
5+
craft-copy-attribute { // Craft 5.6+ (copy handle)
6+
&.mb-toggle-both {margin-right: 94px;}
7+
&.mb-toggle-text {margin-right: 79px;}
8+
&.mb-toggle-icon {margin-right: 21px;}
79
}
810
}
911

src/web/assets/src/vue/address/address-toggle.vue

+17-5
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,30 @@ export default {
6565
return toggleOffset;
6666
}
6767
68+
// Compile new class
69+
const toggleClass = `mb-toggle-${this.config.style}`;
70+
6871
// Look at parent element to get nearby items
69-
let copyTextBtn = this.container.getElementsByClassName('copytextbtn');
70-
let instructions = this.container.getElementsByClassName('instructions');
72+
let copyTextBtn = this.container.getElementsByClassName('copytextbtn');
73+
let actionBtn = this.container.getElementsByClassName('action-btn');
74+
let copyAttribute = this.container.getElementsByTagName('craft-copy-attribute');
75+
let instructions = this.container.getElementsByClassName('instructions');
7176
72-
// If "copy" div is visible
77+
// If "copy" div is visible (Craft < 5.6)
7378
if (copyTextBtn.length) {
74-
// Compile new class
75-
const toggleClass = `gm-toggle-${this.config.style}`;
7679
// Add new class to "copy" div
7780
copyTextBtn[0].classList.add(toggleClass);
7881
}
7982
83+
// If "copy" div is visible (Craft 5.6+)
84+
if (copyAttribute.length) {
85+
// Add new class to "copy" div
86+
copyAttribute[0].classList.add(toggleClass);
87+
} else if (actionBtn.length) {
88+
// Add new class to menu button
89+
actionBtn[0].classList.add(toggleClass);
90+
}
91+
8092
// If field has instructions
8193
if (instructions.length) {
8294
// Measure height of instructions div

0 commit comments

Comments
 (0)