Skip to content

Commit d155305

Browse files
committed
refactor: simplify responsive behavior
1 parent ba053b1 commit d155305

File tree

1 file changed

+1
-32
lines changed

1 file changed

+1
-32
lines changed

js/src/sidebar.js

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ const DefaultType = {
3838

3939
const CLASS_NAME_BACKDROP = 'sidebar-backdrop'
4040
const CLASS_NAME_FADE = 'fade'
41-
// const CLASS_NAME_HIDE = 'hide'
4241
const CLASS_NAME_SHOW = 'show'
4342
const CLASS_NAME_SIDEBAR = 'sidebar'
4443
const CLASS_NAME_SIDEBAR_NARROW = 'sidebar-narrow'
@@ -69,7 +68,6 @@ class Sidebar extends BaseComponent {
6968
constructor(element, config) {
7069
super(element)
7170
this._config = this._getConfig(config)
72-
// this._breakpoint = this._getBreakpoint()
7371
this._show = this._isVisible()
7472
this._mobile = this._isMobile()
7573
this._overlaid = this._isOverlaid()
@@ -96,10 +94,6 @@ class Sidebar extends BaseComponent {
9694
show() {
9795
EventHandler.trigger(this._element, EVENT_SHOW)
9896

99-
// if (this._element.classList.contains(CLASS_NAME_HIDE)) {
100-
// this._element.classList.remove(CLASS_NAME_HIDE)
101-
// }
102-
10397
if (REGEXP_SIDEBAR_SELF_HIDING.test(this._element.className)) {
10498
this._element.classList.add(CLASS_NAME_SHOW)
10599
}
@@ -132,8 +126,6 @@ class Sidebar extends BaseComponent {
132126
this._element.classList.remove(CLASS_NAME_SHOW)
133127
}
134128

135-
// this._element.classList.add(CLASS_NAME_HIDE)
136-
137129
if (this._isMobile()) {
138130
this._removeBackdrop()
139131
}
@@ -156,7 +148,7 @@ class Sidebar extends BaseComponent {
156148
}
157149

158150
toggle() {
159-
if (this._show) {
151+
if (this._isVisible()) {
160152
this.hide()
161153
return
162154
}
@@ -240,29 +232,6 @@ class Sidebar extends BaseComponent {
240232
return Boolean(window.getComputedStyle(this._element, null).getPropertyValue('--cui-is-mobile'))
241233
}
242234

243-
_isIOS() {
244-
const iOSDevices = [
245-
'iPad Simulator',
246-
'iPhone Simulator',
247-
'iPod Simulator',
248-
'iPad',
249-
'iPhone',
250-
'iPod'
251-
]
252-
253-
const platform = Boolean(navigator.platform)
254-
255-
if (platform) {
256-
while (iOSDevices.length) {
257-
if (navigator.platform === iOSDevices.pop()) {
258-
return true
259-
}
260-
}
261-
}
262-
263-
return false
264-
}
265-
266235
_isNarrow() {
267236
return this._element.classList.contains(CLASS_NAME_SIDEBAR_NARROW)
268237
}

0 commit comments

Comments
 (0)