Skip to content

Commit

Permalink
Fix search placeholder animation & dark theme compatibility
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
  • Loading branch information
skjnldsv committed Aug 7, 2020
1 parent 89ea1ab commit 7cb0022
Show file tree
Hide file tree
Showing 29 changed files with 170 additions and 196 deletions.
3 changes: 3 additions & 0 deletions apps/accessibility/css/dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ $color-main-background: #181818;
$color-background-dark: lighten($color-main-background, 4%);
$color-background-darker: lighten($color-main-background, 8%);

$color-placeholder-light: lighten($color-main-background, 10%);
$color-placeholder-dark: lighten($color-main-background, 20%);

$color-text-maxcontrast: darken($color-main-text, 30%);
$color-text-light: darken($color-main-text, 10%);
$color-text-lighter: darken($color-main-text, 20%);
Expand Down
3 changes: 3 additions & 0 deletions apps/accessibility/css/highcontrast.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ $color-main-background: #fff;
$color-background-dark: darken($color-main-background, 30%);
$color-background-darker: darken($color-main-background, 30%);

$color-placeholder-light: darken($color-main-background, 30%);
$color-placeholder-dark: darken($color-main-background, 45%);

$color-text-maxcontrast: $color-main-text;
$color-text-light: $color-main-text;
$color-text-lighter: $color-main-text;
Expand Down
3 changes: 3 additions & 0 deletions core/css/css-variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
--color-background-dark: $color-background-dark;
--color-background-darker: $color-background-darker;

--color-placeholder-light: $color-placeholder-light;
--color-placeholder-dark: $color-placeholder-dark;

--color-primary: $color-primary;
--color-primary-light: $color-primary-light;
--color-primary-text: $color-primary-text;
Expand Down
1 change: 1 addition & 0 deletions core/css/icons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ audio, canvas, embed, iframe, img, input, object, video {
@include icon-black-white('upload', 'actions', 1, true);
@include icon-black-white('user', 'actions', 1, true);
@include icon-black-white('group', 'actions', 1, true);
@include icon-black-white('filter', 'actions', 1, true);

@include icon-black-white('video', 'actions', 2, true);
.icon-video-white {
Expand Down
3 changes: 3 additions & 0 deletions core/css/variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ $color-background-hover: nc-darken($color-main-background, 4%) !default;
$color-background-dark: nc-darken($color-main-background, 7%) !default;
$color-background-darker: nc-darken($color-main-background, 14%) !default;

$color-placeholder-light: nc-darken($color-main-background, 10%) !default;
$color-placeholder-dark: nc-darken($color-main-background, 20%) !default;

$color-primary: #0082c9 !default;
$color-primary-light: mix($color-primary, $color-main-background, 10%) !default;
$color-primary-text: #ffffff !default;
Expand Down
1 change: 1 addition & 0 deletions core/img/actions/filter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion core/js/dist/files_client.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/files_client.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/files_fileinfo.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/files_fileinfo.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/files_iedavclient.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/files_iedavclient.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/install.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/install.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/login.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/login.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/main.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/maintenance.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/maintenance.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/recommendedapps.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/recommendedapps.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/unified-search.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/unified-search.js.map

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion core/src/components/HeaderMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
-
-->
<template>
<div v-click-outside="closeMenu" :class="{ 'header-menu--opened': opened }" class="header-menu">
<div v-click-outside="clickOutsideConfig" :class="{ 'header-menu--opened': opened }" class="header-menu">
<a class="header-menu__trigger"
href="#"
:aria-controls="`header-menu-${id}`"
Expand All @@ -44,6 +44,7 @@
<script>
import { directive as ClickOutside } from 'v-click-outside'
import { emit, subscribe, unsubscribe } from '@nextcloud/event-bus'
import excludeClickOutsideClasses from '@nextcloud/vue/dist/Mixins/excludeClickOutsideClasses'
export default {
name: 'HeaderMenu',
Expand All @@ -52,6 +53,10 @@ export default {
ClickOutside,
},
mixins: [
excludeClickOutsideClasses,
],
props: {
id: {
type: String,
Expand All @@ -66,6 +71,10 @@ export default {
data() {
return {
opened: this.open,
clickOutsideConfig: {
handler: this.closeMenu,
middleware: this.clickOutsideMiddleware,
},
}
},
Expand Down
77 changes: 0 additions & 77 deletions core/src/components/UnifiedSearch/SearchFilter.vue

This file was deleted.

68 changes: 0 additions & 68 deletions core/src/components/UnifiedSearch/SearchResultPlaceholder.vue

This file was deleted.

100 changes: 100 additions & 0 deletions core/src/components/UnifiedSearch/SearchResultPlaceholders.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<template>
<ul>
<!-- Placeholder animation -->
<svg class="unified-search__result-placeholder-gradient">
<defs>
<linearGradient id="unified-search__result-placeholder-gradient">
<stop offset="0%" :stop-color="light">
<animate attributeName="stop-color"
:values="`${light}; ${light}; ${dark}; ${dark}; ${light}`"
dur="2s"
repeatCount="indefinite" />
</stop>
<stop offset="100%" :stop-color="dark">
<animate attributeName="stop-color"
:values="`${dark}; ${light}; ${light}; ${dark}; ${dark}`"
dur="2s"
repeatCount="indefinite" />
</stop>
</linearGradient>
</defs>
</svg>

<!-- Placeholders -->
<li v-for="placeholder in [1, 2, 3]" :key="placeholder">
<svg
class="unified-search__result-placeholder"
xmlns="http://www.w3.org/2000/svg"
fill="url(#unified-search__result-placeholder-gradient)">
<rect class="unified-search__result-placeholder-icon" />
<rect class="unified-search__result-placeholder-line-one" />
<rect class="unified-search__result-placeholder-line-two" :style="{width: `calc(${randWidth()}%)`}" />
</svg>
</li>
</ul>
</template>

<script>
export default {
name: 'SearchResultPlaceholders',
data() {
return {
light: null,
dark: null,
}
},
mounted() {
const styles = getComputedStyle(document.documentElement)
this.dark = styles.getPropertyValue('--color-placeholder-dark')
this.light = styles.getPropertyValue('--color-placeholder-light')
},
methods: {
randWidth() {
return Math.floor(Math.random() * 20) + 30
},
},
}
</script>

<style lang="scss" scoped>
$clickable-area: 44px;
$margin: 10px;
.unified-search__result-placeholder-gradient {
position: fixed;
height: 0;
width: 0;
z-index: -1;
}
.unified-search__result-placeholder {
width: calc(100% - 2 * #{$margin});
height: $clickable-area;
margin: $margin;
&-icon {
width: $clickable-area;
height: $clickable-area;
rx: var(--border-radius);
ry: var(--border-radius);
}
&-line-one,
&-line-two {
width: calc(100% - #{$margin + $clickable-area});
height: 1em;
x: $margin + $clickable-area;
}
&-line-one {
y: 5px;
}
&-line-two {
y: 25px;
}
}
</style>
Loading

0 comments on commit 7cb0022

Please sign in to comment.