Skip to content

Commit

Permalink
refactor(NcEmojiPicker): simplify clear button
Browse files Browse the repository at this point in the history
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
  • Loading branch information
ShGKme committed Jan 30, 2025
1 parent 16c596f commit 8ad1006
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions src/components/NcEmojiPicker/NcEmojiPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ This component allows the user to pick an emoji.
v-bind="$attrs"
@keydown.native.tab.prevent="handleTabNavigationSkippingEmojis"
@select="select">
<template #searchTemplate="slotProps">
<template #searchTemplate="{ onSearch }">
<div class="search__wrapper">
<NcTextField ref="search"
class="search"
Expand All @@ -155,8 +155,8 @@ This component allows the user to pick an emoji.
@keydown.down="callPickerArrowHandlerWithScrollFix('onArrowDown', $event)"
@keydown.up="callPickerArrowHandlerWithScrollFix('onArrowUp', $event)"
@keydown.enter="$refs.picker.onEnter"
@trailing-button-click="clearSearch(); slotProps.onSearch(search);"
@update:value="slotProps.onSearch(search)" />
@trailing-button-click="clearSearch(); onSearch('');"
@update:value="onSearch(search)" />
<NcColorPicker palette-only
:container="container"
:palette="skinTonePalette"
Expand Down Expand Up @@ -359,10 +359,7 @@ export default {

clearSearch() {
this.search = ''
const input = this.$refs.search?.$refs.inputField?.$refs.input
if (input) {
input.focus()
}
this.$refs.search.focus()
},

/**
Expand Down Expand Up @@ -575,15 +572,13 @@ export default {
</style>

<style scoped lang="scss">
.search {
&__wrapper {
display: flex;
flex-direction: row;
gap: var(--default-grid-baseline);
align-items: end;
padding-block: var(--default-grid-baseline);
padding-inline: calc(2 * var(--default-grid-baseline));
}
.search__wrapper {
display: flex;
flex-direction: row;
gap: var(--default-grid-baseline);
align-items: end;
padding-block: var(--default-grid-baseline);
padding-inline: calc(2 * var(--default-grid-baseline));
}

.row-selected {
Expand Down

0 comments on commit 8ad1006

Please sign in to comment.