-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement some core styling for chars carousel, hp bar, etc.
Refs #69 The character card is starting to look useful!
- Loading branch information
Showing
8 changed files
with
167 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,32 @@ | ||
(ns ^{:author "Daniel Leong" | ||
:doc "Campaign-viewer for D&D 5e"} | ||
wish.sheets.dnd5e.campaign | ||
(:require [wish.views.campaign.chars-carousel :refer [chars-carousel]] | ||
[wish.sheets.dnd5e.subs :as subs] | ||
(:require [wish.sheets.dnd5e.subs :as subs] | ||
[wish.sheets.dnd5e :as dnd5e] | ||
[wish.sheets.dnd5e.campaign.style :as style] | ||
[wish.views.campaign.base :as base] | ||
[wish.views.campaign.hp-bar :refer [hp-bar]] | ||
[wish.views.widgets :as widgets | ||
:refer-macros [icon] | ||
:refer [link link>evt]] | ||
[wish.util :refer [<sub >evt]])) | ||
|
||
(defn char-card [{:keys [id] :as c}] | ||
[:div.character | ||
(:name c) | ||
(str (<sub [::subs/hp id]))]) | ||
[:div style/char-card | ||
[:div.name (:name c)] | ||
|
||
[:div.hp | ||
(let [[hp max-hp] (<sub [::subs/hp id])] | ||
(if (> hp 0) | ||
[hp-bar hp max-hp] | ||
[dnd5e/hp-death-saving-throws id]))] | ||
|
||
[:div.abilities | ||
(let [info (<sub [::subs/ability-info id])] | ||
[dnd5e/abilities-display info])] | ||
]) | ||
|
||
(defn view | ||
[section] | ||
[:div | ||
[chars-carousel char-card] | ||
"TODO Campaign"]) | ||
[base/campaign-page section | ||
:char-card char-card]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
(ns ^{:author "Daniel Leong" | ||
:doc "campaign.style"} | ||
wish.sheets.dnd5e.campaign.style | ||
(:require [garden.color :as color] | ||
[wish.style :refer [defclass defstyled]] | ||
[wish.style.flex :as flex :refer [flex]] | ||
[wish.style.shared :refer [metadata]])) | ||
|
||
(defstyled char-card | ||
{} | ||
|
||
[:.abilities (merge flex | ||
flex/justify-center) | ||
[:.label {:font-size "0.7em"}] | ||
[:.mod {:font-size "1.5em" | ||
:padding "2px 4px"}] | ||
[:.score {:font-size "0.9em" | ||
:margin-bottom "8px"}] | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
(ns ^{:author "Daniel Leong" | ||
:doc "base"} | ||
wish.views.campaign.base | ||
(:require [wish.views.campaign.chars-carousel :refer [chars-carousel]])) | ||
|
||
(defn campaign-page | ||
[section & {:keys [char-card]}] | ||
[:div.campaign | ||
[chars-carousel char-card] | ||
"TODO campaign"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
(ns ^{:author "Daniel Leong" | ||
:doc "hp-bar"} | ||
wish.views.campaign.hp-bar) | ||
|
||
(defn hp-bar [hp max-hp] | ||
[:div.hp-bar | ||
[:div.bar {:style {:width (str (int | ||
(* 100 | ||
(/ hp max-hp))) | ||
"%")}}] | ||
[:div.label | ||
hp " / " max-hp] | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters