Use Bootstrap from disk instead of CDN

This commit is contained in:
2024-07-02 05:55:43 +02:00
parent 2119eead14
commit fb7d9ea4a7
5 changed files with 58 additions and 69 deletions

View File

@ -28,14 +28,14 @@
<article class="container mt-5"> <article class="container mt-5">
<header class="d-flex justify-content-between align-items-center py-3 border-bottom"> <header class="d-flex justify-content-between align-items-center py-3 border-bottom">
<h1 class="h2"> <h1 class="h2">
<a href='{% url "core:index" %}' class="text-decoration-none">Twitch drops</a> <a href='{% url "core:index" %}' class="text-decoration-none nav-title">Twitch drops</a>
</h1> </h1>
<nav> <nav>
<ul class="nav"> <ul class="nav">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href='{% url "api-1.0.0:openapi-view" %}'>API</a> <a class="nav-link" href='{% url "api-1.0.0:openapi-view" %}'>API</a>
</li> </li>
<li class="nav-item"> <li class="nav-item d-none d-sm-block">
<a class="nav-link" href="https://github.com/sponsors/TheLovinator1">Donate</a> <a class="nav-link" href="https://github.com/sponsors/TheLovinator1">Donate</a>
</li> </li>
<li> <li>
@ -54,6 +54,7 @@
</nav> </nav>
</header> </header>
{% block content %} {% block content %}
<p>Content goes here</p>
{% endblock content %} {% endblock content %}
</article> </article>
<script src="{% static 'js/bootstrap.min.js' %}"></script> <script src="{% static 'js/bootstrap.min.js' %}"></script>

View File

@ -9,8 +9,8 @@
<img src="{{ game.image_url }}" <img src="{{ game.image_url }}"
alt="{{ game.display_name }}" alt="{{ game.display_name }}"
class="img-fluid rounded-start" class="img-fluid rounded-start"
height="100" height="150"
width="100" width="150"
loading="lazy"> loading="lazy">
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
@ -21,26 +21,11 @@
</h2> </h2>
</div> </div>
</div> </div>
<div class="col-md-6"> </div>
<div class="card-body card-bottom">
{% if discord_settings %} {% if discord_settings %}
<div class="card-body"> <div class="card-body">
<form action='{% url "core:subscription_create" %}' <div>Available on iOS: {{ game_data.ios_available|yesno:"Yes,No" }}</div>
method="post"
class="mb-2">
{% csrf_token %}
<input type="hidden" name="game_id" value="{{ game.id }}">
<select name="discord_webhook" class="form-select">
{% for discord_setting in discord_settings %}
<option value="{{ discord_setting.id }}">{{ discord_setting.name }}</option>
{% endfor %}
</select>
<div>
<a href="#" class="card-link mt-2">Notify when new drop are found</a>
</div>
<div>
<a href="#" class="card-link mt-2">Notify when the drop is live</a>
</div>
</form>
</div> </div>
{% else %} {% else %}
<div class="card-body text-end"> <div class="card-body text-end">
@ -48,20 +33,27 @@
</div> </div>
{% endif %} {% endif %}
</div> </div>
</div> <div class="card-body card-bottom">
<ul class="list-group list-group-flush"> <div class="row">
{% for drop_benefit in game_data.drop_benefits %} {% for drop_benefit in game_data.drop_benefits %}
<li class="list-group-item d-flex align-items-center"> <div class="col-6 col-md-4 d-flex align-items-center mb-2 position-relative">
<img src="{{ drop_benefit.image_asset_url }}" <img src="{{ drop_benefit.image_asset_url }}"
alt="{{ drop_benefit.name }}" alt="{{ drop_benefit.name }}"
class="img-fluid rounded me-3" class="img-fluid rounded me-3"
height="50" height="50"
width="50" width="50"
loading="lazy"> loading="lazy">
<a href="{{ drop_benefit.details_url }}" class="text-decoration-none">{{ drop_benefit.name }}</a> {# Only show the entitlement limit if it's not None or above 1 #}
</li> {% if drop_benefit.entitlement_limit > 1 %}
<span class="badge bg-primary position-absolute top-100 start-20 translate-middle">{{ drop_benefit.entitlement_limit }}
<span class="visually-hidden">limit per account</span>
</span>
{% endif %}
{{ drop_benefit.name }}
</div>
{% endfor %} {% endfor %}
</ul> </div>
</div>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>

View File

@ -1,8 +1,10 @@
/* Make background color darker and text white */
body { body {
background-color: #0c0c0c; background-color: #0c0c0c;
color: #ffffff; color: #ffffff;
} }
/* Make links white */
a { a {
color: #ffffff; color: #ffffff;
} }
@ -19,43 +21,37 @@ a:hover {
color: #e91e63; color: #e91e63;
} }
/* Make the logo text pink */
.nav-title {
color: #e91e63;
}
/* Top half of the card */
.card { .card {
background-color: #111111; background-color: #111111;
border: 1px solid #111111; border: 1px solid #000000;
} }
.card-title a {
color: #ffffff;
}
.card-title a:hover { /* Bottom half of the card */
color: #e91e63; .card-bottom {
}
.alert {
background-color: #333333;
border-color: #444444;
}
.list-group-item {
background-color: #141414; background-color: #141414;
border: 1px solid #141414; border-top: 1px solid #000000;
}
.list-group-item a {
color: #ffffff;
}
.list-group-item a:hover {
color: #e91e63;
} }
.btn-primary { .btn-primary {
background-color: #06172e; background-color: #e91e63;
border-color: #000c1d; border-color: #111111;
} }
.btn-primary:hover { .btn-primary:hover {
background-color: #040e1d; background-color: #af1548;
border-color: #000c1d; border-color: #111111;
}
/* Django alerts */
/* https://docs.djangoproject.com/en/5.0/ref/contrib/messages/ */
.alert {
background-color: #181818;
border-color: #444444;
} }