Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not mess with @nextcloud/vue styles and fix navigation header a11y #2290

Merged
merged 3 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions js/photos-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-main.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/photos-public.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-public.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/photos-sidebar.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-sidebar.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/photos-src_views_AlbumContent_vue.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-src_views_AlbumContent_vue.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/photos-src_views_Albums_vue.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-src_views_Albums_vue.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/photos-src_views_Folders_vue.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-src_views_Folders_vue.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

44 changes: 13 additions & 31 deletions src/components/HeaderNavigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -179,45 +179,32 @@ export default {
}
</script>

<style lang="scss">
:root {
--photos-navigation-height: 64px;
// header height - button size
--photos-navigation-spacing: calc((var(--photos-navigation-height) - 44px) / 2);
}

// Properly position the navigation toggle button
button.app-navigation-toggle {
// App-navigation have a 4px margin top
top: 0 !important;
right: calc(var(--photos-navigation-height) * -1) !important;
margin: var(--photos-navigation-spacing) !important;
}

</style>

<style lang="scss" scoped>
.photos-navigation {
position: sticky;
z-index: 20;
top: 0;
display: flex;
// We need to wrap on small devices for accessibility
flex-wrap: wrap;
gap: calc(2 * var(--app-navigation-padding));
align-items: center;
justify-content: start;
width: 100%;
min-height: var(--photos-navigation-height);
padding: 15px var(--photos-navigation-height) 0 var(--photos-navigation-height);
// Ensure to not overlap with app navigation toggle
padding-inline: calc(var(--default-clickable-area) + 2 * var(--app-navigation-padding)) var(--app-navigation-padding);
// Align with app navigation toggle
padding-block: var(--app-navigation-padding);
background: var(--color-main-background);

&__back {
// Above the navigation menu
position: absolute !important;
left: 0;
margin: var(--photos-navigation-spacing) !important;
// Replaces the app navigation button
position: fixed !important;
left: var(--app-navigation-padding);
}

&__title {
max-width: 45%;
margin-right: calc(2 * var(--photos-navigation-spacing));
display: flex;
flex-direction: column;

Expand All @@ -226,7 +213,6 @@ button.app-navigation-toggle {
font-weight: 700;
font-size: 20px;
line-height: 44px;
margin: 0 0 0 calc(2 * var(--app-navigation-padding, 8px) + 44px);
}

&__main, &__sub {
Expand All @@ -236,19 +222,15 @@ button.app-navigation-toggle {
}
}

&__content {
max-width: 50%;
}

&__loader {
margin-left: 32px;
margin-inline-start: 32px;
}

&__content-right {
display: flex;
align-items: center;
justify-content: center;
margin-left: auto;
margin-inline-start: auto;
}
}

Expand Down
21 changes: 16 additions & 5 deletions src/views/Albums.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@
:title="t('photos', 'Albums')"
:root-title="t('photos', 'Albums')"
@refresh="fetchAlbums">
<NcButton :aria-label="t('photos', 'Create a new album.')"
<NcButton :aria-label="isMobile ? t('photos', 'New album') : undefined"
@click="showAlbumCreationForm = true">
<template #icon>
<Plus />
<Plus :size="20" />
</template>
<template v-if="!isMobile" #default>
{{ t('photos', 'New album') }}
</template>
{{ t('photos', 'New album') }}
</NcButton>
</HeaderNavigation>

Expand All @@ -61,7 +63,9 @@

<NcModal v-if="showAlbumCreationForm"
@close="showAlbumCreationForm = false">
<h2 class="album-creation__heading">{{ t('photos', 'New album') }}</h2>
<h2 class="album-creation__heading">
{{ t('photos', 'New album') }}
</h2>
<AlbumForm @done="handleAlbumCreated" />
</NcModal>
</div>
Expand All @@ -72,7 +76,7 @@ import Plus from 'vue-material-design-icons/Plus.vue'
import FolderMultipleImage from 'vue-material-design-icons/FolderMultipleImage.vue'

import { generateUrl } from '@nextcloud/router'
import { NcModal, NcButton, NcEmptyContent } from '@nextcloud/vue'
import { NcModal, NcButton, NcEmptyContent, useIsSmallMobile } from '@nextcloud/vue'
import { translate, translatePlural } from '@nextcloud/l10n'
import { getCurrentUser } from '@nextcloud/auth'

Expand Down Expand Up @@ -113,6 +117,13 @@ export default {
FetchCollectionsMixin,
],

setup() {
const isMobile = useIsSmallMobile()
return {
isMobile,
}
},

data() {
return {
showAlbumCreationForm: false,
Expand Down
Loading