Skip to content

Commit

Permalink
SearchBar: transitions finetuning
Browse files Browse the repository at this point in the history
- now transitioning from and to the real min-width instead of 0, which was adding a delay in the visual transition.
- finetuned transition timings
  • Loading branch information
mraveux authored and sisou committed May 27, 2024
1 parent 9ace9ee commit 9a08d1f
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/components/SearchBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default defineComponent({
const maxWidth = computed(() => {
if (!searchBarInput.value) return '100%';
return isInputActive.value ? '100%' : '0';
return isInputActive.value ? '100%' : 'var(--default-sb-width)';
});
const handleFocus = () => {
Expand Down Expand Up @@ -135,6 +135,7 @@ export default defineComponent({
.search-bar {
$borderTickness: .1875rem; // 1.5px
--default-sb-width: clamp(5.5rem, 100%, 30rem);
position: relative;
display: flex;
Expand All @@ -143,9 +144,13 @@ export default defineComponent({
width: 100%;
cursor: text;
padding: 0.75rem 0;
min-width: clamp(5.5rem, 100%, 30rem);
min-width: var(--default-sb-width);
transition: color var(--attr-duration) var(--nimiq-ease), max-width var(--attr-duration) var(--nimiq-ease);
transition: {
property: color, max-width;
duration: var(--attr-duration);
timing-function: var(--nimiq-ease);
}
&::after {
content: '';
Expand Down Expand Up @@ -238,12 +243,12 @@ input {
}
.fade-enter-active {
transition-duration: var(--attr-duration);
transition-delay: var(--attr-duration);
transition-duration: calc(var(--attr-duration) / 2);
transition-delay: calc(var(--attr-duration) * 0.6);
}
.fade-leave-active {
transition: none;
transition-duration: calc(var(--attr-duration) / 2);
}
@media (min-width: 700px) and (max-width: 900px) {
Expand Down

0 comments on commit 9a08d1f

Please sign in to comment.