Skip to content

Commit c23eea1

Browse files
committed
fix: live editor in mobile size
1 parent 166c095 commit c23eea1

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

apps/docs/src/containers/theme-editor/theme-editor.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,18 @@
4242
min-width: 0;
4343
}
4444

45+
@media (max-width: 840px) {
46+
&__layout {
47+
flex-direction: column;
48+
}
49+
50+
&__sidebar {
51+
width: 100%;
52+
position: static;
53+
max-height: none;
54+
}
55+
}
56+
4557
// Panel
4658
&__panel {
4759
padding: 8px 0;

packages/react/src/tabs/tabs.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,14 @@ const Tabs = React.forwardRef<HTMLDivElement, TabsProps>(
161161
if (!el || !wrap || !showNav) return;
162162

163163
if (isHorizontal) {
164+
const wrapWidth = wrap.clientWidth;
165+
if (wrapWidth <= 0) return;
164166
const elLeft = el.offsetLeft;
165167
const elRight = elLeft + el.offsetWidth;
166168
if (elLeft < scrollOffset) {
167169
setScrollOffset(elLeft);
168-
} else if (elRight > scrollOffset + wrap.clientWidth) {
169-
setScrollOffset(elRight - wrap.clientWidth);
170+
} else if (elRight > scrollOffset + wrapWidth) {
171+
setScrollOffset(elRight - wrapWidth);
170172
}
171173
}
172174
}, [currentKey, showNav, isHorizontal, scrollOffset]);

0 commit comments

Comments
 (0)