<div class="panel" style="border:1px solid #ccc; padding:1em; margin-bottom:1em;">
<button @click="remove" style="float:right">✕</button>
<tags-by-font v-if="panel.type === 'font'" :tags="tags" :font="panel.font"></tags-by-font>
- <tags-by-categories v-else-if="panel.type === 'categories'" :tags="tags" :categories="panel.categories"></tags-by-categories>
+ <tags-by-categories v-else-if="panel.type === 'categories'" :tags="tags" :categories="panel.categories" :tagGroups="panel.tagGroups"></tags-by-categories>
<vf-view v-else-if="panel.type === 'vf-view'" :families="panel.families"></vf-view>
</div>
`
export default {
- props: ['tags', 'categories'],
+ props: ['tags', 'categories', 'tagGroups'],
data() {
return {
selectedCategories: [...this.categories],
<div v-for="tag in filteredTags" :key="tag.family.name + tag.tagName + tag.score">
<tag-view :tag="tag"></tag-view>
</div>
+ <div v-for="group in tagGroups" :key="group.name">
+ <div v-for="tag in group.tags" :key="tag.tagName + tag.family.name + tag.score" style="background-color: lightgray;">
+ <tag-view :tag="tag"></tag-view>
+ </div>
+ </div>
</div>
`
};
</div>
</div>
<script type="module">
- import { GF, Tags, FontTag } from './models.js';
+ import { GF, Tags, FontTag, FontTagGroup } from './models.js';
import TagsByFont from "./TagsByFont.js";
import TagsByCategories from "./TagsByCategories.js";
import Panel from "./Panel.js";
data: {
gf: null,
tags: null,
+ tagGroups: [],
panels: [
{ type: 'font', font: 'Roboto' },
{ type: 'categories', categories: ['/Expressive/Loud', '/Expressive/Childlike'] }
this.panels.push({ type: 'font', font });
},
addCategoriesPanel(categories) {
- this.panels.push({ type: 'categories', categories });
+ this.panels.push({ type: 'categories', categories , tagGroups: this.tagGroups });
},
addVFViewPanel() {
this.panels.push({ type: 'vf-view', families: this.gf.families });
for (let category of filterSet.categories) {
const lowTag = new FontTag(category, family, [{tag: "wght", value: 100}], filterSet.lowTag.score);
const highTag = new FontTag(category, family, [{tag: "wght", value: 900}], filterSet.highTag.score);
- this.tags.items.push(lowTag);
- this.tags.items.push(highTag);
+ const fontTag = new FontTagGroup();
+ fontTag.addTag(lowTag);
+ fontTag.addTag(highTag);
+ this.tagGroups.push(fontTag);
}
}
}
// Subscribe to events
this.$root.$on("remove-tag", this.removeTag);
+ const family = this.gf.families.find(f => f.name === 'Maven Pro');
+ const tag1 = new FontTag('/Purpose/Easy Reading', family, [{tag: "wght", value: 400}], 10);
+ const tag2 = new FontTag('/Purpose/Easy Reading', family, [{tag: "wght", value: 900}], 100);
+ const tagGroup = new FontTagGroup();
+ tagGroup.addTag(tag1);
+ tagGroup.addTag(tag2);
+ this.tagGroups.push(tagGroup);
}
});
window.app = app