Top bar in site. Work od desktop and mobiles, missing account icon

This commit is contained in:
vlados31 2022-09-18 21:26:32 +03:00
parent 09559f0621
commit 63d40fd39e
2 changed files with 110 additions and 46 deletions

View File

@ -1,16 +1,20 @@
/* ========== THEME ========== */ /* ========== THEME ========== */
body { body {
--text-color: #222; --text-color: #111;
--brand-color: #231765;
--bkg-color: #fff; --bkg-color: #fff;
--bkg-color2: #bbb; --bkg-color2: #ccc;
--bkg-color3: #aaa;
} }
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
/* defaults to dark theme */ /* defaults to dark theme */
body { body {
--text-color: #eee; --text-color: #eee;
--brand-color: #654dea;
--bkg-color: #121212; --bkg-color: #121212;
--bkg-color2: #303030; --bkg-color2: #202020;
--bkg-color3: #353435;
} }
} }
@ -32,55 +36,98 @@ h1, p {
/* ========== MAIN STYLES ========== */ /* ========== MAIN STYLES ========== */
header, #logo-container, header nav { #header-wrapper {
display: flex;
margin: 3em 0;
}
#header-wrapper * {
color: var(--brand-color);
font-weight: bold;
}
header {
display: flex; display: flex;
flex-wrap: nowrap;
flex-direction: row; flex-direction: row;
}
header, header nav {
align-content: center;
border: 1px solid green;
}
#logo-container {
align-content: baseline; align-content: baseline;
margin: 0.5em; flex-wrap: nowrap;
}
#logo-container span {
margin: auto 0;
font-size: 32px;
}
nav {
display: flex;
flex-direction: row;
background: var(--bkg-color2);
margin: 0 auto; margin: 0 auto;
} }
nav * { header > * {
margin: auto 0.5em; margin: auto 1em;
text-decoration: none; text-decoration: none;
font-size: medium; font-size: medium;
border: 1px solid red;
} }
.header-wrapper { #logo-text {
display: flex; font-size: 32px;
flex-direction: row;
justify-content: center;
margin: 1em;
} }
header img { #logo-image {
margin-right: 2em;
width: 50px; width: 50px;
height: 50px; height: 50px;
} }
/* ========== Dropdown menu ========== */
.dropdown-button {
padding: 16px;
font-size: 16px;
border: none;
}
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: var(--bkg-color2);
min-width: 160px;
z-index: 1;
}
.dropdown-content a {
padding: 12px 16px;
text-decoration: none;
display: block;
}
.dropdown-content a:hover {
background-color: var(--bkg-color3);
}
.dropdown-wrapper:hover .dropdown-content {
display: block;
}
.dropdown-wrapper:hover .dropdown-button {
background-color: var(--bkg-color3);
}
#dropdown-in-header {
display: none;
}
@media screen and (max-width: 900px) {
#header-wrapper {
display: block;
}
header {
justify-content: space-between;
}
#dropdown-in-header {
display: block;
}
header > a {
display: none;
}
}
h1 { h1 {
text-align: center; text-align: center;

View File

@ -7,17 +7,34 @@
{% load static %} {% load static %}
<link rel="icon" type="image/webp" href="{% static 'favicon.webp' %}"> <link rel="icon" type="image/webp" href="{% static 'favicon.webp' %}">
<link rel="stylesheet" type="text/css" href="{% static 'css/style.css' %}"> <link rel="stylesheet" type="text/css" href="{% static 'css/style.css' %}">
<!-- Add icon library -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
{% block styles %} {% endblock %} {% block styles %} {% endblock %}
</head> </head>
<body> <body>
<header> <div id="header-wrapper">
<div id="logo-container"> <header>
<img src="{% static 'favicon.webp' %}" alt="logo image"> <div class="dropdown-wrapper" id="dropdown-in-header">
<span>АРКА</span> <button class="dropdown-button fa fa-bars"></button>
</div> <div class="dropdown-content">
<a href="{% url 'index' %}">Главная</a>
<a href="{% url 'index' %}">Создать заказ</a>
<a href="{% url 'index' %}">Объявления</a>
{# <a href="{% url 'index' %}">Все участники</a>#}
<!-- это осталось временно, мне нужно чтобы эти ресурсы были доступны с главной -->
<a href="{% url 'account' %}">Аккаунт</a>
<a href="{% url 'dev_index' %}">Dev</a>
<a href="{% url 'about' %}">О нас</a>
</div>
</div>
<img id="logo-image" src="{% static 'favicon.webp' %}" alt="logo image">
<span id="logo-text">АРКА</span>
<nav>
<a href="{% url 'index' %}">Главная</a> <a href="{% url 'index' %}">Главная</a>
<a href="{% url 'index' %}">Создать заказ</a> <a href="{% url 'index' %}">Создать заказ</a>
<a href="{% url 'index' %}">Объявления</a> <a href="{% url 'index' %}">Объявления</a>
@ -27,13 +44,13 @@
<a href="{% url 'account' %}">Аккаунт</a> <a href="{% url 'account' %}">Аккаунт</a>
<a href="{% url 'dev_index' %}">Dev</a> <a href="{% url 'dev_index' %}">Dev</a>
<a href="{% url 'about' %}">О нас</a> <a href="{% url 'about' %}">О нас</a>
</nav>
<nav> <div>
</nav> </div>
</header>
</div>
</header>
{% if user.is_authenticated %} {% if user.is_authenticated %}
Добро пожаловать, {{ user.name }} {{ user.surname }}<br> Добро пожаловать, {{ user.name }} {{ user.surname }}<br>