Skip to content

Commit ffde837

Browse files
iamdavidhilladamdotdevin
authored andcommitted
fix(app): animate titlebar controls on sidebar open
1 parent 536abea commit ffde837

1 file changed

Lines changed: 34 additions & 18 deletions

File tree

packages/app/src/components/titlebar.tsx

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -217,26 +217,42 @@ export function Titlebar() {
217217
</TooltipKeybind>
218218
<div class="hidden xl:flex items-center shrink-0">
219219
<Show when={params.dir}>
220-
<TooltipKeybind
221-
placement="bottom"
222-
title={language.t("command.session.new")}
223-
keybind={command.keybind("session.new")}
224-
openDelay={2000}
220+
<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+
}}
228+
aria-hidden={layout.sidebar.opened() ? "true" : undefined}
225229
>
226-
<Button
227-
variant="ghost"
228-
icon={creating() ? "new-session-active" : "new-session"}
229-
class="titlebar-icon w-8 h-6 p-0 box-border"
230-
onClick={() => {
231-
if (!params.dir) return
232-
navigate(`/${params.dir}/session`)
233-
}}
234-
aria-label={language.t("command.session.new")}
235-
aria-current={creating() ? "page" : undefined}
236-
/>
237-
</TooltipKeybind>
230+
<TooltipKeybind
231+
placement="bottom"
232+
title={language.t("command.session.new")}
233+
keybind={command.keybind("session.new")}
234+
openDelay={2000}
235+
>
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>
250+
</div>
238251
</Show>
239-
<div class="flex items-center gap-0" classList={{ "ml-1": !!params.dir }}>
252+
<div
253+
class="flex items-center gap-0 transition-[margin] duration-180 ease-out"
254+
classList={{ "ml-1": !!params.dir && !layout.sidebar.opened() }}
255+
>
240256
<Tooltip placement="bottom" value={language.t("common.goBack")} openDelay={2000}>
241257
<Button
242258
variant="ghost"

0 commit comments

Comments
 (0)