Skip to content

Commit d3c2cd2

Browse files
committed
Revert "refactor(layer): use @starting-style for the overlay menu toggle"
This reverts commit c8331ba.
1 parent c8331ba commit d3c2cd2

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

‎layer/app/components/IconMenuToggle.vue‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@ const props = defineProps<{
77
88
const { t } = useLocale()
99
10-
// UHeader renders a second toggle in its menu overlay, mounted already open. `starting:` gives its
11-
// lines a closed first style, so they transition into the cross instead of appearing as one.
10+
// UHeader renders a second toggle in its menu overlay, mounted already open. Draw it closed for its
11+
// first frame so the lines transition into the cross instead of appearing as one.
12+
const ready = ref(false)
13+
onMounted(() => requestAnimationFrame(() => requestAnimationFrame(() => {
14+
ready.value = true
15+
})))
16+
const crossed = computed(() => props.open && ready.value)
1217
1318
// Each line turns around its own center; the overshoot approximates the spring the toggle used to have.
1419
const lineClass = 'outline-none origin-center [transform-box:fill-box] transition-[translate,rotate,opacity] duration-300 ease-[cubic-bezier(0.34,1.56,0.64,1)] motion-reduce:transition-none'
@@ -38,21 +43,21 @@ const lineClass = 'outline-none origin-center [transform-box:fill-box] transitio
3843
y1="6"
3944
x2="20"
4045
y2="6"
41-
:class="[lineClass, props.open && 'translate-y-[6px] rotate-45 starting:translate-y-0 starting:rotate-0']"
46+
:class="[lineClass, crossed && 'translate-y-[6px] rotate-45']"
4247
/>
4348
<line
4449
x1="4"
4550
y1="12"
4651
x2="20"
4752
y2="12"
48-
:class="[lineClass, props.open && 'opacity-0 starting:opacity-100']"
53+
:class="[lineClass, crossed && 'opacity-0']"
4954
/>
5055
<line
5156
x1="4"
5257
y1="18"
5358
x2="20"
5459
y2="18"
55-
:class="[lineClass, props.open && '-translate-y-[6px] -rotate-45 starting:translate-y-0 starting:rotate-0']"
60+
:class="[lineClass, crossed && '-translate-y-[6px] -rotate-45']"
5661
/>
5762
</svg>
5863
</UButton>

0 commit comments

Comments
 (0)