|
24 | 24 | <div v-if="!is_loading && !questions.length" class="text-gray-500 py-2">
|
25 | 25 | No questions found for your query "{{this.query}}".
|
26 | 26 | </div>
|
27 |
| - <article v-if="!is_loading && questions.length" v-for="question of questions" class="mb-2 p-2 border-l-4 border-gray-400 hover:border-orange-500 rounded bg-gray-100"> |
| 27 | + <article v-if="!is_loading && questions.length" v-for="question of questions" class="mb-2 p-2 border-l-8 border-gray-400 hover:border-orange-500 rounded bg-gray-100"> |
28 | 28 | <div class="flex">
|
29 | 29 | <div class="flex-grow">
|
30 |
| - <a :href="question.link" target="_blank" class="block font-medium hover:text-orange-500" v-html="question.title"></a> |
| 30 | + <a :href="question.link" target="_blank" class="block hover:text-orange-500"> |
| 31 | + <h3 v-html="question.title" class="font-bold"></h3> |
| 32 | + </a> |
| 33 | + |
31 | 34 | <div class="text-gray-400">
|
32 |
| - last activity at |
33 |
| - <time :datetime="question.last_activity_date|moment('YYYY-MM-DD HH:mm:ss')" class="text-gray-500"> |
34 |
| - {{question.last_activity_date|moment('YYYY-MM-DD')}} |
35 |
| - </time> |
36 |
| - and created by |
37 |
| - <a :href="question.owner.link" target="_blank" class="text-gray-500 hover:text-orange-500"> |
| 35 | + asked by |
| 36 | + <a :href="question.owner.link" target="_blank" class="font-semibold text-blue-400 hover:text-blue-500"> |
38 | 37 | {{question.owner.display_name}}
|
39 | 38 | </a>
|
40 | 39 | at
|
41 |
| - <time :datetime="question.creation_date|moment('YYYY-MM-DD HH:mm:ss')" class="text-gray-500"> |
| 40 | + <time :datetime="question.creation_date|moment('YYYY-MM-DD HH:mm:ss')" class="font-medium text-gray-500"> |
42 | 41 | {{question.creation_date|moment('YYYY-MM-DD')}}
|
43 | 42 | </time>
|
44 | 43 | </div>
|
|
47 | 46 | <span v-for="tag of question.tags" class="mr-1 px-1 py-px bg-gray-200 text-gray-500 rounded">{{tag}}</span>
|
48 | 47 | </div>
|
49 | 48 | </div>
|
50 |
| - <div class="px-2 pt-2 text-center"> |
51 |
| - <span class="block text-lg text-gray-500">{{question.score}}</span> |
52 |
| - <span class="text-gray-400">score</span> |
| 49 | + <div class="ml-2"> |
| 50 | + <div |
| 51 | + class="p-2 text-center border border-transparent" |
| 52 | + v-bind:class="{ |
| 53 | + 'text-gray-400': question.score == 0, |
| 54 | + 'text-red-400': question.score < 0, |
| 55 | + 'text-gray-500': question.score > 0, |
| 56 | + }" |
| 57 | + > |
| 58 | + <span class="block text-lg">{{question.score}}</span> |
| 59 | + <span>votes</span> |
| 60 | + </div> |
53 | 61 | </div>
|
54 |
| - <div class="px-2 pt-2 text-center"> |
55 |
| - <span class="block text-lg text-gray-500">{{question.answer_count}}</span> |
56 |
| - <span class="text-gray-400">answers</span> |
| 62 | + <div class="ml-2"> |
| 63 | + <div |
| 64 | + class="p-2 text-center border border-green-400 rounded" |
| 65 | + v-bind:class="{ |
| 66 | + 'text-green-400': !question.is_answered, |
| 67 | + 'text-white bg-green-400': question.is_answered, |
| 68 | + }" |
| 69 | + > |
| 70 | + <span class="block text-lg">{{question.answer_count}}</span> |
| 71 | + <span>answers</span> |
| 72 | + </div> |
57 | 73 | </div>
|
58 | 74 | </div>
|
59 | 75 | </article>
|
|
126 | 142 |
|
127 | 143 | this.is_loading = true;
|
128 | 144 | axios
|
129 |
| - .get('https://api.stackexchange.com/2.2/search/advanced?&pagesize=10&order=desc&sort=relevance&site=stackoverflow&accepted=True&page='+this.page+'&q='+encodeURIComponent(this.query)) |
| 145 | + .get('https://api.stackexchange.com/2.2/search/advanced?&pagesize=10&order=desc&sort=relevance&site=stackoverflow&answers=1&page='+this.page+'&q='+encodeURIComponent(this.query)) |
130 | 146 | .then(response => {
|
131 | 147 | this.questions = response.data.items;
|
132 | 148 | this.is_loading = false;
|
|
0 commit comments