diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 73fb2371..b1e5f84d 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -50,10 +50,17 @@ const PostStatusForm = { candidates () { if (this.textAtCaret.charAt(0) === '@') { const matchedUsers = filter(this.users, (user) => (user.name + user.screen_name).match(this.textAtCaret.slice(1))) + if (matchedUsers.length <= 0) { + return false + } // eslint-disable-next-line camelcase - return map(take(matchedUsers, 5), ({screen_name, name}) => screen_name) + return map(take(matchedUsers, 5), ({screen_name, name, profile_image_url_original}) => ({ + screen_name: screen_name, + name: name, + img: profile_image_url_original + })) } else { - return ['nothing'] + return false } }, textAtCaret () { diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index 4f6d4565..a94fe2cb 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -4,12 +4,16 @@
-
-

Word

-

{{textAtCaret}}

-

Candidates

- -

{{candidate}}

+
+
+
+ + + @{{candidate.screen_name}} + {{candidate.name}} + +
+
@@ -115,6 +119,36 @@ .icon-cancel { cursor: pointer; } + + .autocomplete-panel { + margin: 0 0.5em 0 0.5em; + padding: 0.25em 0.45em 0 0.45em; + border-radius: 5px; + position: absolute; + z-index: 1; + box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.5); + min-width: 75%; + } + + .autocomplete { + cursor: pointer; + padding: 0.2em 0 0.2em 0; + margin: 0.1em 0 0.1em 0; + border-bottom: 1px solid rgba(0, 0, 0, 0.4); + display: flex; + img { + width: 22px; + height: 22px; + border-radius: 2px; + } + span { + line-height: 20px; + margin: 0 0.1em 0 0.2em; + } + small { + font-style: italic; + } + } }