From 68d0d9571dd4404537a038e95691d186ae0e351b Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Mon, 10 Jun 2024 17:23:07 +0200 Subject: [PATCH 1/4] fix(NcButton): Use CSS variable instead of local SCSS variable for default clickable area Signed-off-by: Ferdinand Thiessen --- src/components/NcButton/NcButton.vue | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/components/NcButton/NcButton.vue b/src/components/NcButton/NcButton.vue index d14eb71d63..6d7638f11d 100644 --- a/src/components/NcButton/NcButton.vue +++ b/src/components/NcButton/NcButton.vue @@ -718,8 +718,8 @@ export default defineComponent({ padding: 0; font-size: var(--default-font-size); font-weight: bold; - min-height: $clickable-area; - min-width: $clickable-area; + min-height: var(--default-clickable-area); + min-width: var(--default-clickable-area); display: flex; align-items: center; justify-content: center; @@ -730,7 +730,7 @@ export default defineComponent({ span { cursor: pointer; } - border-radius: var(--border-radius-element, math.div($clickable-area, 2)); + border-radius: var(--border-radius-element, calc(var(--default-clickable-area) / 2)); transition-property: color, border-color, background-color; transition-duration: 0.1s; transition-timing-function: linear; @@ -785,10 +785,10 @@ export default defineComponent({ } &__icon { - height: $clickable-area; - width: $clickable-area; - min-height: $clickable-area; - min-width: $clickable-area; + height: var(--default-clickable-area); + width: var(--default-clickable-area); + min-height: var(--default-clickable-area); + min-width: var(--default-clickable-area); display: flex; justify-content: center; align-items: center; @@ -805,7 +805,8 @@ export default defineComponent({ // Icon-only button &--icon-only { - width: $clickable-area !important; + line-height: 1; + width: var(--default-clickable-area) !important; } // Text-only button From 9214cc7bf585aecb64a80f1d34b0643d2c848567 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Tue, 11 Jun 2024 16:51:31 +0200 Subject: [PATCH 2/4] fix(NcIconSvgWrapper): Replace hard coded values with CSS variables Signed-off-by: Ferdinand Thiessen --- src/components/NcIconSvgWrapper/NcIconSvgWrapper.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/NcIconSvgWrapper/NcIconSvgWrapper.vue b/src/components/NcIconSvgWrapper/NcIconSvgWrapper.vue index a02ffc0580..485ed573b5 100644 --- a/src/components/NcIconSvgWrapper/NcIconSvgWrapper.vue +++ b/src/components/NcIconSvgWrapper/NcIconSvgWrapper.vue @@ -220,8 +220,8 @@ export default { display: flex; justify-content: center; align-items: center; - min-width: 44px; - min-height: 44px; + min-width: var(--default-clickable-area); + min-height: var(--default-clickable-area); opacity: 1; &--inline { From beabceed0189613dc789767133d167c06b5c18ab Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Mon, 10 Jun 2024 17:23:41 +0200 Subject: [PATCH 3/4] fix(styleguide): Add mock for global `_oc_webroot` variable to fix `@nextcloud/router` in styleguide Signed-off-by: Ferdinand Thiessen --- styleguide/global.requires.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/styleguide/global.requires.js b/styleguide/global.requires.js index ec7fd222ae..c6cecc54a5 100644 --- a/styleguide/global.requires.js +++ b/styleguide/global.requires.js @@ -68,6 +68,9 @@ function chunkify(t) { return tz } +// Global variables +window._oc_webroot = '' + window.OC = { debug: true, getCurrentUser() { From 83c42be8127e6012fc250dcc8efd01468aafc94e Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Mon, 10 Jun 2024 17:24:53 +0200 Subject: [PATCH 4/4] feat(NcChip): Add NcChip component for a chip-linke element Signed-off-by: Ferdinand Thiessen --- src/components/NcChip/NcChip.vue | 270 +++++++++++++++++++++++++++++++ src/components/NcChip/index.ts | 5 + src/components/index.ts | 1 + 3 files changed, 276 insertions(+) create mode 100644 src/components/NcChip/NcChip.vue create mode 100644 src/components/NcChip/index.ts diff --git a/src/components/NcChip/NcChip.vue b/src/components/NcChip/NcChip.vue new file mode 100644 index 0000000000..40f3c7ce46 --- /dev/null +++ b/src/components/NcChip/NcChip.vue @@ -0,0 +1,270 @@ + + +### Basic usage + +```vue + + +``` + +### Advanced usage + +It is also possible to use custom components for the icon by using the `icon` slot. +In this example we are using the `NcAvatar` component to render the users avatar as the icon. + +*Hint: If you use round icons like avatars you should set their size to `24px` (or use CSS variable `--chip-size`) to make then fully fill and align with the the chip* + +Also it is possible to pass custom actions. + +```vue + + +``` + + + + + + + diff --git a/src/components/NcChip/index.ts b/src/components/NcChip/index.ts new file mode 100644 index 0000000000..5e1fadf1bb --- /dev/null +++ b/src/components/NcChip/index.ts @@ -0,0 +1,5 @@ +/** + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +export { default } from './NcChip.vue' diff --git a/src/components/index.ts b/src/components/index.ts index 1e3cad8011..195fb490ca 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -53,6 +53,7 @@ export { default as NcBreadcrumb } from './NcBreadcrumb/index.js' export { default as NcBreadcrumbs } from './NcBreadcrumbs/index.js' export { default as NcButton } from './NcButton/index' export { default as NcCheckboxRadioSwitch } from './NcCheckboxRadioSwitch/index.js' +export { default as NcChip } from './NcChip/index' export { default as NcColorPicker } from './NcColorPicker/index.js' export { default as NcContent } from './NcContent/index.js' export { default as NcCounterBubble } from './NcCounterBubble/index.js'