mirror of
https://github.com/nextcloud/server.git
synced 2026-06-08 00:02:54 -04:00
enh(core): replaced previous native a element with NcButton
Signed-off-by: Eduardo Morales <emoral435@gmail.com>
This commit is contained in:
parent
4d0d0ea2cd
commit
9f8154ff09
3 changed files with 27 additions and 49 deletions
|
|
@ -21,23 +21,33 @@
|
|||
-->
|
||||
|
||||
<template>
|
||||
<a class="profile__primary-action-button"
|
||||
:class="{ 'disabled': disabled }"
|
||||
<NcButton type="primary"
|
||||
:href="href"
|
||||
alignment="center"
|
||||
:target="target"
|
||||
rel="noopener noreferrer nofollow"
|
||||
v-on="$listeners">
|
||||
<img class="icon"
|
||||
:class="[icon, { 'icon-invert': colorPrimaryText === '#ffffff' }]"
|
||||
:src="icon">
|
||||
:disabled="disabled">
|
||||
<template #icon>
|
||||
<img class="icon"
|
||||
aria-hidden="true"
|
||||
:src="icon"
|
||||
alt="">
|
||||
</template>
|
||||
<slot />
|
||||
</a>
|
||||
</NcButton>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
import { defineComponent } from 'vue'
|
||||
import { NcButton } from '@nextcloud/vue'
|
||||
import { translate as t } from '@nextcloud/l10n'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'PrimaryActionButton',
|
||||
|
||||
components: {
|
||||
NcButton,
|
||||
},
|
||||
|
||||
props: {
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
|
|
@ -58,46 +68,14 @@ export default {
|
|||
},
|
||||
},
|
||||
|
||||
computed: {
|
||||
colorPrimaryText() {
|
||||
// For some reason the returned string has prepended whitespace
|
||||
return getComputedStyle(document.body).getPropertyValue('--color-primary-element-text').trim()
|
||||
},
|
||||
methods: {
|
||||
t,
|
||||
},
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.profile__primary-action-button {
|
||||
font-size: var(--default-font-size);
|
||||
font-weight: bold;
|
||||
width: 188px;
|
||||
height: 44px;
|
||||
padding: 0 16px;
|
||||
line-height: 44px;
|
||||
text-align: center;
|
||||
border-radius: var(--border-radius-pill);
|
||||
color: var(--color-primary-element-text);
|
||||
background-color: var(--color-primary-element);
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
|
||||
.icon {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
margin-bottom: 2px;
|
||||
margin-right: 4px;
|
||||
|
||||
&.icon-invert {
|
||||
filter: invert(1);
|
||||
}
|
||||
}
|
||||
|
||||
&:hover,
|
||||
&:focus,
|
||||
&:active {
|
||||
background-color: var(--color-primary-element-light);
|
||||
}
|
||||
.icon {
|
||||
filter: var(--primary-invert-if-dark);
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
4
dist/core-profile.js
vendored
4
dist/core-profile.js
vendored
File diff suppressed because one or more lines are too long
2
dist/core-profile.js.map
vendored
2
dist/core-profile.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue