Redesign navbar and landing page

This commit is contained in:
Markus Wang Halvorsen 2017-11-13 13:21:51 +01:00
parent 518ee8baf2
commit c6cd02486d
4 changed files with 229 additions and 276 deletions

View File

@ -1,22 +1,20 @@
<?php <?php
function navbar($depth, $active = NULL) { function navbar($depth, $active = NULL) {
$result = "\n\t<ul>\n"; $result = "<ul>\n";
$menuItems = [ $menuItems = [
'hjem' => '', 'hjem' => '',
'kalender' => 'kalender', 'kalender' => 'kalender',
'aktiviteter' => 'aktiviteter', 'aktiviteter' => 'aktiviteter',
'prosjekter' => 'prosjekt', 'prosjekter' => 'prosjekt',
'kontakt' => 'kontakt', 'kontakt' => 'kontakt',
'wiki' => 'pvv', 'wiki' => 'pvv'
]; ];
foreach($menuItems as $caption => $link) { foreach($menuItems as $caption => $link) {
$result .= "\t\t<li" . ($active === $link ? ' class="active"' : '') . '>' $result .= "\t\t\t<a href=\"" . rtrim(str_repeat('../', $depth) . $link, '/') . "/\"" . ($active === $link ? ' class="active"' : '') . ">"
. '<a href="' . rtrim(str_repeat('../', $depth) . $link, '/') . '/">' . "<li>" . $caption . "</li></a>\n"
. $caption
. "</a></li>\n"
; ;
} }
return $result . "\t</ul>\n"; return $result . "\t\t</ul>\n";
} }
function loginBar($sp = 'default-sp') { function loginBar($sp = 'default-sp') {
@ -27,9 +25,9 @@ function loginBar($sp = 'default-sp') {
$attr = $as->getAttributes(); $attr = $as->getAttributes();
if($attr) { if($attr) {
$uname = $attr['uid'][0]; $uname = $attr['uid'][0];
$result .= "\t<p class=\"login\">logget inn som: " . htmlspecialchars($uname) . "</p>\n"; $result .= "\t\t<p class=\"login\">logget inn som: " . htmlspecialchars($uname) . "</p>\n";
} else { } else {
$result .= "\t<a class=\"login\" href=\"" . htmlspecialchars($as->getLoginURL()) . "\">logg inn</a>\n"; $result .= "\t\t<a class=\"login\" href=\"" . htmlspecialchars($as->getLoginURL()) . "\">logg inn</a>\n";
} }
return $result; return $result;

49
www/css/landing.css Normal file
View File

@ -0,0 +1,49 @@
header {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
margin-top: 50px;
padding: 2em 0;
width: 100vw;
height: 40vh;
background-color: #002244;
color: #fff;
}
header img {
width: 30vh;
height: 30vh;
}
main {
margin-top: 0;
}
.intro {
text-align: center;
}
.essentials {
margin: 1.8em 0;
padding: .2em 0;
list-style: none;
display: flex;
justify-content: center;
align-items: center;
}
.essentials li {
display: inline-block;
}
.essentials a {
margin: 0 2em;
height: 100%;
}
.essentials .join {
padding: 1em;
font-size: 1.2em;
}

View File

@ -1,216 +1,119 @@
nav ul { body {
overflow-y: scroll;
overflow-x: hidden;
}
* {
font-style: -apple-system, 'avenir next', avenir, roboto, noto, ubuntu, 'helvetica neue', helvetica, arial, sans-serif;
}
nav {
position: fixed; position: fixed;
z-index: 99;
top: 0; top: 0;
left: 0; width: 100vw;
right: 0; height: 50px;
margin: .1em auto 0 auto; background-color: #002244;
text-align: center;
background: rgba(255,255,255,.8);
margin: 0;
z-index: 3;
}
nav li {
display: inline-block;
line-height: 3em;
margin: auto 1em;
}
nav a {
display: inline-block;
margin: auto;
color: gray;
text-decoration: none;
}
nav li.active a {
color: #048;
}
nav .login{
position: fixed;
top: .8em;
right: .8em;
margin: auto;
z-index: 3;
color: gray;
}
header {
margin-top: 3rem;
height: 16rem;
overflow: hidden; overflow: hidden;
text-align: right;
color: #fff; box-shadow: 0 0 5px #000;
font-family: monospace;
padding: 1rem;
font-size: 4em;
background: url('pvv-background.png') no-repeat 1% 50% #024;
background-size: contain;
} }
main {
max-width: 60rem; nav * {
margin: -7rem auto 0 auto; background-color: #002244;
color: #fff;
margin: 0;
padding: 0; padding: 0;
} }
article {
padding: .1rem 1rem 1rem 1rem;
margin: 0 1rem 0 1rem;
background: white;
z-index: 2; nav h2 {
position: relative; display: inline-block;
} position: fixed;
article p { top: 0;
text-align: justify; margin-left: .65em;
hyphens: auto;
} line-height: 5vh;
article:first-child {
border-radius: .5rem .5rem 0 0; color: #002244;
}
main:before {
content: " ";
display: block;
position: absolute;
top: 16rem;
left: 1rem;
right: 1rem;
margin: 0 auto;
height: 8em;
z-index: 1;
max-width: 58rem;
box-shadow: 0 -.2rem .15rem rgba(0,0,0,.3);
border-radius: 0 0 .3em .3em;
background: white;
} }
.split { nav img{
width: 50px;
height: 50px;
}
nav ul {
display: table; display: table;
width: 100%;
table-layout: fixed; table-layout: fixed;
border-spacing: 1em; position: fixed;
top: 0;
left: 15vw;
right: 15vw;
width: 70vw;
height: 50px;
list-style: none;
} }
.split > * {
nav a {
display: table-cell; display: table-cell;
} height: 100%;
margin: 0;
.subtitle {
font-weight: bold;
}
.ruler {
border: none;
border-bottom: 1px dotted rgba(0,0,0,.5);
}
a.btn {
text-decoration: none; text-decoration: none;
border: 1px solid #048; font-size: 1.2em;
color: #048;
padding: .2em 1em;
border-radius: .2em;
white-space: nowrap;
display: inline-block;
margin-bottom: .25em;
}
a.btn:hover {
border-color: #084;
background: #eee;
color: #084;
}
a.btn:active {
border-color: #084;
background: #084;
color: white;
}
.boxinput {
text-decoration: none;
border: 1px solid #048;
color: #048;
padding: .2em .4em;
border-radius: .2em;
display: inline-block;
margin-bottom: .25em;
resize: none;
}
.noborder {
border: none !important;
}
.subnote {
margin-top: 0;
color: gray;
font-size: .7em;
font-style: italic;
}
.no-chin {
margin-bottom: 0;
}
.icon.subscribe {
color: white;
background: #082;
border-radius: 1em;
width: 1em;
line-height: 1em;
text-align: center; text-align: center;
line-height: 48px;
border-bottom: 2px solid rgba(255, 255, 255, 0);
transition: border-bottom .3s ease;
} }
@media screen and (max-width: 50rem) { nav a:hover {
.split, .split > * { border-bottom: 2px solid rgba(255, 255, 255, 1);
display: block;
} transition: border-bottom .3s ease;
img.float-right {
display: none;
}
nav li {
margin: auto .5em;
}
header {
font-size: 2em;
}
main {
margin: -13rem auto 0 auto;
}
article {
margin: 0 .5rem 0 .5rem;
}
main:before {
left: .5rem;
right: .5rem;
}
}
@media screen and (max-width: 23rem) {
body {
font-size: 0.8em;
}
header {
margin-top: 2.4rem;
}
main:before {
top: 13rem;
height: 13em;
}
} }
nav a.active {
border-bottom: 2px solid rgba(255, 255, 255, 1);
transition: none;
.collapsable {
display: none;
}
.collapsable:target {
display: block;
} }
.noselect { nav .login {
/* iOS Safari */ position: fixed;
-webkit-touch-callout: none; top: 0;
/* Safari */ right: 0;
-webkit-user-select: none; height: 48px;
/* Konqueror HTML */ padding: 0 1em;
-khtml-user-select: none;
/* Firefox */
-moz-user-select: none;
/* Internet Explorer/Edge */
-ms-user-select: none;
/* Non-prefixed version, currently supported by Chrome and Opera */
user-select: none;
} }
main {
padding: 1em 15vw;
height: 100vh;
margin-top: 5vh;
background-color: #fff;
}
main h2 {
color: #002244;
}
.btn {
padding: .5em;
border-radius: 4px;
text-decoration: none;
color: #fff;
background-color: #002244;
transition: background-color .2s ease;
}
.btn:hover {
background-color: #00407F;
transition: background-color .2s ease;
}

View File

@ -14,84 +14,87 @@ $agenda = new \pvv\side\Agenda([
new \pvv\side\DBActivity($pdo), new \pvv\side\DBActivity($pdo),
]); ]);
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="no"> <html lang="no">
<title>Programvareverkstedet</title> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Programvareverkstedet</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="css/normalize.css"> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<link rel="stylesheet" href="css/style.css"> <link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/splash.css"> <link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/splash.css">
<link rel="stylesheet" href="css/landing.css">
</head>
<header>Program&shy;vare&shy;verk&shy;stedet</header> <body>
<nav>
<?php echo navbar(0, ''); ?>
<?php echo loginbar(); ?>
</nav>
<main> <header>
<img src="css/pvv-background.png"/>
<h2>Velkommen til Programvareverkstedet</h2>
</header>
<article class="threed"> <main>
<img src="pvv-logo.png" class="float-right"> <div class="intro">
<h2>Velkommen til Program&shy;vare&shy;verk&shy;stedet</h2> <h2>Velkommen til Program&shy;vare&shy;verk&shy;stedet</h2>
<p>Programvareverkstedet (PVV) vil skape et miljø for datainteresserte personer tilknyttet universitetet. Nåværende og tidligere studenter ved NTNU, samt ansatte ved NTNU og tilstøtende miljø, kan bli medlemmer. </p> <p>Programvareverkstedet (PVV) er en studentorganisasjon ved NTNU som vil skape et miljø for datainteresserte personer tilknyttet universitetet. Nåværende og tidligere studenter ved NTNU, samt ansatte ved NTNU og tilstøtende miljø, kan bli medlemmer.</p>
<p> <ul class="essentials">
<a class="btn" href="om/">Om PVV</a> <a class="btn" href="om/"><li>Om PVV</li></a>
<a class="btn join" href="paamelding/"><li>Bli medlem</li></a>
<a class="btn" href="https://use.mazemap.com/?v=1&amp;left=10.4032&amp;right=10.4044&amp;top=63.4178&amp;bottom=63.4172&amp;campusid=1&amp;zlevel=2&amp;sharepoitype=point&amp;sharepoi=10.40355%2C63.41755%2C2&amp;utm_medium=longurl"><li>Veibeskrivelse</li></a>
</ul>
</div>
<h2>Kommende arrangement</h2>
<ul class="calendar-events">
<?php $counter1 = 0; ?>
<?php $counter2 = 0; ?>
<?php foreach($agenda->getNextDays() as $period => $events) if ($events && $counter1 < 2 && $counter2 < 10) { $counter1++ ?>
<li>
<p><?= $translation[$period] ?></p>
<ul>
<?php foreach($events as $event) { $counter2++ ?>
<li>
<a href="<?= htmlspecialchars($event->getURL()) ?>"><?= $event->getName(); ?></a>
<?php /* <a class="icon subscribe">+</a> */ ?>
<?php if ($period !== \pvv\side\Agenda::TODAY) {
echo '<span class="time">' . $event->getStart()->format('H:i') . '</span>';
if (\pvv\side\Agenda::isThisWeek($event->getStart()) || $event->getStart()->sub(new DateInterval('P3D'))->getTimestamp() < time()) {
echo '<span class="date">' . strftime('%a', $event->getStart()->getTimestamp()) . '</span>';
} else {
echo '<span class="date">' . strftime('%e. %b', $event->getStart()->getTimestamp()) . '</span>';
}
} else {
echo '<span class="time">' . $event->getStart()->format('H:i') . '</span>';
}
?>
</li>
<?php } ?>
</ul>
</li>
<?php } ?>
</ul>
<p><a class="btn" href="kalender/">Flere aktiviteter</a></p>
<h2>Opptak</h2>
<p>
Alle med tilknytning til NTNU kan bli medlem hos oss
og benytte seg av våre ressurser.
<!--
For å bli med i våre prosjekter og komitéer du søke.
-->
</p>
<p>
<a class="btn" href="paamelding/">Bli medlem</a> <a class="btn" href="paamelding/">Bli medlem</a>
<a class="btn" href="https://use.mazemap.com/?v=1&amp;left=10.4032&amp;right=10.4044&amp;top=63.4178&amp;bottom=63.4172&amp;campusid=1&amp;zlevel=2&amp;sharepoitype=point&amp;sharepoi=10.40355%2C63.41755%2C2&amp;utm_medium=longurl">Veibeskrivelse</a> <!--
</p> <a class="btn" href="prosjekt/">Søk prosjekt</a>
</article> <a class="btn" href="prosjekt/">Søk komité</a>
-->
<div class="split"> </p>
<article> </main>
<h2>Kommende arrangement</h2> </body>
<ul class="calendar-events"> </html>
<?php $counter1 = 0; ?>
<?php $counter2 = 0; ?>
<?php foreach($agenda->getNextDays() as $period => $events) if ($events && $counter1 < 2 && $counter2 < 10) { $counter1++ ?>
<li>
<p><?= $translation[$period] ?></p>
<ul>
<?php foreach($events as $event) { $counter2++ ?>
<li>
<a href="<?= htmlspecialchars($event->getURL()) ?>"><?= $event->getName(); ?></a>
<?php /* <a class="icon subscribe">+</a> */ ?>
<?php if ($period !== \pvv\side\Agenda::TODAY) {
echo '<span class="time">' . $event->getStart()->format('H:i') . '</span>';
if (\pvv\side\Agenda::isThisWeek($event->getStart()) || $event->getStart()->sub(new DateInterval('P3D'))->getTimestamp() < time()) {
echo '<span class="date">' . strftime('%a', $event->getStart()->getTimestamp()) . '</span>';
} else {
echo '<span class="date">' . strftime('%e. %b', $event->getStart()->getTimestamp()) . '</span>';
}
} else {
echo '<span class="time">' . $event->getStart()->format('H:i') . '</span>';
}
?>
</li>
<?php } ?>
</ul>
<?php } ?>
</ul>
<p><a class="btn" href="kalender/">Flere aktiviteter</a></p>
</article>
<article>
<h2>Opptak</h2>
<p>
Alle med tilknytning til NTNU kan bli medlem hos oss
og benytte seg av våre ressurser.
<!--
For å bli med i våre prosjekter og komitéer du søke.
-->
</p>
<p>
<a class="btn" href="paamelding/">Bli medlem</a>
<!--
<a class="btn" href="prosjekt/">Søk prosjekt</a>
<a class="btn" href="prosjekt/">Søk komité</a>
-->
</p>
</article>
</div>
</main>
<nav>
<?php echo navbar(0, ''); ?>
<?php echo loginbar(); ?>
</nav>