0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 20:42:43 +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 = [];
if(this.props.renderer === 'V3')
if(this.props.view === 'text') {
snippets = SnippetsV3.filter((SnippetsV3)=>SnippetsV3.view === 'text');
} else if(this.props.view === 'style') {
snippets = SnippetsV3.filter((SnippetsV3)=>SnippetsV3.view === 'style');
} else
snippets = null;
snippets = SnippetsV3.filter((snippetGroup)=>snippetGroup.view === this.props.view);
else
if(this.props.view === 'text') {
snippets = SnippetsLegacy.filter((SnippetsLegacy)=>SnippetsLegacy.view === 'text');
} else if(this.props.view === 'style') {
snippets = SnippetsLegacy.filter((SnippetsLegacy)=>SnippetsLegacy.view === 'style');
} else
snippets = null;
snippets = SnippetsLegacy.filter((snippetGroup)=>snippetGroup.view === this.props.view);
return _.map(snippets, (snippetGroup)=>{
return <SnippetGroup

View File

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

View File

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