diff --git a/src/components/NcHeaderButton/NcHeaderButton.vue b/src/components/NcHeaderButton/NcHeaderButton.vue new file mode 100644 index 0000000000..8f01bdd6e3 --- /dev/null +++ b/src/components/NcHeaderButton/NcHeaderButton.vue @@ -0,0 +1,139 @@ + + + +This component is made to be used in the Nextcloud top header, +similar to the NcHeaderMenu but to be used when only a trigger button is needed, e.g. when opening a dialog. + +``` + + + +``` + + + + + + + diff --git a/src/components/NcHeaderButton/index.js b/src/components/NcHeaderButton/index.js new file mode 100644 index 0000000000..ecd72c1be4 --- /dev/null +++ b/src/components/NcHeaderButton/index.js @@ -0,0 +1,6 @@ +/** + * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +export { default } from './NcHeaderButton.vue' diff --git a/src/components/NcHeaderMenu/NcHeaderMenu.vue b/src/components/NcHeaderMenu/NcHeaderMenu.vue index 03476ff94d..5fe8081ec1 100644 --- a/src/components/NcHeaderMenu/NcHeaderMenu.vue +++ b/src/components/NcHeaderMenu/NcHeaderMenu.vue @@ -15,10 +15,13 @@ This component is made to be used in the Nextcloud top header.
- + + :description="query ? `No results for '${query}'` : 'Start typing to search'"> @@ -34,6 +37,11 @@ export default { components: { Magnify, }, + data() { + return { + query: '', + } + }, } diff --git a/src/components/NcHeaderMenu/header-menu__trigger.scss b/src/components/NcHeaderMenu/header-menu__trigger.scss new file mode 100644 index 0000000000..7ebd3c0356 --- /dev/null +++ b/src/components/NcHeaderMenu/header-menu__trigger.scss @@ -0,0 +1,42 @@ +/*! + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +.header-menu { + position: relative; + width: var(--header-height); + height: var(--header-height); + + #{&}__trigger { + --button-size: var(--header-height) !important; + height: var(--header-height); + opacity: .85; + + // header is filled with primary or image background + filter: none !important; + color: var(--color-background-plain-text, var(--color-primary-text)) !important; + + &:focus-visible { + outline: none !important; + box-shadow: none !important; + } + } + + &--opened &__trigger, + &__trigger:hover, + &__trigger:focus, + &__trigger:active { + opacity: 1; + } +} + +@media only screen and (max-width: $breakpoint-small-mobile) { + .header-menu { + width: var(--default-clickable-area); + + #{&}__trigger { + --button-size: var(--default-clickable-area) !important; + } + } +} \ No newline at end of file diff --git a/src/components/index.js b/src/components/index.js index 1c9d8f35b0..bdc4d5fcf0 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -52,6 +52,7 @@ export { default as NcEllipsisedOption } from './NcEllipsisedOption/index.js' export { default as NcEmojiPicker } from './NcEmojiPicker/index.js' export { default as NcEmptyContent } from './NcEmptyContent/index.js' export { default as NcGuestContent } from './NcGuestContent/index.js' +export { default as NcHeaderButton } from './NcHeaderButton/index.js' export { default as NcHeaderMenu } from './NcHeaderMenu/index.js' export { default as NcHighlight } from './NcHighlight/index.js' export { default as NcIconSvgWrapper } from './NcIconSvgWrapper/index.js' diff --git a/styleguide.config.js b/styleguide.config.js index 4508e2a57d..fe86b0dd94 100644 --- a/styleguide.config.js +++ b/styleguide.config.js @@ -173,6 +173,7 @@ module.exports = async () => { 'src/components/NcContent/*.vue', 'src/components/NcDashboard*/*.vue', 'src/components/NcDialog*/*.vue', + 'src/components/NcHeader*/*.vue', 'src/components/NcListItem*/*.vue', 'src/components/NcMultiselect*/*.vue', 'src/components/NcRichContenteditable/!(NcRichContenteditable).vue', @@ -253,6 +254,12 @@ module.exports = async () => { 'src/components/NcTextArea/*.vue', ], }, + { + name: 'NcHeader', + components: [ + 'src/components/NcHeader*/*.vue', + ], + }, { name: 'NcListItems', components: [