Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2017-08-02 18:37:40 +0300
committerPhil Hughes <me@iamphill.com>2017-08-02 18:37:40 +0300
commite4c20cd3fe330faa415493ee2fe30dc16fbaca80 (patch)
tree0be61b6cc59cf35d81b9271c7603e0d8b203a31c /app/assets/javascripts/groups/components/group_identicon.vue
parent25d6a6c4b528159c288995de4909e6a8da431d0b (diff)
parent88958e5a9cd364ae36f3d2837982cedb9239c3bc (diff)
Merge branch 'master' into sidebar-fly-out-sub-nav
Diffstat (limited to 'app/assets/javascripts/groups/components/group_identicon.vue')
-rw-r--r--app/assets/javascripts/groups/components/group_identicon.vue45
1 files changed, 45 insertions, 0 deletions
diff --git a/app/assets/javascripts/groups/components/group_identicon.vue b/app/assets/javascripts/groups/components/group_identicon.vue
new file mode 100644
index 00000000000..0edd820743f
--- /dev/null
+++ b/app/assets/javascripts/groups/components/group_identicon.vue
@@ -0,0 +1,45 @@
+<script>
+export default {
+ props: {
+ entityId: {
+ type: Number,
+ required: true,
+ },
+ entityName: {
+ type: String,
+ required: true,
+ },
+ },
+ computed: {
+ /**
+ * This method is based on app/helpers/application_helper.rb#project_identicon
+ */
+ identiconStyles() {
+ const allowedColors = [
+ '#FFEBEE',
+ '#F3E5F5',
+ '#E8EAF6',
+ '#E3F2FD',
+ '#E0F2F1',
+ '#FBE9E7',
+ '#EEEEEE',
+ ];
+
+ const backgroundColor = allowedColors[this.entityId % 7];
+
+ return `background-color: ${backgroundColor}; color: #555;`;
+ },
+ identiconTitle() {
+ return this.entityName.charAt(0).toUpperCase();
+ },
+ },
+};
+</script>
+
+<template>
+ <div
+ class="avatar s40 identicon"
+ :style="identiconStyles">
+ {{identiconTitle}}
+ </div>
+</template>