Skip to content

Commit

Permalink
Style traits, rollables, relationships, weapons
Browse files Browse the repository at this point in the history
Styles the rest of the sheet for the initial style pass
  • Loading branch information
StasTserk committed Jul 4, 2020
1 parent 1fdaaa4 commit 86dc67d
Show file tree
Hide file tree
Showing 15 changed files with 143 additions and 46 deletions.
12 changes: 11 additions & 1 deletion module/items/relationship.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
import { BWActor } from "../actor.js";
import { DisplayClass } from "./item.js";

export class Relationship extends Item {
prepareData() {
this.data.data.safeId = this._id;
this.data.data.aptitude = parseInt(this.actor.data.data.circles.exp, 10) || 0;

if (this.data.data.hateful || this.data.data.enmity) {
this.data.data.cssClass = "relationship-hostile";
} else if (this.data.data.romantic || this.data.data.immediateFamily) {
this.data.data.cssClass = "relationship-friendly";
} else {
this.data.data.cssClass = "relationship-neutral";
}
}

get actor(): BWActor {
Expand All @@ -17,13 +26,14 @@ interface RelationshipDataRoot extends BaseEntityData {
data: RelationshipData;
}

export interface RelationshipData {
export interface RelationshipData extends DisplayClass {
description: string;
forbidden: boolean;
immediateFamily: boolean;
otherFamily: boolean;
romantic: boolean;
hateful: boolean;
enmity: boolean;
influence: string;
building: string;
buildingProgress: number;
Expand Down
4 changes: 4 additions & 0 deletions styles/burningwheel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ input.exponent {
max-height: 28px;
}

input.hidden {
display: none;
}

.flex-row {
display: flex;
flex-direction: row;
Expand Down
13 changes: 13 additions & 0 deletions styles/character/bits.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import "../mixins.scss";

.beliefs, .instincts {
.bits-item {
& > div {
Expand Down Expand Up @@ -30,6 +32,13 @@
width: calc(33% - 10px);
margin: 5px;

.trait {
@include colored-item(black);
textarea {
background-color: transparent;
}
}

i {
float: right;
font-size: 12px;
Expand All @@ -42,4 +51,8 @@
color: #FF0000;
}
}

.trait-checkbox:checked + div > textarea {
display: none;
}
}
32 changes: 26 additions & 6 deletions styles/character/character.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
@import "../mixins.scss";


.sheet {
min-width: 800px;
}
.character {
min-width: 800px;
textarea {
font-family: unset;
}
Expand Down Expand Up @@ -60,13 +65,26 @@
column-gap: 5px;
row-gap: 5px;

.rollable:hover {
background-color: $hover-color;
.rollable {
@include colored-item(black);
height: min-content;

select.shade, input.exponent, button {
width: 3em;
height: 2em;
}
}

.rollable-name {
width: 33%;
input.rollable-name {
border: 0;
border-bottom: 1px solid black;
border-radius: 0;
padding: 1px 0px;
}
.rollable-name {
width: calc(100% - 10.5em);
margin-right: 1em;
font-size: 1.125em;
}

.collapse-checkbox {
Expand Down Expand Up @@ -108,11 +126,13 @@
}

.attribute-subrow {
display: inline-block;

label {
font-size: 1.125em;
display: block;
width: 50%;
display: inline-block;
text-align: center;
margin-left: 20px;
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions styles/character/equipment.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
column-gap: 1px;
row-gap: 1px;
& > div {
padding: 1px 3px;

& i {
margin-bottom: 3px;
}
Expand Down
17 changes: 12 additions & 5 deletions styles/character/learning.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,24 @@

.learning {
width: calc(50% - 10px);
margin: 5px;
&:hover {
background-color: $hover-color;
height: min-content;
margin: 1px;
@include colored-item(black);

button {
width: 3em;
height: 2em;
}

h3 {
width: calc(100% - 80px);
margin-left: 10px;
width: calc(100% - 5em);
margin-top: 3px;
font-weight: bold;
text-align: center;
}
.learning-xp {
margin-left: 1.5em;
margin-bottom: 3px;
@include progress-ticks;
}
}
Expand Down
20 changes: 16 additions & 4 deletions styles/character/relationships.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,25 @@
width: calc(95% - 36px);
}

.relationship > i {
width: 18px;
.relationship {
& > i {
width: 18px;

&:hover {
color: red;
&:hover {
color: red;
}
}
}

.relationship-hostile {
@include colored-item(red);
}
.relationship-friendly {
@include colored-item(green);
}
.relationship-neutral {
@include colored-item(black);
}
}
.reputations, .affiliations {
width: 30%;
Expand Down
29 changes: 26 additions & 3 deletions styles/character/weapons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,28 @@
}

.weapon-grid {
grid-template-columns: 5fr repeat(7, 1fr) 2fr;
column-gap: 0px;
row-gap: 0px;
grid-template-columns: 5fr repeat(7, 1fr) 2fr 0;
.weapon-header {
background-color: rgba(black, .15);
}

.weapon-row:nth-child(2n) {
background-color: rgba(black, .05);
}
}

.ranged-grid {
grid-template-columns: 5fr repeat(5, 1fr) 2fr;
column-gap: 0px;
row-gap: 0px;
grid-template-columns: 5fr repeat(5, 1fr) 2fr 0;
.weapon-header {
background-color: rgba(black, .15);
}
.weapon-row:nth-child(2n) {
background-color: rgba(black, .05);
}
.weapon-ims {
margin-bottom: -10px;
}
Expand All @@ -37,12 +54,18 @@
}

.armor-grid {
grid-template-columns: 1fr 1fr 75px 4fr;
grid-template-columns: 2.75em 2.75em 6em 1fr;
row-gap: 0;
column-gap: 0;

.armor-header {
background-color: rgba(black, .15);
}
.armor-row {
font-size: 16px;
text-align: center;
border-bottom: 1px solid black;
margin: 0 2px;
}
}
}
2 changes: 2 additions & 0 deletions styles/mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ $hover-color: rgba(0,0,0,0.1);
}

@mixin colored-item($color) {
margin: 1px;
padding: 1px 3px;
border-radius: 4px;
border: 2px solid rgba($color, .15);

Expand Down
1 change: 1 addition & 0 deletions template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ Item:
name: ''
traittype: ''
text: ''
collapsed: true
skill:
name: ''
shade: B
Expand Down
39 changes: 18 additions & 21 deletions templates/character-sheet.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,15 @@ <h2>Die Traits
<i data-action="addTrait" data-id="die" class="fas fa-plus"></i>
</h2>
{{#each traits.die as |trait|}}
<input type="checkbox" id={{trait._id}}-toggle class="hidden trait-checkbox" data-item-id="{{trait._id}}" data-binding="data.collapsed" {{ checked trait.data.collapsed }}>
<div class="trait" data-item-id="{{trait._id}}">
<h3>
{{ trait.name }}
<i class="fas fa-trash" data-action="delItem" data-id="{{trait._id}}"></i>
<i class="fas fa-edit" data-action="editItem" data-id="{{trait._id}}"></i>
</h3>
<label for="{{trait._id}}-toggle">
<h3>
{{ trait.name }}
<i class="fas fa-trash" data-action="delItem" data-id="{{trait._id}}"></i>
<i class="fas fa-edit" data-action="editItem" data-id="{{trait._id}}"></i>
</h3>
</label>
<textarea disabled="disabled">{{trait.data.text}}</textarea>
</div>
{{/each}}
Expand All @@ -112,12 +115,15 @@ <h2>Call-on Traits
<i data-action="addTrait" data-id="call-on" class="fas fa-plus"></i>
</h2>
{{#each traits.callon as |trait|}}
<input type="checkbox" id={{trait._id}}-toggle class="hidden trait-checkbox" data-item-id="{{trait._id}}" data-binding="data.collapsed" {{ checked trait.data.collapsed }}>
<div class="trait" data-item-id="{{trait._id}}">
<h3>
{{ trait.name }}
<i class="fas fa-trash" data-action="delItem" data-id="{{trait._id}}"></i>
<i class="fas fa-edit" data-action="editItem" data-id="{{trait._id}}"></i>
</h3>
<label for="{{trait._id}}-toggle">
<h3>
{{ trait.name }}
<i class="fas fa-trash" data-action="delItem" data-id="{{trait._id}}"></i>
<i class="fas fa-edit" data-action="editItem" data-id="{{trait._id}}"></i>
</h3>
</label>
<textarea disabled="disabled">{{ trait.data.text }}</textarea>
</div>
{{/each}}
Expand All @@ -129,14 +135,9 @@ <h3>
<h2 class="section-header"><i class="fas fa-chevron-down"></i>Stats</h2>
</label>
<div class="stats">
{{> "systems/burningwheel/templates/parts/rollable-item.html" statName="Will" stat=data.will namePrefix="data.will"}}
{{> "systems/burningwheel/templates/parts/rollable-item.html" statName="Will" stat=data.will namePrefix="data.will" taxName="data.willTax" taxValue=data.willTax }}
{{> "systems/burningwheel/templates/parts/rollable-item.html" statName="Power" stat=data.power namePrefix="data.power"}}
{{> "systems/burningwheel/templates/parts/rollable-item.html" statName="Agility" stat=data.agility namePrefix="data.agility"}}
<div class="attribute-subrow flex-row">
<label class="attribute-label">Tax</label>
<input type="number" class="circle-input" name="data.willTax" value="{{data.willTax}}">
</div>
<div></div><div></div>
{{> "systems/burningwheel/templates/parts/rollable-item.html" statName="Perception" stat=data.perception namePrefix="data.perception"}}
{{> "systems/burningwheel/templates/parts/rollable-item.html" statName="Forte" stat=data.forte namePrefix="data.forte"}}
{{> "systems/burningwheel/templates/parts/rollable-item.html" statName="Speed" stat=data.speed namePrefix="data.speed"}}
Expand All @@ -150,13 +151,9 @@ <h2 class="section-header"><i class="fas fa-chevron-down"></i>Attributes</h2>
{{> "systems/burningwheel/templates/parts/rollable-item.html" statName="Health" stat=data.health namePrefix="data.health" routine=true}}
{{> "systems/burningwheel/templates/parts/rollable-item.html" statName="Steel" stat=data.steel namePrefix="data.steel" routine=true}}
{{> "systems/burningwheel/templates/parts/rollable-item.html" statName="Circles" stat=data.circles namePrefix="data.circles" routine=true}}
{{> "systems/burningwheel/templates/parts/rollable-item.html" statName="Resources" stat=data.resources namePrefix="data.resources" routine=true}}
{{> "systems/burningwheel/templates/parts/rollable-item.html" statName="Resources" stat=data.resources namePrefix="data.resources" routine=true taxName="data.resourcesTax" taxValue=data.resourcesTax }}
{{> "systems/burningwheel/templates/parts/rollable-item.html" statName=data.custom1.name stat=data.custom1 namePrefix="data.custom1" routine=true customName=true}}
{{> "systems/burningwheel/templates/parts/rollable-item.html" statName=data.custom2.name stat=data.custom2 namePrefix="data.custom2" routine=true customName=true}}
<div class="attribute-subrow flex-row">
<label class="attribute-label">Tax</label>
<input type="number" class="circle-input" name="data.resourcesTax" value="{{data.resourcesTax}}">
</div>
<div class="attributes-derived">
<div class="attributes-item flex-row">
<label class="attribute-label">Reflexes</label>
Expand Down
4 changes: 2 additions & 2 deletions templates/parts/learning.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<div class="learning flex-row">
<i class="fas fa-edit item-action-icon" data-action="editItem" data-id="{{skill._id}}"></i>
<i class="fas fa-trash item-action-icon" data-action="delItem" data-id="{{skill._id}}"></i>
<h3>{{skill.name}}</h3>
<button class="rollable" data-rollable-name="{{skill.name}}" data-skill-id="{{skill._id}}"><i class="fas fa-dice"></i></button>
<i class="fas fa-trash item-action-icon" data-action="delItem" data-id="{{skill._id}}"></i>
<i class="fas fa-edit item-action-icon" data-action="editItem" data-id="{{skill._id}}"></i>
<div class="learning-xp">
{{#multiboxes skill.data.learningProgress needed=skill.data.aptitude}}
<input type="radio"
Expand Down
4 changes: 2 additions & 2 deletions templates/parts/relationships.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="relationship flex-row">
<div class="relationship flex-row {{relationship.data.cssClass}}">
<div class="item-title">
{{ relationship.name }} = {{ stat }} {{ exp }}
{{ relationship.name }}
</div>
<i class="fas fa-edit" data-action="editItem" data-id="{{relationship._id}}"></i>
<i class="fas fa-trash" data-action="delItem" data-id="{{relationship._id}}"></i>
Expand Down
6 changes: 6 additions & 0 deletions templates/parts/rollable-item.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,11 @@ <h3 class="rollable-name">{{ statName }}</h3>
<input type="number" class="circle-input" placeholder="F" title="Fate points spent on {{statName}}" name="{{namePrefix}}.fate" value="{{stat.fate}}">
<input type="number" class="circle-input" placeholder="P" title="Persona points spent on {{statName}}" name="{{namePrefix}}.persona" value="{{stat.persona}}">
<input type="number" class="circle-input" placeholder="D" title="Deeds points spent on {{statName}}" name="{{namePrefix}}.deeds" value="{{stat.deeds}}">
{{#if taxName}}
<div class="attribute-subrow">
<label class="attribute-label">Tax</label>
<input type="number" class="circle-input" name="{{taxName}}" value="{{taxValue}}">
</div>
{{/if}}
</div>
</div>
Loading

0 comments on commit 86dc67d

Please sign in to comment.