Skip to content

Commit 202f5e8

Browse files
committed
fix: code reviews
1 parent e11c30a commit 202f5e8

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

packages/astro/src/default/components/MobileContentToggle.astro

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
---
2-
3-
---
4-
51
<div class="h-12 sm:hidden"></div>
62
<view-toggle
73
class="fixed sm:hidden h-12 bottom-0 w-full bg-tk-elements-app-backgroundColor border-t border-tk-elements-app-borderColor flex justify-center items-center z-60 text-tk-elements-app-textColor"
84
>
9-
<button aria-hidden="true">Tutorial</button>
10-
<button aria-pressed="true" class="rounded-full w-8 h-4 p-0.5 bg-gray-4 dark:bg-gray-6 mx-2 relative">
5+
<button>Tutorial</button>
6+
<button class="rounded-full w-8 h-4 p-0.5 bg-gray-4 dark:bg-gray-6 mx-2 relative">
117
<span class="inline-block transition-all absolute top-0.5 left-0.5 rounded-full bg-white dark:bg-gray-2 w-3 h-3"
128
></span>
139
</button>
14-
<button aria-hidden="true">Editor</button>
10+
<button>Editor</button>
1511
</view-toggle>
1612
<script>
1713
import { viewStore, type View } from '../stores/view-store';
@@ -20,9 +16,7 @@
2016
constructor() {
2117
super();
2218

23-
const [tutorialBtn, toggleButton, editorButton] = this.querySelectorAll(
24-
':scope > button' as 'button',
25-
);
19+
const [tutorialBtn, toggleButton, editorButton] = this.querySelectorAll(':scope > button' as 'button');
2620

2721
const toggle = toggleButton.querySelector('span')!;
2822

packages/astro/src/default/components/ResizablePanel.astro

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ const panelClass = `overflow-hidden ${type === 'horizontal' ? 'h-full' : ''}`;
6363
$container.style.setProperty('--pos', pos);
6464
}
6565
</script>
66-
<div class={panelClass}>
66+
<div class={panelClass} data-id="main-panel">
6767
<slot name="a" />
6868
</div>
6969
{
7070
hasSidePanel && (
7171
<>
72-
<div class={`${panelClass} ${sidePanelClass}`}>
72+
<div class={`${panelClass} ${sidePanelClass}`} data-id="side-panel">
7373
<slot name="b" />
7474
</div>
7575
<div
@@ -97,12 +97,16 @@ const panelClass = `overflow-hidden ${type === 'horizontal' ? 'h-full' : ''}`;
9797
#dragging = false;
9898

9999
#container: HTMLElement;
100+
#mainPanel: HTMLElement;
101+
#sidePanel: HTMLElement | undefined;
100102
#divider: HTMLElement | undefined;
101103

102104
constructor() {
103105
super();
104106

105107
this.#container = this.querySelector(':scope > [data-id="container"]') as HTMLElement;
108+
this.#mainPanel = this.#container.querySelector(':scope > [data-id="main-panel"]') as HTMLElement;
109+
this.#sidePanel = this.#container.querySelector(':scope > [data-id="side-panel"]') as HTMLElement | undefined;
106110
this.#divider = this.#container.querySelector(':scope > [data-id="divider"]') as HTMLElement | undefined;
107111

108112
this.#width = this.#container.clientWidth;
@@ -126,11 +130,11 @@ const panelClass = `overflow-hidden ${type === 'horizontal' ? 'h-full' : ''}`;
126130
}
127131

128132
mainPanel(): HTMLElement {
129-
return this.#container.children[1] as HTMLElement;
133+
return this.#mainPanel;
130134
}
131135

132136
sidePanel(): HTMLElement | undefined {
133-
return this.#container.children[2] as HTMLElement | undefined;
137+
return this.#sidePanel;
134138
}
135139

136140
divider(): HTMLElement | undefined {

0 commit comments

Comments
 (0)