Skip to content

Commit

Permalink
refactor: Use variant instead of type when using NcButton
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
  • Loading branch information
susnux committed Jan 29, 2025
1 parent 89b2310 commit ab19ff3
Show file tree
Hide file tree
Showing 21 changed files with 67 additions and 67 deletions.
6 changes: 3 additions & 3 deletions src/components/NcAppContent/NcAppDetailsToggle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

<template>
<NcButton v-tooltip="title"
type="tertiary"
:aria-label="title"
class="app-details-toggle"
:class="{ 'app-details-toggle--mobile': isMobile }">
:class="{ 'app-details-toggle--mobile': isMobile }"
:aria-label="title"
variant="tertiary">
<template #icon>
<ArrowLeft v-if="isRTL" :size="20" />
<ArrowRight v-else :size="20" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<!-- Button to expand or collapse children -->
<NcButton class="icon-collapse"
:class="{'icon-collapse--open':open}"
type="tertiary"
:aria-label="labelButton"
variant="tertiary"
@click="onClick">
<template #icon>
<ChevronUp v-if="open"
Expand Down
14 changes: 7 additions & 7 deletions src/components/NcAppNavigationItem/NcInputConfirmCancel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@
class="app-navigation-input-confirm__input"
:placeholder="placeholder">

<NcButton native-type="submit"
type="primary"
:aria-label="labelConfirm"
<NcButton :aria-label="labelConfirm"
type="submit"
variant="primary"
@click.stop.prevent="confirm">
<template #icon>
<ArrowRight :size="20" />
</template>
</NcButton>

<NcButton native-type="reset"
:type="primary ? 'primary' : 'tertiary'"
:aria-label="labelCancel"
<NcButton :aria-label="labelCancel"
type="reset"
:variant="primary ? 'primary' : 'tertiary'"
@click.stop.prevent="cancel">
<template #icon>
<Close :size="20" />
Expand All @@ -42,11 +42,11 @@
</div>
</template>
<script>
import NcButton from '../NcButton/index.js'
import { t } from '../../l10n.js'

import ArrowRight from 'vue-material-design-icons/ArrowRight.vue'
import Close from 'vue-material-design-icons/Close.vue'
import NcButton from '../NcButton/index.js'

