Font Awesome 5 support, slug class

This commit is contained in:
Kris 2019-01-11 13:19:51 -05:00
parent 3a49327865
commit 82812ff1dd
2 changed files with 65 additions and 62 deletions

View File

@ -1,4 +1,4 @@
.category-title-header { div[class^="category-title-header"] {
padding-top: 60px; padding-top: 60px;
display: flex; display: flex;
text-align: center; text-align: center;
@ -7,9 +7,10 @@
.category-title-contents { .category-title-contents {
max-width: 500px; max-width: 500px;
padding: 40px 40px 30px; padding: 40px 40px 30px;
i { svg {
height: 1.5em;
width: 1.1em;
margin-right: .25em; margin-right: .25em;
font-size: 1.5em;
} }
h1 { h1 {
text-transform: capitalize; text-transform: capitalize;

View File

@ -1,6 +1,8 @@
<script type="text/discourse-plugin" version="0.8"> <script type="text/discourse-plugin" version="0.8">
const container = Discourse.__container__; const container = Discourse.__container__;
const { h } = require('virtual-dom'); const { h } = require('virtual-dom');
const { iconNode } = require("discourse-common/lib/icon-library");
let lockIcon = iconNode('lock');
api.createWidget('category-header-widget', { api.createWidget('category-header-widget', {
tagName: 'span', tagName: 'span',
@ -31,11 +33,11 @@
function ifProtected() { function ifProtected() {
if(category.read_restricted) { if(category.read_restricted) {
return h('i.fa.fa-lock'); return lockIcon;
} }
} }
return h('div.category-title-header', { return h('div.category-title-header' + " ." + category.slug, {
"attributes" : { "attributes" : {
"style" : "background-color: #" + category.color + "; color: #" + category.text_color + ";" "style" : "background-color: #" + category.color + "; color: #" + category.text_color + ";"
} }