Skip to content

Commit

Permalink
extract sorting constants into own module
Browse files Browse the repository at this point in the history
  • Loading branch information
pixeldesu committed Feb 6, 2020
1 parent de6a199 commit 3aaaee0
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 26 deletions.
32 changes: 6 additions & 26 deletions src/components/FeedSortFilter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<v-select
dense
v-model="selectedProperty"
:items="ALLOWED_PROPERTIES"
:items="properties"
label="Sort by"
>
</v-select>
Expand All @@ -14,7 +14,7 @@
<v-select
dense
v-model="selectedOrder"
:items="ALLOWED_ORDERINGS"
:items="orderings"
label="Order"
>
</v-select>
Expand All @@ -23,34 +23,14 @@
</template>

<script>
import { ALLOWED_PROPERTIES, ALLOWED_ORDERINGS } from '../modules/sorting';
export default {
name: 'FeedSortFilter',
data: () => ({
ALLOWED_PROPERTIES: [
{
text: 'Publish Date',
value: 'published',
},
{
text: 'Views',
value: 'views',
},
{
text: 'Rating',
value: 'rating',
},
],
ALLOWED_ORDERINGS: [
{
text: 'Ascending',
value: 'asc',
},
{
text: 'Descending',
value: 'desc',
},
],
properties: ALLOWED_PROPERTIES,
orderings: ALLOWED_ORDERINGS,
}),
computed: {
Expand Down
25 changes: 25 additions & 0 deletions src/modules/sorting.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export const ALLOWED_PROPERTIES = [
{
text: 'Publish Date',
value: 'published',
},
{
text: 'Views',
value: 'views',
},
{
text: 'Rating',
value: 'rating',
},
];

export const ALLOWED_ORDERINGS = [
{
text: 'Ascending',
value: 'asc',
},
{
text: 'Descending',
value: 'desc',
},
];

0 comments on commit 3aaaee0

Please # to comment.