classcard-ui 0.2.426 → 0.2.429

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "classcard-ui",
3
- "version": "0.2.426",
3
+ "version": "0.2.429",
4
4
  "main": "dist/classcard-ui.common.js",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -51,9 +51,8 @@
51
51
  </a>
52
52
  </nav>
53
53
  </div>
54
- <!-- Dummy data to demonstrate scrolling -->
55
- <div id="accounts" class="h-40 bg-indigo-400"></div>
56
- <div id="members" class="h-60 bg-red-500"></div>
54
+ <!-- <div id="mobile-app" style="height: 20rem; background-color: red"></div>
55
+ <div id="preferences" style="height: 40rem; background-color: blue"></div> -->
57
56
  <slot></slot>
58
57
  </div>
59
58
  </div>
@@ -77,15 +76,37 @@ export default {
77
76
  },
78
77
  data() {
79
78
  return {
79
+ // tabs: [
80
+ // { name: "mobile-app", text: "Mobile app" },
81
+ // { name: "preferences", text: "Preferences" },
82
+ // ],
80
83
  activeTab: this.initialTab,
81
84
  };
82
85
  },
83
86
  methods: {
87
+ scrollIfNeeded(element, container) {
88
+ if (element.offsetTop < container.scrollTop) {
89
+ container.scrollTop = element.offsetTop;
90
+ } else {
91
+ const offsetBottom = element.offsetTop + element.offsetHeight;
92
+ const scrollBottom = container.scrollTop + container.offsetHeight;
93
+ if (offsetBottom > scrollBottom) {
94
+ container.scrollTop = offsetBottom - container.offsetHeight;
95
+ }
96
+ }
97
+ },
84
98
  switchTab(name) {
85
99
  this.activeTab = name;
86
- document.querySelector(`#${name}`).scrollIntoView({
87
- behavior: "smooth",
88
- });
100
+ // document.getElementById(`${name}`).scrollIntoView({
101
+ // behavior: "smooth",
102
+ // block: "nearest",
103
+ // inline: "start",
104
+ // });
105
+
106
+ this.scrollIfNeeded(
107
+ document.getElementById(`${name}`),
108
+ document.getElementById("container")
109
+ );
89
110
  },
90
111
  switchTabForMobile(index) {
91
112
  var selectedOption = this.tabs[index];