Skip to content

Commit 21fdd27

Browse files
committed
feat(TableOfContents): fade in table of contents container
Also remove some dead code. Signed-off-by: Jonas <jonas@freesources.org>
1 parent 26944e4 commit 21fdd27

File tree

4 files changed

+19
-65
lines changed

4 files changed

+19
-65
lines changed

src/components/Editor/TableOfContents/TableOfContents.vue

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
-->
55

66
<template>
7-
<!-- :class="{ '--initial-render': initialRender }" -->
87
<ul class="toc-list">
98
<li
109
v-for="heading in headings"
@@ -39,16 +38,6 @@ export default {
3938
required: true,
4039
},
4140
},
42-
/*
43-
data: () => ({
44-
initialRender: true,
45-
}),
46-
mounted() {
47-
setTimeout(() => {
48-
this.initialRender = false
49-
}, 1000)
50-
},
51-
*/
5241
methods: {
5342
goto(heading) {
5443
const el = this.$root.$el.querySelector(`#${heading.id}`)
@@ -67,35 +56,20 @@ export default {
6756
</script>
6857
6958
<style lang="scss" scoped>
70-
/*
71-
.--initial-render {
72-
.editor__toc {
73-
&-item {
74-
--initial-padding-inline-start: 0;
75-
animation: initialPadding 1.5s;
76-
}
77-
}
78-
}
79-
*/
80-
8159
.toc-list {
8260
width: 100%;
8361
list-style: none;
8462
font-size: 0.9rem;
8563
padding: 0;
8664
8765
--level-padding: 12px;
88-
// animation-name: fadeInLeft;
89-
// animation-duration: var(--animation-duration);
9066
9167
&__item {
92-
// transform: translateX(var(--padding-inline-start, 0rem));
9368
color: var(--color-text-lighter);
9469
overflow: hidden;
9570
text-overflow: ellipsis;
9671
white-space: nowrap;
9772
padding-inline-start: var(--padding-inline-start);
98-
// animation: initialPadding calc(var(--animation-duration) * 2);
9973
10074
a {
10175
color: var(--color-text-lighter);
@@ -128,42 +102,6 @@ export default {
128102
--padding-inline-start: calc(#{$i - 1} * var(--level-padding));
129103
}
130104
}
131-
132-
&.previous1 {
133-
--initial-padding-inline-start: calc(0 * var(--level-padding));
134-
}
135-
136-
&.previous2 {
137-
--initial-padding-inline-start: calc(1 * var(--level-padding));
138-
}
139-
140-
&.previous3 {
141-
--initial-padding-inline-start: calc(2 * var(--level-padding));
142-
}
143-
144-
&.previous4 {
145-
--initial-padding-inline-start: calc(3 * var(--level-padding));
146-
}
147-
148-
&.previous5 {
149-
--initial-padding-inline-start: calc(4 * var(--level-padding));
150-
}
151-
152-
&.previous6 {
153-
--initial-padding-inline-start: calc(5 * var(--level-padding));
154-
}
155-
}
156-
}
157-
158-
/**
159-
@keyframes initialPadding {
160-
from {
161-
transform: translateX(var(--initial-padding-inline-start, initial));
162-
}
163-
164-
to {
165-
transform: translateX(var(--padding-inline-start, 0rem));
166105
}
167106
}
168-
*/
169107
</style>

src/components/Editor/TableOfContents/TocDesktop.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ export default defineComponent({
8080
display: flex;
8181
flex-direction: column;
8282
overflow-y: auto;
83+
animation-name: fadeInRight;
84+
animation-duration: 0.3s;
8385
8486
padding: 12px;
8587
padding-bottom: 24px;
@@ -99,4 +101,9 @@ export default defineComponent({
99101
justify-content: end;
100102
}
101103
}
104+
105+
@keyframes fadeIn {
106+
from { opacity: 0; }
107+
to { opacity: 1; }
108+
}
102109
</style>

src/components/Menu/MenuBar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ export default {
271271
272272
&.text-menubar--ready:not(.text-menubar--hide) {
273273
visibility: visible;
274-
animation-name: fadeInDown;
274+
animation-name: fadeInRight;
275275
animation-duration: 0.3s;
276276
}
277277

src/css/style.scss

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,15 @@ li.ProseMirror-selectednode {
106106
}
107107
}
108108

109-
.fadeInLeft {
110-
animation-name: fadeInLeft;
109+
// from https://github.com/animate-css/animate.css/blob/main/source/fading_entrances/fadeInRight.css
110+
@keyframes fadeInRight {
111+
from {
112+
opacity: 0;
113+
transform: translate3d(100%, 0, 0);
114+
}
115+
116+
to {
117+
opacity: 1;
118+
transform: translate3d(0, 0, 0);
119+
}
111120
}

0 commit comments

Comments
 (0)