use css for modals

This commit is contained in:
Mouse Reeve 2020-04-04 18:59:42 -07:00
parent f0609e6ff3
commit 94efe860b0
3 changed files with 35 additions and 32 deletions

View file

@ -172,6 +172,7 @@ body {
padding-top: 70px; padding-top: 70px;
position: relative; position: relative;
z-index: 0; z-index: 0;
margin-top: -2em;
} }
/* row component */ /* row component */
@ -484,8 +485,9 @@ dd {
.all-shelves { .all-shelves {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
overflow-y: hidden;
margin-left: 0; margin-left: 0;
position: relative;
z-index: 1;
} }
.all-shelves > div { .all-shelves > div {
flex-grow: 0; flex-grow: 0;
@ -510,7 +512,6 @@ dd {
font-size: 0.9em; font-size: 0.9em;
overflow: unset; overflow: unset;
width: min-content; width: min-content;
position: relative;
} }
.covers-shelf .cover-container:last-child { .covers-shelf .cover-container:last-child {
margin-right: 0; margin-right: 0;
@ -534,16 +535,33 @@ dd {
padding: 1rem; padding: 1rem;
} }
.compose-suggestion { .all-shelves input[type='radio'] {
display: none; display: none;
} }
.compose-suggestion.visible { .compose-suggestion {
display: none;
background-color: white;
z-index: 1;
width: -webkit-fill-available;
width: -moz-available;
box-shadow: 0 5px 10px rgba(0,0,0,0.45);
}
input:checked ~ .compose-suggestion {
display: block; display: block;
position: absolute;
top: 5em;
left: 0;
} }
.compose-suggestion .book-preview { .compose-suggestion .book-preview {
background-color: #EEE; background-color: #EEE;
padding: 1em; padding: 1em;
} }
.compose-suggestion button {
margin: 0;
}
.compose-suggestion .stars {
text-align: left;
}
.tag { .tag {
display: inline-block; display: inline-block;

View file

@ -1,20 +1,3 @@
function show_compose(element, e) {
e.preventDefault();
var visible_compose_boxes = document.getElementsByClassName('visible');
for (var i = 0; i < visible_compose_boxes.length; i++) {
visible_compose_boxes[i].className = 'compose-suggestion';
}
var target_id = 'compose-' + element.id;
var target = document.getElementById(target_id);
target.className += ' visible';
}
function hide_element(element) {
var classes = element.parentElement.className;
element.parentElement.className = classes.replace('visible', '');
}
function interact(e) { function interact(e) {
e.preventDefault(); e.preventDefault();
ajaxPost(e.target); ajaxPost(e.target);

View file

@ -13,9 +13,19 @@
{% for book in shelf.books %} {% for book in shelf.books %}
<div class="cover-container"> <div class="cover-container">
<div> <div>
<a href="{{ book.absolute_id }}" onclick="show_compose(this, event)" id="book-{{ book.id }}"> <label for="book-{{ book.id }}-radio">
{% include 'snippets/book_cover.html' with book=book %} {% include 'snippets/book_cover.html' with book=book %}
</a> </label>
<input name="book-{{ book.id }}" type="radio" id="book-{{ book.id }}-radio"></input>
<div class="compose-suggestion" id="compose-book-{{ book.id }}">
<label class="close icon icon-close" for="book-{{ book.id }}-radio-close" onclick="hide_element(this)">
<span class="hidden-text">Close</span>
</label>
<input name="book-{{ book.id }}" type="radio" id="book-{{ book.id }}-radio-close"></input>
<div class="content-container">
{% include 'snippets/create_status.html' with book=book user=request.user %}
</div>
</div>
</div> </div>
{% include 'snippets/shelve_button.html' with book=book %} {% include 'snippets/shelve_button.html' with book=book %}
</div> </div>
@ -28,13 +38,5 @@
{% for shelf in shelves %} {% for shelf in shelves %}
{% for book in shelf.books %} {% for book in shelf.books %}
<div class="compose-suggestion" id="compose-book-{{ book.id }}">
<span class="close icon icon-close" onclick="hide_element(this)">
<span class="hidden-text">Close</span>
</span>
<div class="content-container">
{% include 'snippets/create_status.html' with book=book user=request.user %}
</div>
</div>
{% endfor %} {% endfor %}
{% endfor %} {% endfor %}