-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(design): Add display of stanzas and interactive annotations
This change adds interactive annotations to the stanza text. This is an early prototype to demonstrate the functionality.
- Loading branch information
Showing
7 changed files
with
398 additions
and
93 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
.prose span div { | ||
display: inline; | ||
} | ||
|
||
[data-notation] { | ||
background-color: #ffffcc; | ||
cursor: help; | ||
border: 1px solid black; | ||
padding: 0 0.2em; | ||
} | ||
.shadow-left { | ||
box-shadow: -8px 0 10px -6px rgba(0, 0, 0, 0.2); | ||
} | ||
/* | ||
[data-notation]:hover::before { | ||
content: attr(data-notation); | ||
position: absolute; | ||
background: #ffffcc; | ||
padding: 5px; | ||
border: 1px solid #000; | ||
border-radius: 5px; | ||
margin-top: 30px; | ||
font-size: 0.8em; | ||
z-index: 10; | ||
} */ |
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,25 @@ | ||
// Get the sidebar, close button, and notation text elements | ||
var sidebar = document.getElementById("sidebar"); | ||
var closeButton = document.getElementById("close-button"); | ||
var notationText = document.getElementById("notation-text"); | ||
|
||
// Listen for click events on the document | ||
document.addEventListener("click", function (event) { | ||
// If the clicked element has a data-notation attribute | ||
if (event.target.hasAttribute("data-notation")) { | ||
// Get the data-notation text | ||
var text = event.target.getAttribute("data-notation"); | ||
|
||
// Update the notation text | ||
notationText.textContent = text; | ||
|
||
// Show the sidebar | ||
sidebar.style.transform = "translateX(0)"; | ||
} | ||
}); | ||
|
||
// Add a click event listener to the close button | ||
closeButton.addEventListener("click", function () { | ||
// Hide the sidebar | ||
sidebar.style.transform = "translateX(100%)"; | ||
}); |
Large diffs are not rendered by default.
Oops, something went wrong.
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,22 +1,35 @@ | ||
{% extends "base.html" %} | ||
{% load static %} | ||
|
||
{% block title %}Stanzas - La Sfera{% endblock title %} | ||
|
||
{% block content %} | ||
<section id="introduction" class="container mx-auto p-4 my-10"> | ||
<h3 class="text-2xl pb-8" id="text"> | ||
Text of the manuscript — <a href="#top">Back to top ↑</a> | ||
</h3> | ||
Text of the manuscript</a> | ||
</h3> | ||
|
||
<div class="prose"> | ||
{% for stanza in stanzas %} | ||
<p> | ||
<span class="font-serif text-red-700 text-sm"> | ||
{{ stanza.stanza_line_code_starts }} | ||
</span> | ||
{{ stanza.stanza_text }} | ||
</p> | ||
{% endfor %} | ||
</div> | ||
<div class="prose"> | ||
{% for stanza in stanzas %} | ||
<div> | ||
<span class="font-serif text-red-700 text-sm mr-2"> | ||
{{ stanza.stanza_line_code_starts }} | ||
</span> | ||
<span> | ||
{{ stanza.stanza_text|safe }} | ||
</span> | ||
</div> | ||
{% endfor %} | ||
</div> | ||
</section> | ||
|
||
<!-- Sidebar --> | ||
<div id="sidebar" class="fixed right-0 top-0 h-full w-64 bg-white p-4 transform translate-x-full overflow-auto transition-transform duration-200 ease-in-out shadow-left"> | ||
<button id="close-button" class="mb-4 bg-red-500 text-white p-2 rounded">×</button> | ||
<p id="notation-text"></p> | ||
</div> | ||
{% endblock content %} | ||
|
||
{% block scripts %} | ||
<script src="{% static 'js/stanza.js' %}"></script> | ||
{% endblock scripts %} |