Added speaker name for choice boxes

This commit is contained in:
p11 2025-04-20 23:23:48 +02:00
parent 1ad2fcd9cb
commit 89a6dc9f1d

View File

@ -266,6 +266,21 @@ fn global_styles() -> Markup {
text-align: left; text-align: left;
} }
.choice-name {
font-family: 'Georgia', serif;
font-size: 1.8vw;
font-weight: bold;
padding: 0 1.5vw;
background: #4a6b8a;
color: white;
border-radius: 0.5vw;
margin: -1.2vw 0 1vw 0;
transform: translateY(-60%);
position: relative;
z-index: 1;
width: max-content;
}
.choice-box { .choice-box {
width: 90%; width: 90%;
min-width: 85%; min-width: 85%;
@ -280,6 +295,18 @@ fn global_styles() -> Markup {
left: 50%; left: 50%;
} }
@media (max-width: 768px) {
.choice-name {
font-size: 1.2rem;
margin: -1rem 0 0.8rem 0;
transform: translateY(-40%);
}
}
.choice-box:has(.choice-name) {
padding-top: 2.5vw;
}
.choice-button { .choice-button {
width: 100%; width: 100%;
background: none; background: none;
@ -387,6 +414,11 @@ pub fn render_novel(
@for (i, dialog_sequence) in dialogs.iter().enumerate() { @for (i, dialog_sequence) in dialogs.iter().enumerate() {
@if let Some(block) = dialog_sequence.blocks.first() { @if let Some(block) = dialog_sequence.blocks.first() {
div class="choice-box" { div class="choice-box" {
@if !block.name.is_empty() {
div class="choice-name" {
(block.name)
}
}
form method="POST" { form method="POST" {
input type="hidden" name="progress" value=(progress); input type="hidden" name="progress" value=(progress);
input type="hidden" name="choice" value=(i); input type="hidden" name="choice" value=(i);