Skip to content

Commit b01377d

Browse files
committed
enh(core): replaced previous native a element with NcButton
Signed-off-by: Eduardo Morales <emoral435@gmail.com>
1 parent 012dcbb commit b01377d

3 files changed

Lines changed: 29 additions & 49 deletions

File tree

core/src/components/Profile/PrimaryActionButton.vue

Lines changed: 26 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,35 @@
2121
-->
2222

2323
<template>
24-
<a class="profile__primary-action-button"
25-
:class="{ 'disabled': disabled }"
24+
<NcButton type="primary"
2625
:href="href"
26+
alignment="center"
2727
:target="target"
28-
rel="noopener noreferrer nofollow"
29-
v-on="$listeners">
30-
<img class="icon"
31-
:class="[icon, { 'icon-invert': colorPrimaryText === '#ffffff' }]"
32-
:src="icon">
28+
:disabled="disabled">
29+
30+
<template #icon>
31+
<img class="icon"
32+
aria-hidden="true"
33+
:src="icon"
34+
alt="" />
35+
</template>
36+
3337
<slot />
34-
</a>
38+
</NcButton>
3539
</template>
3640

3741
<script>
38-
export default {
42+
import { defineComponent } from 'vue'
43+
import { NcButton } from '@nextcloud/vue'
44+
import { translate as t } from '@nextcloud/l10n'
45+
46+
export default defineComponent({
3947
name: 'PrimaryActionButton',
4048
49+
components: {
50+
NcButton,
51+
},
52+
4153
props: {
4254
disabled: {
4355
type: Boolean,
@@ -58,46 +70,14 @@ export default {
5870
},
5971
},
6072
61-
computed: {
62-
colorPrimaryText() {
63-
// For some reason the returned string has prepended whitespace
64-
return getComputedStyle(document.body).getPropertyValue('--color-primary-element-text').trim()
65-
},
73+
methods: {
74+
t,
6675
},
67-
}
76+
})
6877
</script>
6978

7079
<style lang="scss" scoped>
71-
.profile__primary-action-button {
72-
font-size: var(--default-font-size);
73-
font-weight: bold;
74-
width: 188px;
75-
height: 44px;
76-
padding: 0 16px;
77-
line-height: 44px;
78-
text-align: center;
79-
border-radius: var(--border-radius-pill);
80-
color: var(--color-primary-element-text);
81-
background-color: var(--color-primary-element);
82-
overflow: hidden;
83-
white-space: nowrap;
84-
text-overflow: ellipsis;
85-
86-
.icon {
87-
display: inline-block;
88-
vertical-align: middle;
89-
margin-bottom: 2px;
90-
margin-right: 4px;
91-
92-
&.icon-invert {
93-
filter: invert(1);
94-
}
95-
}
96-
97-
&:hover,
98-
&:focus,
99-
&:active {
100-
background-color: var(--color-primary-element-light);
101-
}
80+
.icon {
81+
filter: var(--primary-invert-if-dark);
10282
}
10383
</style>

0 commit comments

Comments
 (0)