-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: make sample_deployment themable with a select button
- Loading branch information
1 parent
3f5d396
commit 6958d1c
Showing
7 changed files
with
103 additions
and
5 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
document.addEventListener('DOMContentLoaded', function() { | ||
const theme = window.localStorage.getItem("allauth-theme") || "emerald"; | ||
setTheme(theme); | ||
const select = document.getElementById("select-theme"); | ||
select.value = theme; | ||
}, false); | ||
|
||
function onSelectChange() { | ||
const select = document.getElementById("select-theme"); | ||
const theme = select.value; | ||
setTheme(theme); | ||
} | ||
|
||
function setTheme(theme) { | ||
const html = document.querySelector("html"); | ||
html.dataset.theme = theme; | ||
window.localStorage.setItem("allauth-theme", theme); | ||
} |
50 changes: 50 additions & 0 deletions
50
sample_deployment/sample_deployment/templates/allauth/layouts/base.html
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,50 @@ | ||
{% extends "allauth/layouts/base.html" %} | ||
{% load static %} | ||
{% load tailwind_tags %} | ||
{% block extra_head %} | ||
{{ block.super }} | ||
{% tailwind_css %} | ||
{% endblock %} | ||
{% block body %} | ||
<div class="fixed hidden top-5 right-5 md:block w-28"> | ||
<select id="select-theme" | ||
class="w-full px-5 py-1 text-sm text-primary" | ||
onchange="onSelectChange()"> | ||
<option disabled selected>Theme</option> | ||
<option>light</option> | ||
<option>dark</option> | ||
<option>cupcake</option> | ||
<option>bumblebee</option> | ||
<option>emerald</option> | ||
<option>corporate</option> | ||
<option>synthwave</option> | ||
<option>retro</option> | ||
<option>cyberpunk</option> | ||
<option>valentine</option> | ||
<option>halloween</option> | ||
<option>garden</option> | ||
<option>forest</option> | ||
<option>aqua</option> | ||
<option>lofi</option> | ||
<option>pastel</option> | ||
<option>fantasy</option> | ||
<option>wireframe</option> | ||
<option>black</option> | ||
<option>luxury</option> | ||
<option>dracula</option> | ||
<option>cmyk</option> | ||
<option>autumn</option> | ||
<option>business</option> | ||
<option>acid</option> | ||
<option>lemonade</option> | ||
<option>night</option> | ||
<option>coffee</option> | ||
<option>winter</option> | ||
<option>dim</option> | ||
<option>nord</option> | ||
<option>sunset</option> | ||
</select> | ||
</div> | ||
{{ block.super }} | ||
<script src="{% static "theme.js" %}"></script> | ||
{% endblock body %} |
24 changes: 24 additions & 0 deletions
24
sample_deployment/sample_deployment/theme/static_src/src/styles.css
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,3 +1,27 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; | ||
|
||
@layer components { | ||
.social-github { | ||
@apply bg-stone-900 hover:bg-black | ||
} | ||
.social-facebook { | ||
@apply bg-blue-700 hover:bg-blue-800 | ||
} | ||
.social-google { | ||
@apply bg-red-700 hover:bg-red-800 | ||
} | ||
.social-linkedin { | ||
@apply bg-cyan-600 hover:bg-cyan-700 | ||
} | ||
.social-strava { | ||
@apply bg-orange-400 hover:bg-orange-500 | ||
} | ||
.social-exist { | ||
@apply bg-gray-500 hover:bg-gray-600 | ||
} | ||
.social-wahoo { | ||
@apply bg-cyan-500 hover:bg-cyan-700 | ||
} | ||
} |
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