Change category label appearance

This commit is contained in:
Toby Zerner 2015-05-07 06:39:05 +09:30
parent a38efe6e90
commit 4bf5f91c06
3 changed files with 8 additions and 4 deletions

View File

@ -1,6 +1,7 @@
import Component from 'flarum/component';
import DiscussionPage from 'flarum/components/discussion-page';
import icon from 'flarum/helpers/icon';
import categoryLabel from 'categories/helpers/category-label';
export default class MoveDiscussionModal extends Component {
constructor(props) {
@ -16,7 +17,7 @@ export default class MoveDiscussionModal extends Component {
m('div.modal-content', [
m('button.btn.btn-icon.btn-link.close.back-control', {onclick: app.modal.close.bind(app.modal)}, icon('times')),
m('div.modal-header', m('h3.title-control', discussion
? ['Move ', m('em', discussion.title()), ' from ', m('span.category', {style: 'color: '+discussion.category().color()}, discussion.category().title()), ' to...']
? ['Move ', m('em', discussion.title()), ' from ', categoryLabel(discussion.category()), ' to...']
: ['Start a Discussion In...'])),
m('div', [
m('ul.category-list', [

View File

@ -1,3 +1,3 @@
export default function categoryLabel(category) {
return m('span.category-label', {style: {color: category.color()}}, category.title());
return m('span.category-label', {style: {backgroundColor: category.color()}}, category.title());
}

View File

@ -1,11 +1,14 @@
.category-label {
text-transform: uppercase;
font-size: 80%;
font-weight: bold;
font-weight: 600;
display: inline-block;
color: #fff;
padding: 1px 5px;
border-radius: 4px;
.discussion-summary & {
margin-right: 10px;
margin-right: 5px;
font-size: 11px;
}