From 4a737cbe4507e0d0a042871725a310eb4307a766 Mon Sep 17 00:00:00 2001 From: taehoon Date: Wed, 13 Feb 2019 07:14:23 -0500 Subject: [PATCH] Add reusable BasicUserCard and UserList components --- .../basic_user_card/basic_user_card.js | 28 ++++++ .../basic_user_card/basic_user_card.vue | 94 +++++++++++++++++++ src/components/user_list/user_list.js | 10 ++ src/components/user_list/user_list.vue | 11 +++ 4 files changed, 143 insertions(+) create mode 100644 src/components/basic_user_card/basic_user_card.js create mode 100644 src/components/basic_user_card/basic_user_card.vue create mode 100644 src/components/user_list/user_list.js create mode 100644 src/components/user_list/user_list.vue diff --git a/src/components/basic_user_card/basic_user_card.js b/src/components/basic_user_card/basic_user_card.js new file mode 100644 index 00000000..a8441446 --- /dev/null +++ b/src/components/basic_user_card/basic_user_card.js @@ -0,0 +1,28 @@ +import UserCardContent from '../user_card_content/user_card_content.vue' +import UserAvatar from '../user_avatar/user_avatar.vue' +import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator' + +const BasicUserCard = { + props: [ + 'user' + ], + data () { + return { + userExpanded: false + } + }, + components: { + UserCardContent, + UserAvatar + }, + methods: { + toggleUserExpanded () { + this.userExpanded = !this.userExpanded + }, + userProfileLink (user) { + return generateProfileLink(user.id, user.screen_name, this.$store.state.instance.restrictedNicknames) + } + } +} + +export default BasicUserCard diff --git a/src/components/basic_user_card/basic_user_card.vue b/src/components/basic_user_card/basic_user_card.vue new file mode 100644 index 00000000..37f810ed --- /dev/null +++ b/src/components/basic_user_card/basic_user_card.vue @@ -0,0 +1,94 @@ + + + + + diff --git a/src/components/user_list/user_list.js b/src/components/user_list/user_list.js new file mode 100644 index 00000000..30e3d765 --- /dev/null +++ b/src/components/user_list/user_list.js @@ -0,0 +1,10 @@ +import BasicUserCard from '../basic_user_card/basic_user_card.vue' + +const UserList = { + props: ['entries'], + components: { + BasicUserCard + } +} + +export default UserList diff --git a/src/components/user_list/user_list.vue b/src/components/user_list/user_list.vue new file mode 100644 index 00000000..242c04fc --- /dev/null +++ b/src/components/user_list/user_list.vue @@ -0,0 +1,11 @@ + + + \ No newline at end of file