diff --git a/src/components/sidebar.rs b/src/components/sidebar.rs index f0453ea..64cab69 100644 --- a/src/components/sidebar.rs +++ b/src/components/sidebar.rs @@ -29,6 +29,8 @@ pub fn Sidebar () -> impl IntoView { let hit_dice = player.hit_dice(); let dt = player.death_save_throws(); + let slots = player.spell_slots(); + let adjust_level = move |adjustment: i8| level.update(|l| { if let Some(new) = l.checked_add_signed(adjustment) { *l = new; @@ -78,6 +80,20 @@ pub fn Sidebar () -> impl IntoView { }); }; + + let process_spell_slot_click = move |level: usize, slot_id: u8| { + slots.update(|s| { + let l = &mut s.0[level]; + if slot_id < l.used { + l.used = slot_id; + } else { + l.used = slot_id + 1; + } + }) + }; + + + view! { } } diff --git a/style/_sidebar.scss b/style/_sidebar.scss index d2b775a..7843fbf 100644 --- a/style/_sidebar.scss +++ b/style/_sidebar.scss @@ -252,6 +252,51 @@ aside { } } + .slots { + margin: 0 7px; + + .slot-level { + display: flex; + justify-content: flex-start; + + @for $i from 1 through 9 { + &-#{$i} .spell-slot { + background: hsl((348 + ($i * 3)) * 1deg, 83%, 47%); + } + } + } + + .slot-level-title { + font-family: vars.$t; + font-weight: 100; + color: #aaa; + text-align: right; + display: block; + width: 32px; + &::after { + content: " |"; + } + } + + .spell-slot { + $size: 20px; + width: $size; + height: $size; + margin: 2px; + &:hover { + cursor: pointer; + } + } + + .spell-slot:has(~ .spell-slot:hover), .spell-slot:hover, .spell-slot.used { + filter: contrast(20%); + } + + .spell-slot.used:hover, .spell-slot.used:hover ~ .spell-slot.used { + filter: contrast(70%); + } + } + input { max-width: 100%; width: fit-content;