story-content: Changed tag form style and defaults.

This commit is contained in:
2018-09-23 10:44:24 +02:00
parent 2e8737505e
commit df1295e7a6
3 changed files with 10 additions and 5 deletions
@@ -19,6 +19,11 @@ module.exports = class {
} }
addTag(tag) { addTag(tag) {
if (tag.kind == "" || tag.name.length < 1) {
this.state.error = "You cannot add an empty tag"
return
}
this.state.error = null this.state.error = null
storyApi.addTag({id: this.input.story.id, tag}).then(({tags}) => { storyApi.addTag({id: this.input.story.id, tag}).then(({tags}) => {
@@ -5,7 +5,7 @@ module.exports = class {
this.state = { this.state = {
values: { values: {
name: "", name: "",
kind: "Event", kind: "Character",
}, },
tags: [], tags: [],
suggestions: [], suggestions: [],
@@ -27,7 +27,7 @@ module.exports = class {
this.state.suggestions = [] this.state.suggestions = []
const suggestions = this.state.tags.filter(t => t.name.toLowerCase().includes(search)) const suggestions = this.state.tags.filter(t => t.name.toLowerCase().includes(search))
if (suggestions.length > 0 && suggestions.length < 10) { if (suggestions.length > 0 && suggestions.length < 20) {
if (suggestions.length > 1 || suggestions[0].name !== name) { if (suggestions.length > 1 || suggestions[0].name !== name) {
this.state.suggestions = suggestions this.state.suggestions = suggestions
} }
@@ -16,11 +16,11 @@ div.tag-options {
} }
div.suggestion-list { div.suggestion-list {
margin-top: 1em; margin: 2em 0;
a.tag { a.tag {
display: inline-block; display: inline-block;
margin: 0.5em 0.5ch; margin: 0.25em 0.5ch;
padding: 0.0625em 0.5ch; padding: 0.0625em 0.5ch;
outline: 1px solid; outline: 1px solid;
@@ -34,7 +34,7 @@ div.tag-options {
} }
div.header { div.header {
display: inline-block; display: block;
margin: 0.5em 0.5ch; margin: 0.5em 0.5ch;
padding: 0.0625em 0.5ch; padding: 0.0625em 0.5ch;