Refactoring: split files into components (not working, broken state)
[vchess.git] / public / javascripts / components / problemPreview.js
CommitLineData
81da2786
BA
1// Preview a problem on variant page
2Vue.component('my-problem-preview', {
3 props: ['prob'],
4 template: `
5 <div class="row problem">
6 <div class="col-sm-12 col-md-6 diagram"
7 v-html="getDiagram(prob.fen)">
8 </div>
9 <div class="col-sm-12 col-md-6">
10 <p v-html="prob.instructions"></p>
11 <p v-html="prob.solution"></p>
12 </div>
13 </div>
14 `,
15 methods: {
16 getDiagram: function(fen) {
17 const fenParsed = V.ParseFen(fen);
18 return getDiagram({
19 position: fenParsed.position,
20 turn: fenParsed.turn,
21 // No need for flags here
22 });
23 },
24 },
25})