Skip to content

Commit 050d71b

Browse files
iamdavidhilladamdotdevin
authored andcommitted
fix(app): avoid clipping new session during sidebar anim
1 parent ffde837 commit 050d71b

1 file changed

Lines changed: 35 additions & 28 deletions

File tree

packages/app/src/components/titlebar.tsx

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -218,40 +218,47 @@ export function Titlebar() {
218218
<div class="hidden xl:flex items-center shrink-0">
219219
<Show when={params.dir}>
220220
<div
221-
class="overflow-hidden flex items-center shrink-0 transition-[width,opacity,transform]"
222-
classList={{
223-
"w-8 opacity-100 translate-x-0": !layout.sidebar.opened(),
224-
"w-0 opacity-0 -translate-x-1 pointer-events-none": layout.sidebar.opened(),
225-
"duration-180 ease-out": !layout.sidebar.opened(),
226-
"duration-120 ease-in": layout.sidebar.opened(),
227-
}}
221+
class="flex items-center shrink-0 w-8 mr-1"
228222
aria-hidden={layout.sidebar.opened() ? "true" : undefined}
229223
>
230-
<TooltipKeybind
231-
placement="bottom"
232-
title={language.t("command.session.new")}
233-
keybind={command.keybind("session.new")}
234-
openDelay={2000}
224+
<div
225+
class="transition-opacity"
226+
classList={{
227+
"opacity-100 duration-120 ease-out": !layout.sidebar.opened(),
228+
"opacity-0 duration-120 ease-in delay-0 pointer-events-none": layout.sidebar.opened(),
229+
}}
235230
>
236-
<Button
237-
variant="ghost"
238-
icon={creating() ? "new-session-active" : "new-session"}
239-
class="titlebar-icon w-8 h-6 p-0 box-border"
240-
disabled={layout.sidebar.opened()}
241-
tabIndex={layout.sidebar.opened() ? -1 : undefined}
242-
onClick={() => {
243-
if (!params.dir) return
244-
navigate(`/${params.dir}/session`)
245-
}}
246-
aria-label={language.t("command.session.new")}
247-
aria-current={creating() ? "page" : undefined}
248-
/>
249-
</TooltipKeybind>
231+
<TooltipKeybind
232+
placement="bottom"
233+
title={language.t("command.session.new")}
234+
keybind={command.keybind("session.new")}
235+
openDelay={2000}
236+
>
237+
<Button
238+
variant="ghost"
239+
icon={creating() ? "new-session-active" : "new-session"}
240+
class="titlebar-icon w-8 h-6 p-0 box-border"
241+
disabled={layout.sidebar.opened()}
242+
tabIndex={layout.sidebar.opened() ? -1 : undefined}
243+
onClick={() => {
244+
if (!params.dir) return
245+
navigate(`/${params.dir}/session`)
246+
}}
247+
aria-label={language.t("command.session.new")}
248+
aria-current={creating() ? "page" : undefined}
249+
/>
250+
</TooltipKeybind>
251+
</div>
250252
</div>
251253
</Show>
252254
<div
253-
class="flex items-center gap-0 transition-[margin] duration-180 ease-out"
254-
classList={{ "ml-1": !!params.dir && !layout.sidebar.opened() }}
255+
class="flex items-center gap-0 transition-transform"
256+
classList={{
257+
"translate-x-0": !layout.sidebar.opened(),
258+
"-translate-x-[36px]": layout.sidebar.opened(),
259+
"duration-180 ease-out": !layout.sidebar.opened(),
260+
"duration-180 ease-in": layout.sidebar.opened(),
261+
}}
255262
>
256263
<Tooltip placement="bottom" value={language.t("common.goBack")} openDelay={2000}>
257264
<Button

0 commit comments

Comments
 (0)