Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added basic UI #27

Merged
merged 2 commits into from
Aug 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion corpus/corpus/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"pages.apps.PagesConfig",
]

MIDDLEWARE = [
Expand All @@ -56,7 +57,7 @@
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [],
"DIRS": [os.path.join(BASE_DIR, "templates")],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
Expand Down
1 change: 1 addition & 0 deletions corpus/corpus/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@

urlpatterns = [
path("admin/", admin.site.urls),
path("", include("pages.urls")),
]
Empty file added corpus/pages/__init__.py
Empty file.
6 changes: 6 additions & 0 deletions corpus/pages/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class PagesConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "pages"
Empty file.
7 changes: 7 additions & 0 deletions corpus/pages/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from django.urls import path

from .views import index

urlpatterns = [
path("", index, name="index"),
]
8 changes: 8 additions & 0 deletions corpus/pages/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from django.shortcuts import render

# Create your views here.


def index(request):
args = {}
return render(request, "pages/index.html", args)
71 changes: 71 additions & 0 deletions corpus/templates/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
{% block title %} {% endblock %} | Corpus
</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Ubuntu&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,400,0,0" />
<script src="https://code.jquery.com/jquery-3.7.0.min.js" integrity="sha256-2Pmvv0kuTBOenSvLm6bvfBSSHrUJ+3A7x6P5Ebd07/g=" crossorigin="anonymous"></script>
<link href="https://cdn.jsdelivr.net/npm/daisyui@3.6.2/dist/full.css" rel="stylesheet" type="text/css" />
<script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio,line-clamp"></script>
<script>
tailwind.config = {
daisyui: {
themes: ["winter", "night"]
}
}
</script>
<style>
body, html {
margin: 0;
padding: 0;
font-family: 'Ubuntu', sans-serif;
}
</style>
</head>
<body>

<div class="navbar bg-primary text-primary-content">
<div class="navbar-start">
<div class="dropdown">
<label tabindex="0" class="btn btn-ghost btn-circle">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h7" /></svg>
</label>
{% include "components/navbar_dropdown.html" %}
</div>
</div>
<div class="navbar-center">
<a class="btn btn-ghost normal-case text-xl">Corpus</a>
</div>
<div class="navbar-end">
{% include "components/navbar_right.html" %}
</div>
</div>

{% block content %}
{% endblock %}

{% include "components/dark_mode_toggle.html" %}

<footer class="footer p-10 bg-neutral text-neutral-content">
<div>
<svg width="50" height="50" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" class="fill-current"><path d="M22.672 15.226l-2.432.811.841 2.515c.33 1.019-.209 2.127-1.23 2.456-1.15.325-2.148-.321-2.463-1.226l-.84-2.518-5.013 1.677.84 2.517c.391 1.203-.434 2.542-1.831 2.542-.88 0-1.601-.564-1.86-1.314l-.842-2.516-2.431.809c-1.135.328-2.145-.317-2.463-1.229-.329-1.018.211-2.127 1.231-2.456l2.432-.809-1.621-4.823-2.432.808c-1.355.384-2.558-.59-2.558-1.839 0-.817.509-1.582 1.327-1.846l2.433-.809-.842-2.515c-.33-1.02.211-2.129 1.232-2.458 1.02-.329 2.13.209 2.461 1.229l.842 2.515 5.011-1.677-.839-2.517c-.403-1.238.484-2.553 1.843-2.553.819 0 1.585.509 1.85 1.326l.841 2.517 2.431-.81c1.02-.33 2.131.211 2.461 1.229.332 1.018-.21 2.126-1.23 2.456l-2.433.809 1.622 4.823 2.433-.809c1.242-.401 2.557.484 2.557 1.838 0 .819-.51 1.583-1.328 1.847m-8.992-6.428l-5.01 1.675 1.619 4.828 5.011-1.674-1.62-4.829z"></path></svg>
<p>IEEE NITK<br/>Build by the Corpus team.</p>
</div>
<div>
<span class="footer-title">Social</span>
<div class="grid grid-flow-col gap-4">
<a><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="fill-current"><path d="M24 4.557c-.883.392-1.832.656-2.828.775 1.017-.609 1.798-1.574 2.165-2.724-.951.564-2.005.974-3.127 1.195-.897-.957-2.178-1.555-3.594-1.555-3.179 0-5.515 2.966-4.797 6.045-4.091-.205-7.719-2.165-10.148-5.144-1.29 2.213-.669 5.108 1.523 6.574-.806-.026-1.566-.247-2.229-.616-.054 2.281 1.581 4.415 3.949 4.89-.693.188-1.452.232-2.224.084.626 1.956 2.444 3.379 4.6 3.419-2.07 1.623-4.678 2.348-7.29 2.04 2.179 1.397 4.768 2.212 7.548 2.212 9.142 0 14.307-7.721 13.995-14.646.962-.695 1.797-1.562 2.457-2.549z"></path></svg></a>
<a><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="fill-current"><path d="M19.615 3.184c-3.604-.246-11.631-.245-15.23 0-3.897.266-4.356 2.62-4.385 8.816.029 6.185.484 8.549 4.385 8.816 3.6.245 11.626.246 15.23 0 3.897-.266 4.356-2.62 4.385-8.816-.029-6.185-.484-8.549-4.385-8.816zm-10.615 12.816v-8l8 3.993-8 4.007z"></path></svg></a>
<a><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="fill-current"><path d="M9 8h-3v4h3v12h5v-12h3.642l.358-4h-4v-1.667c0-.955.192-1.333 1.115-1.333h2.885v-5h-3.808c-3.596 0-5.192 1.583-5.192 4.615v3.385z"></path></svg></a>
</div>
</div>
</footer>

</body>
</html>
22 changes: 22 additions & 0 deletions corpus/templates/components/dark_mode_toggle.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<button class="btn btn-ghost btn-outline btn-circle fixed bottom-10 right-10" onclick="toggleTheme()">
<span class="material-symbols-outlined" id="dark-mode-toggle">
</span>
</button>

<script>
$(document).ready(() => {
const theme = localStorage.getItem("corpusTheme") || "winter";
const icon = theme == "winter" ? "dark_mode" : "light_mode";
document.documentElement.setAttribute("data-theme", theme);
$("#dark-mode-toggle").html(icon);
})

const toggleTheme = () => {
let theme = localStorage.getItem("corpusTheme") || "winter";
theme = theme == "winter" ? "night" : "winter";
const icon = theme == "winter" ? "dark_mode" : "light_mode";
document.documentElement.setAttribute("data-theme", theme);
$("#dark-mode-toggle").html(icon);
localStorage.setItem("corpusTheme", theme);
}
</script>
4 changes: 4 additions & 0 deletions corpus/templates/components/general_dropdown.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<ul class="mx-2">
<li class="text-xl font-bold text-white my-2">General</li>
<li><a href="{% url 'index' %}">Home</a></li>
</ul>
4 changes: 4 additions & 0 deletions corpus/templates/components/internal_dropdown.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<ul class="mx-2">
<li class="text-xl font-bold text-white my-2">Internal</li>
<li><a href="{% url 'index' %}">Design System</a></li>
</ul>
7 changes: 7 additions & 0 deletions corpus/templates/components/navbar_dropdown.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<div class="w-max dropdown-content menu menu-sm mt-3 z-[1] p-2 shadow bg-base-100 rounded-box flex flex-row bg-primary text-primary-content mx-2 my-2 px-5 py-5">
{% include "components/general_dropdown.html" %}

{% if user.is_authenticated %}
{% include "components/internal_dropdown.html" %}
{% endif %}
</div>
9 changes: 9 additions & 0 deletions corpus/templates/components/navbar_profile_dropdown.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<ul tabindex="0"
class="menu menu-sm dropdown-content mt-3 z-[1] p-2 shadow rounded-box w-max bg-primary text-primary-content p-5">
<li class="font-bold text-white">
Welcome, {{ user.first_name }} {{ user.last_name }}!
</li>
<li><a>Profile</a></li>
<li><a>Settings</a></li>
<li><a>Logout</a></li>
</ul>
17 changes: 17 additions & 0 deletions corpus/templates/components/navbar_right.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% if user.is_authenticated %}
<div class="dropdown dropdown-end">
<div tabindex="0" class="btn btn-ghost btn-circle avatar">
<span class="material-symbols-outlined">
account_circle
</span>
</div>
{% include "components/navbar_profile_dropdown.html" %}
</div>
{% else %}
<a href="/" class="btn btn-ghost">
Login
<span class="material-symbols-outlined">
login
</span>
</a>
{% endif %}
12 changes: 12 additions & 0 deletions corpus/templates/pages/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{% extends 'base.html' %}

{% block title %}
Home
{% endblock %}

{% block content %}
<div class="container prose mx-auto px-5 my-10">
<h1>Welcome to Corpus!</h1>
<p>Corpus is IEEE NITK's tool to manage all internal and external activities of the club.</p>
</div>
{% endblock %}