0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-03 23:32:58 +00:00

Refactoring switching logic, formatting LESS

This commit is contained in:
Trevor Buckner
2021-08-15 00:45:01 -04:00
parent 88c485ffe5
commit edce4e5bbc
3 changed files with 41 additions and 45 deletions

View File

@@ -40,19 +40,9 @@ const Snippetbar = createClass({
let snippets = []; let snippets = [];
if(this.props.renderer === 'V3') if(this.props.renderer === 'V3')
if(this.props.view === 'text') { snippets = SnippetsV3.filter((snippetGroup)=>snippetGroup.view === this.props.view);
snippets = SnippetsV3.filter((SnippetsV3)=>SnippetsV3.view === 'text');
} else if(this.props.view === 'style') {
snippets = SnippetsV3.filter((SnippetsV3)=>SnippetsV3.view === 'style');
} else
snippets = null;
else else
if(this.props.view === 'text') { snippets = SnippetsLegacy.filter((snippetGroup)=>snippetGroup.view === this.props.view);
snippets = SnippetsLegacy.filter((SnippetsLegacy)=>SnippetsLegacy.view === 'text');
} else if(this.props.view === 'style') {
snippets = SnippetsLegacy.filter((SnippetsLegacy)=>SnippetsLegacy.view === 'style');
} else
snippets = null;
return _.map(snippets, (snippetGroup)=>{ return _.map(snippets, (snippetGroup)=>{
return <SnippetGroup return <SnippetGroup

View File

@@ -291,7 +291,7 @@ module.exports = [
/**************** PAGE *************/ /**************** PAGE *************/
{ {
groupName : 'Page', groupName : 'Print',
icon : 'fas fa-print', icon : 'fas fa-print',
view : 'style', view : 'style',
snippets : [ snippets : [
@@ -299,8 +299,8 @@ module.exports = [
name : 'A4 Page Size', name : 'A4 Page Size',
icon : 'far fa-file', icon : 'far fa-file',
gen : ['/* A4 Page Size */', gen : ['/* A4 Page Size */',
'.phb{', '.page{',
' width : 210mm;', ' width : 210mm;',
' height : 296.8mm;', ' height : 296.8mm;',
'}', '}',
'' ''
@@ -311,10 +311,10 @@ module.exports = [
icon : 'far fa-file', icon : 'far fa-file',
gen : ['/* Square Page Size */', gen : ['/* Square Page Size */',
'.page {', '.page {',
' width:5.25in;', ' width : 125mm;',
' height:5.25in;', ' height : 125mm;',
' padding:.5in;', ' padding : 12.5mm;',
' columns:unset;', ' columns : unset;',
'}', '}',
'' ''
].join('\n') ].join('\n')
@@ -322,17 +322,20 @@ module.exports = [
{ {
name : 'Ink Friendly', name : 'Ink Friendly',
icon : 'fas fa-tint', icon : 'fas fa-tint',
gen : ['/* Ink Friendly */', gen : dedent`
'.pages *:is(.page,.monster,.note,.descriptive) {', /* Ink Friendly */
' background:white !important;', .pages *:is(.page,.monster,.note,.descriptive) {
' box-shadow:0px 0px 3px !important;', background : white !important;
'}', box-shadow : 0px 0px 3px !important;
'', }
'.page .note:before {',
' box-shadow:0px 0px 3px;', .page .note:before {
'}', box-shadow : 0px 0px 3px;
'' }
].join('\n')
.page img {
visibility : hidden;
}`
}, },
] ]
}, },

View File

@@ -6,7 +6,7 @@ const MonsterBlockGen = require('./monsterblock.gen.js');
const ClassFeatureGen = require('./classfeature.gen.js'); const ClassFeatureGen = require('./classfeature.gen.js');
const CoverPageGen = require('./coverpage.gen.js'); const CoverPageGen = require('./coverpage.gen.js');
const TableOfContentsGen = require('./tableOfContents.gen.js'); const TableOfContentsGen = require('./tableOfContents.gen.js');
const dedent = require('dedent-tabs').default;
module.exports = [ module.exports = [
@@ -266,7 +266,7 @@ module.exports = [
/**************** PRINT *************/ /**************** PRINT *************/
{ {
groupName : 'Page', groupName : 'Print',
icon : 'fas fa-print', icon : 'fas fa-print',
view : 'style', view : 'style',
snippets : [ snippets : [
@@ -275,8 +275,8 @@ module.exports = [
icon : 'far fa-file', icon : 'far fa-file',
gen : ['/* A4 Page Size */', gen : ['/* A4 Page Size */',
'.phb {', '.phb {',
' width : 210mm;', ' width : 210mm;',
' height : 296.8mm;', ' height : 296.8mm;',
'}' '}'
].join('\n') ].join('\n')
}, },
@@ -285,10 +285,10 @@ module.exports = [
icon : 'far fa-file', icon : 'far fa-file',
gen : ['/* Square Page Size */', gen : ['/* Square Page Size */',
'.phb {', '.phb {',
' width:5.25in;', ' width : 125mm;',
' height:5.25in;', ' height : 125mm;',
' padding:.5in;', ' padding : 12.5mm;',
' columns:unset;', ' columns : unset;',
'}', '}',
'' ''
].join('\n') ].join('\n')
@@ -296,13 +296,16 @@ module.exports = [
{ {
name : 'Ink Friendly', name : 'Ink Friendly',
icon : 'fas fa-tint', icon : 'fas fa-tint',
gen : ['/* Ink Friendly */', gen : dedent`
'.phb, .phb blockquote, .phb hr+blockquote {', /* Ink Friendly */',
' background : white;', .phb, .phb blockquote, .phb hr+blockquote {
' box-shadow : 0px 0px 3px;', background : white;
'}', box-shadow : 0px 0px 3px;
'' }
].join('\n')
.phb img {
visibility : hidden;
}`
}, },
] ]
}, },