Skip to content

Commit 98deda9

Browse files
Extract buttons from pages so the animation does not affect them
Signed-off-by Marco <marcoambrosini@icloud.com>
1 parent f978dde commit 98deda9

File tree

4 files changed

+34
-35
lines changed

4 files changed

+34
-35
lines changed

src/App.vue

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@
6262
<Page2 v-else-if="page === 2" @next="goToNextPage" />
6363
<Page3 v-else-if="page === 3" @close="close" />
6464
</Transition>
65+
<NcButton type="primary"
66+
alignment="center-reverse"
67+
:wide="true"
68+
@click="handleButtonCLick">
69+
<template v-if="page !== 3" #icon>
70+
<ArrowRight :size="20" />
71+
</template>
72+
{{ buttonText }}
73+
</NcButton>
6574
</div>
6675
</NcModal>
6776
</template>
@@ -77,6 +86,7 @@ import Page2 from './components/Page2.vue'
7786
import Page3 from './components/Page3.vue'
7887
7988
import ArrowLeft from 'vue-material-design-icons/ArrowLeft.vue'
89+
import ArrowRight from 'vue-material-design-icons/ArrowRight.vue'
8090
import Close from 'vue-material-design-icons/Close.vue'
8191
8292
export default {
@@ -88,6 +98,7 @@ export default {
8898
Page2,
8999
NcButton,
90100
ArrowLeft,
101+
ArrowRight,
91102
Page3,
92103
Close,
93104
},
@@ -122,6 +133,17 @@ export default {
122133
return this.page < 3
123134
}
124135
},
136+
137+
buttonText() {
138+
if (this.page === 1) {
139+
return t('firstrunwizard', 'Nextcloud on all your devices')
140+
} else if (this.page === 2) {
141+
return t('firstrunwizard', 'More about Nextcloud')
142+
} else if (this.page === 3) {
143+
return t('firstrunwizard', 'Get started!')
144+
}
145+
return ''
146+
},
125147
},
126148
127149
methods: {
@@ -156,6 +178,14 @@ export default {
156178
})
157179
158180
},
181+
182+
handleButtonCLick() {
183+
if (this.page < 3) {
184+
this.goToNextPage()
185+
} else {
186+
this.close()
187+
}
188+
},
159189
},
160190
}
161191
</script>
@@ -168,6 +198,8 @@ export default {
168198
overflow: hidden;
169199
padding: calc(var(--default-grid-baseline) * 5);
170200
display: flex;
201+
flex-direction: column;
202+
justify-content: space-between;
171203
min-height: min(520px, 80vh);
172204
}
173205

src/components/Page1.vue

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,6 @@
4646
</Card>
4747
</div>
4848
</div>
49-
<NcButton type="primary"
50-
alignment="center-reverse"
51-
:wide="true"
52-
@click="$emit('next')">
53-
<template #icon>
54-
<ArrowRight :size="20" />
55-
</template>
56-
{{ t('firstrunwizard', 'Nextcloud on all your devices') }}
57-
</NcButton>
5849
</div>
5950
</template>
6051

@@ -65,9 +56,6 @@ import Lock from 'vue-material-design-icons/Lock.vue'
6556
import BriefcaseCheck from 'vue-material-design-icons/BriefcaseCheck.vue'
6657
import SwapHorizontal from 'vue-material-design-icons/SwapHorizontal.vue'
6758
import AccountGroup from 'vue-material-design-icons/AccountGroup.vue'
68-
import ArrowRight from 'vue-material-design-icons/ArrowRight.vue'
69-
70-
import { NcButton } from '@nextcloud/vue'
7159
7260
export default {
7361
name: 'Page1',
@@ -78,8 +66,6 @@ export default {
7866
BriefcaseCheck,
7967
SwapHorizontal,
8068
AccountGroup,
81-
NcButton,
82-
ArrowRight,
8369
},
8470
}
8571
</script>

src/components/Page2.vue

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,31 +40,19 @@
4040
:title="t('firstrunwizard', 'Calendar and contacts ↗')"
4141
:subtitle="t('firstrunwizard', 'Connect your calendar and contacts with your devices.')" />
4242
</div>
43-
</div><NcButton type="primary"
44-
alignment="center-reverse"
45-
:wide="true"
46-
@click="$emit('next')">
47-
<template #icon>
48-
<ArrowRight :size="20" />
49-
</template>
50-
{{ t('firstrunwizard', 'More about Nextcloud') }}
51-
</NcButton>
43+
</div>
5244
</div>
5345
</template>
5446

5547
<script>
5648
import Card from './Card.vue'
5749
import AppStoreBadge from './AppStoreBadge.vue'
58-
import ArrowRight from 'vue-material-design-icons/ArrowRight.vue'
59-
import { NcButton } from '@nextcloud/vue'
6050
import { generateUrl } from '@nextcloud/router'
6151
6252
export default {
6353
name: 'Page2',
6454
6555
components: {
66-
NcButton,
67-
ArrowRight,
6856
Card,
6957
AppStoreBadge,
7058
},

src/components/Page3.vue

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,24 +44,17 @@
4444
<p class="version-number">
4545
{{ versionNumbrer }}
4646
</p>
47-
</div><NcButton type="primary"
48-
alignment="center-reverse"
49-
:wide="true"
50-
@click="$emit('close')">
51-
{{ t('firstrunwizard', 'Get started!') }}
52-
</NcButton>
47+
</div>
5348
</div>
5449
</template>
5550

5651
<script>
5752
import Card from './Card.vue'
58-
import { NcButton } from '@nextcloud/vue'
5953
6054
export default {
6155
name: 'Page3',
6256
6357
components: {
64-
NcButton,
6558
Card,
6659
},
6760

0 commit comments

Comments
 (0)