mobile friendly now
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Thu, 4 May 2023 15:54:18 +0000 (10:54 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Thu, 4 May 2023 15:54:18 +0000 (10:54 -0500)
www/static/css/new_style.css
www/templates/pages/homepage.html
www/templates/partials/logo_svg.html [new file with mode: 0644]
www/templates/partials/navbar.html

index b7de5d8f8685757c03b9adcf37a25b7403add478..625e70ddf234aac75020d0c1a54090ec6bbfd5f6 100644 (file)
     }
 }
 
+@media (min-width: 800px) {
+    :root {
+        --default-flex-direction: row;
+        font-size: 14pt;
+    }
+}
+
+@media (max-width: 799px) {
+    :root {
+        --default-flex-direction: column;
+        font-size: 12pt;
+    }
+}
+
 body {
     background: var(--background-color);
     color: var(--foreground-color);
     
     font-family: "system-ui", sans-serif;
-    /* font-weight: lighter; */
-    font-size: 14pt;
 }
 
 a {
@@ -102,9 +114,30 @@ a:visited {
     background: var(--light-background-color);
 }
 
+@media screen and (min-width: 800px) {
+    .container .split {
+        display: flex;
+        flex-direction: row;
+        align-items: center;
+        justify-content: space-between;
+    }
+
+    .container .split.right-40 > :last-child {
+        width: 40%;
+    }
+}
+
+@media screen and (max-width: 799px) {
+    .container .split {
+        display: flex;
+        flex-direction: column;
+        justify-content: center;
+    }
+}
+
 h1 {
     min-width: 100px;
-    font-size: 36pt;
+    font-size: 2.5rem;
 }
 
 h1, h2, h3, h4, h5, h6 {
@@ -130,36 +163,46 @@ code {
 
 
 /* Nagivation */
-.navbar-container {
-    max-width: 1200px;
-    width: 1200px;
-    margin: 0 auto;
+@media screen and (min-width: 1200px) {
+    .navbar-container {
+        max-width: 1200px;
+        width: 1200px;
+        margin: 0 auto;
+    }
+}
+
+@media screen and (max-width: 1199px) {
+    .navbar-container {
+        width: 100%;
+        margin: 0 auto;
+    }
 }
 
+
 navbar {
     background: var(--background-color);
     color: var(--foreground-color);
     padding: 0 12px;
 
     display: flex;
-    flex-direction: row;
+    flex-direction: var(--default-flex-direction);
     justify-content: space-between;
     align-items: center;
 }
 
 navbar div {
     display: flex;
-    flex-direction: row;
+    flex-direction: var(--default-flex-direction);
     justify-content: center;
     align-items: center;
 }
 
-navbar span {
+navbar span {
     display: inline-block;
     padding: 12px 24px;
 }
 
-navbar span:hover {
+navbar span:hover {
     cursor: pointer;
     background-color: var(--light-background-color);
 }
@@ -173,11 +216,54 @@ navbar a {
     text-decoration: none;
 }
 
+@media (min-width: 1200px) {
+    #mobile-hamburger, .hamburger-piece {
+        display: none;
+    }
+}
+
+@media (max-width: 1199px) {
+    navbar div {
+        display: none;
+    }
+
+    navbar #mobile-hamburger:checked ~ div {
+        display: flex;
+    }
+
+    #mobile-hamburger {
+        opacity: 0%;
+        width: 32px;
+        height: 20px;
+        z-index: 100;
+        position: absolute;
+        right: 10px;
+        top: 10px;
+    }
+    
+    .hamburger {
+        position: absolute;
+        top: 10px;
+        right: 10px;
+    }
+
+    .hamburger-piece {
+        background-color: var(--foreground-color);
+        margin-bottom: 4px;
+        height: 4px;
+        width: 32px;
+        display: block;
+        border-radius: 3px;
+    }
+}
+
 
 /* Footer */
 .footer-container {
+    position: sticky;
+    bottom: 0;
     display: flex;
-    flex-direction: row;
+    flex-direction: var(--default-flex-direction);
 }
 
 .footer-container > * {
@@ -192,10 +278,9 @@ navbar a {
 
 
 
-
 .panel-container {
     display: flex;
-    flex-direction: row;
+    flex-direction: var(--default-flex-direction);
     justify-content: space-between;
     width: 100%;
     gap: 24px;
@@ -221,8 +306,6 @@ navbar a {
 
 main {
     min-height: 100vh;
-    display: grid;
-    grid-template-rows: auto 1fr auto;
 }
 
 main pre {
@@ -230,6 +313,13 @@ main pre {
     box-shadow: 0px 1px 10px 1px rgba(0, 0, 0, 0.2);
     padding: 8px;
     display: block;
+    overflow-y: scroll;
+    overflow-x: scroll;
+}
+
+pre code {
+    overflow-y: scroll;
+    overflow-x: scroll;
 }
 
 main blockquote {
@@ -243,9 +333,35 @@ main li {
     margin-top: 8px;
 }
 
-#logo:hover #path67 { transform: matrix(0.147954, 0, 0, 0.147954, 35, 9); }
-#logo:hover #path31 { transform: translate(21.5px, -2.5px) rotate(60deg); }
-#logo:hover #path1180 { transform: translate(34.25px, 7px) rotate(120deg); }
-#logo:hover #path537 { transform: translate(51.5px, 11.01px) rotate(150deg); }
-#logo:hover #path1062 { transform: translate(36px, 2px) rotate(90deg); }
-#logo :not(#layer2) path { transition: all 1s ease-in-out; }
+@media (min-width: 800px) {
+    #desktop_logo {
+        position: relative;
+        top: 6px;
+        width: 200px;
+    }
+
+    #mobile_logo {
+        display: none;
+    }
+
+    #desktop_logo:hover #path67      { transform: matrix(0.147954, 0, 0, 0.147954, 35, 9); }
+    #desktop_logo:hover #path31      { transform: translate(21.5px, -2.5px) rotate(60deg); }
+    #desktop_logo:hover #path1180    { transform: translate(34.25px, 7px) rotate(120deg); }
+    #desktop_logo:hover #path537     { transform: translate(51.5px, 11.01px) rotate(150deg); }
+    #desktop_logo:hover #path1062    { transform: translate(36px, 2px) rotate(90deg); }
+    #desktop_logo :not(#layer2) path { transition: all 1s ease-in-out; }
+}
+
+@media (max-width: 799px) {
+    #mobile_logo {
+        position: relative;
+        top: 6px;
+        width: 50px;
+        height: 50px;
+    }
+
+    #desktop_logo {
+        display: none;
+    }
+}
+
index 2e18fdcb69218f15c3de3bfb71ca09dc69f4054c..2da5be20bcf8f71cf83de4b8c35a2362201dbce7 100644 (file)
@@ -11,7 +11,7 @@
 </div>
 
 <div class="container">
-<div style="display: flex; flex-direction: row; align-items: center; justify-content: space-between;">
+<div class="split right-40">
     <div>
         <h2>Overview</h2>
         <br />
@@ -24,7 +24,7 @@
         </ul>
     </div>
 
-    <pre class="hljs" style="overflow-y: scroll; width: 40%;"><code class="language-onyx">use core {println}
+    <pre class="hljs"><code class="language-onyx">use core {println}
 
 main :: () {
     f := factorial(10);
@@ -64,44 +64,6 @@ factorial :: (n: i32) -> i32 {
     </div>
 </div>
 
-<!--
-<div class="container light" id="install">
-<h2>Installation</h2>
-<br />
-<h3>Linux</h3>
-    <p>
-        Onyx is developed and tested on a Debian-based Linux system.
-        As I am only one developer, I can only focus on so much. Most of my efforts go towards ensuring Onyx is stable on Linux-based distributions.
-        This does include the Windows Subsystem for Linux (WSL), though that is not thoroughly tested.
-    </p>
-
-
-<div style="padding-left: 24px">
-    <h4>Debian / Ubuntu</h4>
-        <p>
-            Debian and Ubuntu will soon have the option of adding an APT repository for Onyx.
-        </p>
-
-    <h4>All Others</h4>
-        <p>
-            The best way to install Onyx on a Linux system is through directly cloning the Git repository and building it locally.
-            You may want to configure the variables at the top of <code>settings.sh</code> to suit your environment.
-        </p>
-        <pre class="container light merge" style="margin-top: 8px">
-$ git clone https://github.com/onyx-lang/onyx --depth 1
-$ cd onyx
-$ # Configure the top of `./settings.sh` for your system
-$ ./build.sh</pre>
-</div>
-
-<h3>Windows</h3>
-
-<h3>MacOS</h3>
-    <p>Currently, Onyx is not supported on MacOS.</p>
-
-</div>
--->
-
 {{endblock}}
 
 {{extends "pages/normal_page"}}
diff --git a/www/templates/partials/logo_svg.html b/www/templates/partials/logo_svg.html
new file mode 100644 (file)
index 0000000..fec6d7e
--- /dev/null
@@ -0,0 +1,30 @@
+<g id="layer2">
+<path
+   style="stroke-width:0.109606"
+   id="path274"
+   d="m -36.54513,-42.509588 0,19.809291 a 1.9061498,1.9061498 120 0 1 -0.953075,1.650774 l -17.155348,9.904645 a 1.9061498,1.9061498 180 0 1 -1.90615,0 l -17.155349,-9.904645 a 1.9061498,1.9061498 60 0 1 -0.953075,-1.650774 l 0,-19.80929 a 1.9061498,1.9061498 120 0 1 0.953075,-1.650775 l 17.155349,-9.904645 a 1.9061498,1.9061498 180 0 1 1.906149,0 l 17.155349,9.904645 a 1.9061498,1.9061498 60 0 1 0.953075,1.650774 z"
+   transform="matrix(0.30740531,0,0,0.30372816,23.782897,16.545361)" />
+</g>
+<g id="layer1">
+<path
+   id="path31"
+   style="fill:#4d4d4d;fill-rule:evenodd;stroke-width:0.0293746"
+   d="M 11.763289,3.914572 1.3881028,9.8522703 a 0.10746311,0.10746311 90.000426 0 0 -1.4e-6,0.1865377 l 4.9883072,2.854897 A 0.32624697,0.32624697 164.99998 0 0 6.8203814,12.774742 L 11.900221,4.0525466 A 0.10062399,0.10062399 45.217132 0 0 11.763289,3.914572 Z" />
+<path
+   id="path537"
+   style="fill:#333333;fill-rule:evenodd;stroke-width:0.029419"
+   d="M 12.162827,4.0018649 6.9729475,12.886067 a 0.0504192,0.0504192 45.290639 0 0 0.068524,0.06922 l 5.1227994,-2.923284 a 0.32119605,0.32119605 120.14455 0 0 0.162004,-0.2789709 l 0,-5.7069276 a 0.08771164,0.08771164 15.146085 0 0 -0.163448,-0.044243 z" />
+<path
+   id="path1180"
+   style="fill:#999999;fill-rule:evenodd;stroke-width:0.0295315"
+   d="m 1.0890783,3.6985577 v 5.6525366 a 0.22068576,0.22068576 30.240095 0 0 0.329423,0.1920375 L 11.783187,3.6743435 a 0.08679074,0.08679074 75.240095 0 0 -0.04276,-0.1623148 l -10.4648157,0 a 0.18652896,0.18652896 135 0 0 -0.186529,0.186529 z" />
+<path
+   id="path1062"
+   style="fill:#4d4d4d;fill-rule:evenodd;stroke-width:0.029571"
+   d="M 6.4864206,0.28046515 1.4340775,3.1336232 a 0.08682156,0.08682156 75.272862 0 0 0.042693,0.1624213 H 11.967016 a 0.04985456,0.04985456 104.72714 0 0 0.02452,-0.093265 L 6.8167272,0.28046515 a 0.33586257,0.33586257 6.6844583e-7 0 0 -0.3303066,0 z" />
+<path
+   style="fill:#ffffff;stroke-width:0.109606"
+   id="path67"
+   d="m 46.304138,13.61792 -1.100363,0.615114 -1.082886,-0.645386 0.01748,-1.2605 1.100363,-0.615113 1.082886,0.645385 z"
+   transform="matrix(0.14795386,0,0,0.14795386,5.4827192,1.6710591)" />
+</g>
index 2887c9b9edb0e759d162de1de7228c4546afe14a..8e733af2e641a6223e10b52502555234b8b5a8c6 100644 (file)
@@ -2,40 +2,21 @@
 <div class="navbar-container">
     <navbar>
         <a href="/">
-            <svg width="200" height="50" viewBox="0 0 64 16" version="1.1" id="logo">
-              <g id="layer2">
-                <path
-                   style="stroke-width:0.109606"
-                   id="path274"
-                   d="m -36.54513,-42.509588 0,19.809291 a 1.9061498,1.9061498 120 0 1 -0.953075,1.650774 l -17.155348,9.904645 a 1.9061498,1.9061498 180 0 1 -1.90615,0 l -17.155349,-9.904645 a 1.9061498,1.9061498 60 0 1 -0.953075,-1.650774 l 0,-19.80929 a 1.9061498,1.9061498 120 0 1 0.953075,-1.650775 l 17.155349,-9.904645 a 1.9061498,1.9061498 180 0 1 1.906149,0 l 17.155349,9.904645 a 1.9061498,1.9061498 60 0 1 0.953075,1.650774 z"
-                   transform="matrix(0.30740531,0,0,0.30372816,23.782897,16.545361)" />
-              </g>
-              <g id="layer1">
-                <path
-                   id="path31"
-                   style="fill:#4d4d4d;fill-rule:evenodd;stroke-width:0.0293746"
-                   d="M 11.763289,3.914572 1.3881028,9.8522703 a 0.10746311,0.10746311 90.000426 0 0 -1.4e-6,0.1865377 l 4.9883072,2.854897 A 0.32624697,0.32624697 164.99998 0 0 6.8203814,12.774742 L 11.900221,4.0525466 A 0.10062399,0.10062399 45.217132 0 0 11.763289,3.914572 Z" />
-                <path
-                   id="path537"
-                   style="fill:#333333;fill-rule:evenodd;stroke-width:0.029419"
-                   d="M 12.162827,4.0018649 6.9729475,12.886067 a 0.0504192,0.0504192 45.290639 0 0 0.068524,0.06922 l 5.1227994,-2.923284 a 0.32119605,0.32119605 120.14455 0 0 0.162004,-0.2789709 l 0,-5.7069276 a 0.08771164,0.08771164 15.146085 0 0 -0.163448,-0.044243 z" />
-                <path
-                   id="path1180"
-                   style="fill:#999999;fill-rule:evenodd;stroke-width:0.0295315"
-                   d="m 1.0890783,3.6985577 v 5.6525366 a 0.22068576,0.22068576 30.240095 0 0 0.329423,0.1920375 L 11.783187,3.6743435 a 0.08679074,0.08679074 75.240095 0 0 -0.04276,-0.1623148 l -10.4648157,0 a 0.18652896,0.18652896 135 0 0 -0.186529,0.186529 z" />
-                <path
-                   id="path1062"
-                   style="fill:#4d4d4d;fill-rule:evenodd;stroke-width:0.029571"
-                   d="M 6.4864206,0.28046515 1.4340775,3.1336232 a 0.08682156,0.08682156 75.272862 0 0 0.042693,0.1624213 H 11.967016 a 0.04985456,0.04985456 104.72714 0 0 0.02452,-0.093265 L 6.8167272,0.28046515 a 0.33586257,0.33586257 6.6844583e-7 0 0 -0.3303066,0 z" />
-                <path
-                   style="fill:#ffffff;stroke-width:0.109606"
-                   id="path67"
-                   d="m 46.304138,13.61792 -1.100363,0.615114 -1.082886,-0.645386 0.01748,-1.2605 1.100363,-0.615113 1.082886,0.645385 z"
-                   transform="matrix(0.14795386,0,0,0.14795386,5.4827192,1.6710591)" />
-              </g>
+            <svg viewBox="0 0 64 16" version="1.1" id="desktop_logo">
+                {% partial "partials/logo_svg" %}
+            </svg>
+            <svg viewBox="0 0 16 16" version="1.1" id="mobile_logo">
+                {% partial "partials/logo_svg" %}
             </svg>
         </a>
 
+        <input type="checkbox" id="mobile-hamburger" />
+        <span class='hamburger'>
+            <span class='hamburger-piece'></span>
+            <span class='hamburger-piece'></span>
+            <span class='hamburger-piece'></span>
+        </span>
+
         <div>
             <a href="/"><span>Home</span></a>
             <a target="_blank" href="/playground/"><span>Try Online</span></a>