export default {
name: 'NcInputConfirmCancel',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
Filter by year
</NcActionButton>
</NcActions>
<NcButton aria-label="Search globally" type="tertiary">
<NcButton aria-label="Search globally" variant="tertiary">
<template #icon>
<IconSearchGlobal :size="20" />
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<template>
<div class="app-navigation-toggle-wrapper">
<NcButton class="app-navigation-toggle"
type="tertiary"
aria-controls="app-navigation-vue"
:aria-expanded="open ? 'true' : 'false'"
:aria-keyshortcuts="disableKeyboardShortcuts ? '' : 'n'"
:aria-label="label"
:title="label"
aria-controls="app-navigation-vue"
:aria-keyshortcuts="disableKeyboardShortcuts ? '' : 'n'"
variant="tertiary"
@click="toggleNavigation">
<template #icon>
<MenuOpenIcon v-if="open" :size="20" />
Expand Down
18 changes: 9 additions & 9 deletions src/components/NcAppSidebar/NcAppSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ Note: the built-in toggle button is only available then NcAppSidebar is used in
<NcContent app-name="styleguidist" class="content-styleguidist">
<NcAppContent>
<div class="top-bar">
<NcButton type="primary">Start a call</NcButton>
<NcButton variant="primary">Start a call</NcButton>
</div>
</NcAppContent>
<!-- The sidebar -->
Expand Down Expand Up @@ -548,7 +548,7 @@ export default {
<NcButton :aria-label="t('Open sidebar')"
class="app-sidebar__toggle"
:class="toggleClasses"
type="tertiary"
variant="tertiary"
v-bind="toggleAttrs"
@click="$emit('update:open', true)">
<template #icon>
Expand Down Expand Up @@ -598,7 +598,7 @@ export default {
:aria-label="favoriteTranslated"
:pressed="isStarred"
class="app-sidebar-header__star"
type="secondary"
variant="secondary"
@click.prevent="toggleStarred">
<template #icon>
<NcLoadingIcon v-if="starLoading" />
Expand Down Expand Up @@ -636,9 +636,9 @@ export default {
:value="name"
@keydown.esc.stop="onDismissEditing"
@input="onNameInput">
<NcButton type="tertiary-no-background"
:aria-label="changeNameTranslated"
native-type="submit">
<NcButton :aria-label="changeNameTranslated"
type="submit"
variant="tertiary-no-background">
<template #icon>
<ArrowRight :size="20" />
</template>
Expand Down Expand Up @@ -666,10 +666,10 @@ export default {
</div>

<NcButton ref="closeButton"
:title="closeTranslated"
:aria-label="closeTranslated"
type="tertiary"
:title="closeTranslated"
class="app-sidebar__close"
variant="tertiary"
@click.prevent="closeSidebar">
<template #icon>
<Close :size="20" />
Expand Down Expand Up @@ -704,9 +704,9 @@ import { Portal as Teleport } from '@linusborg/vue-simple-portal'

import NcAppSidebarTabs from './NcAppSidebarTabs.vue'
import NcActions from '../NcActions/index.js'
import NcLoadingIcon from '../NcLoadingIcon/index.js'
import NcButton from '../NcButton/index.js'
import NcEmptyContent from '../NcEmptyContent/index.js'
import NcLoadingIcon from '../NcLoadingIcon/index.js'
import Focus from '../../directives/Focus/index.js'
import Linkify from '../../directives/Linkify/index.js'
import { useIsSmallMobile } from '../../composables/useIsMobile/index.js'
Expand Down
10 changes: 5 additions & 5 deletions src/components/NcAvatar/NcAvatar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -175,22 +175,22 @@ export default {
<!-- Contact menu -->
<!-- We show a button if the menu is not loaded yet. -->
<NcButton v-if="hasMenu && menu.length === 0"
type="tertiary-no-background"
class="action-item action-item__menutoggle"
:aria-label="avatarAriaLabel"
class="action-item action-item__menutoggle"
variant="tertiary-no-background"
@click="toggleMenu">
<template #icon>
<NcLoadingIcon v-if="contactsMenuLoading" />
<DotsHorizontal v-else :size="20" />
</template>
</NcButton>
<NcActions v-else-if="hasMenu"
:aria-label="avatarAriaLabel"
:container="menuContainer"
force-menu
manual-open
type="tertiary-no-background"
:container="menuContainer"
:open.sync="contactsMenuOpenState"
:aria-label="avatarAriaLabel"
variant="tertiary-no-background"
@click="toggleMenu">
<component :is="item.ncActionComponent"
v-for="(item, key) in menu"
Expand Down
6 changes: 3 additions & 3 deletions src/components/NcBreadcrumb/NcBreadcrumb.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ Renders a button element when given no redirection props, otherwise, renders <a/
@dragenter="dragEnter"
@dragleave="dragLeave">
<NcButton v-if="(name || icon || $slots.icon) && !$slots.default"
:title="title"
:aria-label="icon ? name : undefined"
type="tertiary"
:title="title"
variant="tertiary"
v-bind="linkAttributes"
v-on="$listeners">
<template v-if="$slots.icon || icon" #icon>
Expand All @@ -41,13 +41,13 @@ Renders a button element when given no redirection props, otherwise, renders <a/
</NcButton>
<NcActions v-if="$slots.default"
ref="actions"
type="tertiary"
:force-menu="forceMenu"
:open="open"
:menu-name="name"
:title="title"
:force-name="true"
:container="`.vue-crumb[${crumbId}]`"
variant="tertiary"
@update:open="onOpenChange">
<template #icon>
<!-- @slot Slot for the custom menu icon -->
Expand Down
6 changes: 3 additions & 3 deletions src/components/NcColorPicker/NcColorPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -181,22 +181,22 @@ export default {
</Transition>
<div v-if="!paletteOnly" class="color-picker__navigation">
<NcButton v-if="advanced"
type="tertiary"
:aria-label="ariaBack"
variant="tertiary"
@click="handleBack">
<template #icon>
<ArrowLeft :size="20" />
</template>
</NcButton>
<NcButton v-else
type="tertiary"
:aria-label="ariaMore"
variant="tertiary"
@click="handleMoreSettings">
<template #icon>
<DotsHorizontal :size="20" />
</template>
</NcButton>
<NcButton type="primary"
<NcButton variant="primary"
@click="handleConfirm(slotProps.hide)">
{{ t('Choose') }}
</NcButton>
Expand Down
6 changes: 3 additions & 3 deletions src/components/NcContent/NcContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ It also will set the skip content buttons needed for accessibility.
</div>
<div class="vue-skip-actions__buttons">
<NcButton v-show="hasAppNavigation"
type="tertiary"
href="#app-navigation-vue"
variant="tertiary"
@click.prevent="openAppNavigation"
@focusin="currentFocus = 'navigation'"
@mouseover="currentFocus = 'navigation'">
{{ t('Skip to app navigation') }}
</NcButton>
<NcButton type="tertiary"
href="#app-content-vue"
<NcButton href="#app-content-vue"
variant="tertiary"
@focusin="currentFocus = 'content'"
@mouseover="currentFocus = 'content'">
{{ t('Skip to main content') }}
Expand Down
2 changes: 1 addition & 1 deletion src/components/NcEmojiPicker/NcEmojiPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ This component allows the user to pick an emoji.
:palette="skinTonePalette"
:value="currentColor.color"
@update:value="onChangeSkinTone">
<NcButton :aria-label="t('Skin tone')" type="tertiary-no-background">
<NcButton :aria-label="t('Skin tone')" variant="tertiary-no-background">
<template #icon>
<IconCircle :style="{ color: currentColor.color }" :title="currentColor.name" :size="20" />
</template>
Expand Down
2 changes: 1 addition & 1 deletion src/components/NcEmptyContent/NcEmptyContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ consider only using header elements as the root elements for the name slot.
</h1>
</template>
<template #action>
<NcButton type="primary">
<NcButton variant="primary">
Add a comment!
</NcButton>
</template>
Expand Down
4 changes: 2 additions & 2 deletions src/components/NcHeaderButton/NcHeaderButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ export default {
<template>
<!-- We need a wrapper for server styles to apply -->
<div :id="id" class="header-menu">
<NcButton type="tertiary-no-background"
class="header-menu__trigger"
<NcButton class="header-menu__trigger"
:aria-label="ariaLabel"
:aria-describedby="descriptionId"
size="large"
variant="tertiary-no-background"
@click.prevent="$emit('click', $event)">
<template #icon>
<!-- @slot Icon trigger slot. Make sure the svg path
Expand Down
6 changes: 3 additions & 3 deletions src/components/NcHeaderMenu/NcHeaderMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ export default {
<!-- Trigger -->
<NcButton :id="isNav ? triggerId : null"
ref="trigger"
type="tertiary-no-background"
class="header-menu__trigger"
:aria-label="ariaLabel"
:aria-describedby="description ? descriptionId : null"
:aria-controls="`header-menu-${id}`"
:aria-describedby="description ? descriptionId : null"
:aria-expanded="opened.toString()"
:aria-label="ariaLabel"
size="large"
variant="tertiary-no-background"
@click.prevent="toggleMenu">
<template #icon>
<!-- @slot Icon trigger slot. Make sure the svg path
Expand Down
2 changes: 1 addition & 1 deletion src/components/NcInputField/NcInputField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ For a list of all available props and attributes, please check the [HTMLInputEle

<!-- trailing button -->
<NcButton v-if="showTrailingButton"
type="tertiary-no-background"
class="input-field__trailing-button"
:aria-label="trailingButtonLabel"
:disabled="disabled"
variant="tertiary-no-background"
@click="handleTrailingButtonClick">
<!-- Populating this slot creates a trailing button within the
input boundaries that emits a `trailing-button-click` event -->
Expand Down
6 changes: 3 additions & 3 deletions src/components/NcListItem/NcListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ The `actions-icon` slot can be used to pass icon to the inner NcActions componen
<NcAvatar disable-menu :size="44" user="janedoe" display-name="Jane Doe" />
</template>
<template #extra-actions>
<NcButton type="primary">
<NcButton variant="primary">
<template #icon>
<IconCog :size="20" />
</template>
Expand Down Expand Up @@ -312,12 +312,12 @@ The `actions-icon` slot can be used to pass icon to the inner NcActions componen
<NcAvatar disable-menu :size="44" user="janedoe" display-name="Jane Doe" />
</template>
<template #extra-actions>
<NcButton type="tertiary">
<NcButton variant="tertiary">
<template #icon>
<IconPencil :size="20" />
</template>
</NcButton>
<NcButton type="tertiary">
<NcButton variant="tertiary">
<template #icon>
<IconCog :size="20" />
</template>
Expand Down
16 changes: 8 additions & 8 deletions src/components/NcModal/NcModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export default {
<NcButton
:disabled="!firstName || !lastName || !pizza"
@click="closeModal"
type="primary">
variant="primary">
Submit
</NcButton>
</div>
Expand Down Expand Up @@ -255,7 +255,7 @@ export default {
<NcButton v-if="canClose && !closeButtonContained"
:aria-label="closeButtonAriaLabel"
class="header-close"
type="tertiary"
variant="tertiary"
@click="close">
<template #icon>
<Close :size="iconSize" />
Expand All @@ -277,9 +277,9 @@ export default {
<!-- Navigation button -->
<transition name="fade-visibility" appear>
<NcButton v-show="hasPrevious"
type="tertiary-no-background"
class="prev"
:aria-label="prevButtonAriaLabel"
class="prev"
variant="tertiary-no-background"
@click="previous">
<template #icon>
<ChevronLeft :size="40" />
Expand All @@ -295,9 +295,9 @@ export default {
</div>
<!-- Close modal -->
<NcButton v-if="canClose && closeButtonContained"
type="tertiary"
class="modal-container__close"
:aria-label="closeButtonAriaLabel"
class="modal-container__close"
variant="tertiary"
@click="close">
<template #icon>
<Close :size="20" />
Expand All @@ -308,9 +308,9 @@ export default {
<!-- Navigation button -->
<transition name="fade-visibility" appear>
<NcButton v-show="hasNext"
type="tertiary-no-background"
class="next"
:aria-label="nextButtonAriaLabel"
class="next"
variant="tertiary-no-background"
@click="next">
<template #icon>
<ChevronRight :size="40" />
Expand Down
Loading

0 comments on commit ab19ff3

Please sign in to comment.