Commit | Line | Data |
---|---|---|
5b020e73 | 1 | <template lang="pug"> |
7aa548e7 BA |
2 | main |
3 | .row | |
4 | .nopadding.col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2 | |
602d6bef | 5 | label(for="prefixFilter") {{ st.tr["Type first letters..."] }} |
7aa548e7 BA |
6 | input#prefixFilter(v-model="curPrefix") |
7 | .variant.col-sm-12.col-md-5.col-lg-4( | |
8 | v-for="(v,idx) in filteredVariants" | |
9 | :class="{'col-md-offset-1': idx%2==0, 'col-lg-offset-2': idx%2==0}" | |
10 | ) | |
11 | router-link(:to="getLink(v.name)") | |
12 | h4.boxtitle.text-center {{ v.name }} | |
13 | p.description.text-center {{ st.tr[v.desc] }} | |
5b020e73 BA |
14 | </template> |
15 | ||
16 | <script> | |
17 | import { store } from "@/store"; | |
18 | export default { | |
cf2343ce | 19 | name: "my-variants", |
5b020e73 BA |
20 | data: function() { |
21 | return { | |
85e5b5c1 | 22 | curPrefix: "", |
5b020e73 BA |
23 | st: store.state, |
24 | }; | |
85e5b5c1 BA |
25 | }, |
26 | computed: { | |
27 | filteredVariants: function () { | |
28 | const capitalizedPrefix = this.curPrefix.replace(/^\w/, c => c.toUpperCase()); | |
29 | const variants = this.st.variants | |
30 | .filter( v => { | |
31 | return v.name.startsWith(capitalizedPrefix); | |
32 | }) | |
33 | .map( v => { | |
34 | return { | |
35 | name: v.name, | |
36 | desc: v.description, | |
37 | }; | |
38 | }) | |
5b020e73 | 39 | .sort((a,b) => { |
85e5b5c1 BA |
40 | return a.name.localeCompare(b.name); |
41 | }); | |
5b020e73 | 42 | return variants; |
85e5b5c1 BA |
43 | }, |
44 | }, | |
5b020e73 BA |
45 | methods: { |
46 | getLink: function(vname) { | |
47 | return "/variants/" + vname; | |
48 | }, | |
49 | }, | |
50 | }; | |
51 | </script> | |
52 | ||
41c80bb6 | 53 | <style lang="sass" scoped> |
fb54f098 BA |
54 | // TODO: box-shadow or box-sizing ? https://stackoverflow.com/a/13517809 |
55 | .variant | |
56 | box-sizing: border-box | |
57 | border: 1px solid brown | |
58 | background-color: lightyellow | |
59 | &:hover | |
60 | background-color: yellow | |
61 | a | |
62 | color: #663300 | |
63 | text-decoration: none | |
64 | .boxtitle | |
65 | font-weight: bold | |
66 | margin-bottom: 0 | |
67 | .description | |
68 | @media screen and (max-width: 767px) | |
69 | margin-top: 0 | |
5b020e73 | 70 | </style> |