Skip to content

Commit

Permalink
enh(core): replaced previous native a element with NcButton
Browse files Browse the repository at this point in the history
Signed-off-by: Eduardo Morales <emoral435@gmail.com>
  • Loading branch information
emoral435 committed Jan 8, 2024
1 parent adfe883 commit a2c311f
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 47 deletions.
109 changes: 65 additions & 44 deletions core/src/components/Profile/PrimaryActionButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,38 @@
-->

<template>
<a class="profile__primary-action-button"
:class="{ 'disabled': disabled }"
<NcButton
:aria-label="t('core', 'Start your native mail application to send mail...')"

Check failure on line 25 in core/src/components/Profile/PrimaryActionButton.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Expected no linebreak before this attribute
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
aria-hidden="true"

Check failure on line 34 in core/src/components/Profile/PrimaryActionButton.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Expected no linebreak before this attribute

Check failure on line 34 in core/src/components/Profile/PrimaryActionButton.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Trailing spaces not allowed
:src="icon"

Check failure on line 35 in core/src/components/Profile/PrimaryActionButton.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Trailing spaces not allowed
alt="" />
</template>

<!-- this is the default slot for the NcButton Component, which will be the text for the button -->
<slot />
</a>
</NcButton>
</template>

<script>
export default {
import { defineComponent } from 'vue'
import { NcButton } from '@nextcloud/vue'
import { translate as t} from '@nextcloud/l10n'

Check failure on line 47 in core/src/components/Profile/PrimaryActionButton.vue

View workflow job for this annotation

GitHub Actions / NPM lint

A space is required before '}'

export default defineComponent({
name: 'PrimaryActionButton',

components: {
NcButton,
},

props: {
disabled: {
type: Boolean,
Expand All @@ -58,46 +73,52 @@ 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,
},
}

// FIXME remove uneeded CSS once https://github.com/nextcloud/server/issues/42596 has been fixed
// computed: {
// colorPrimaryText() {
// // For some reason the returned string has prepended whitespace
// return getComputedStyle(document.body).getPropertyValue('--color-primary-element-text').trim()
// },
// },
})
</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;
// FIXME remove unneeded CSS once https://github.com/nextcloud/server/issues/42596 has been fixed
// .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 {
// display: inline-block;
// vertical-align: middle;
// margin-bottom: 2px;
// margin-right: 4px;

&.icon-invert {
filter: invert(1);
}
}
// &.icon-invert {
// filter: invert(1);
// }
// }

&:hover,
&:focus,
&:active {
background-color: var(--color-primary-element-light);
}
}
// &:hover,
// &:focus,
// &:active {
// background-color: var(--color-primary-element-light);
// }
// }
</style>
Loading

0 comments on commit a2c311f

Please sign in to comment.