Changeset - 049df7b63e18
[Not reviewed]
0 5 0
Ben Sturmfels (bsturmfels) - 2 years ago 2021-10-15 12:06:34
ben@sturm.com.au
Add mobile menu and DuckDuckGo-based search.
5 files changed with 84 insertions and 15 deletions:
0 comments (0 inline, 0 general)
www/conservancy/static/css/conservancy.css
Show inline comments
...
 
@@ -63,13 +63,15 @@ a[href$="#fixme"]:before,
 
form[action$="#fixme"]:before {
 
  border: 1px solid purple;
 
  border-radius: 2px;
 
  content: 'FIXME';
 
  font-size: 0.55rem;
 
  color: purple;
 
  border: 1px solid var(--orange);
 
  border-radius: 6px;
 
  content: '?';
 
  font-size: 0.6rem;
 
  color: var(--orange);
 
  position: absolute;
 
  top: -5px;
 
  right: -5px;
 
  top: -4px;
 
  right: -4px;
 
  padding: 1px;
 
  background: yellow;
 
  opacity: 0.8;
 
  /* opacity: 0.8; */
 
  width: 12px;
 
  text-align: center;
 
}
...
 
@@ -79,3 +81,3 @@ input:focus {
 
  border-color: #86b7fe;
 
  box-shadow: 0 0 0 .25rem rgba(13,110,253,.25);
 
  box-shadow: 0 0 0 .25rem rgb(236, 99, 67, .5);
 
};
...
 
@@ -183,2 +185,3 @@ body > header {
 
  list-style: none;
 
  text-transform: uppercase;
 
  padding: 0;
...
 
@@ -228,2 +231,3 @@ body > header {
 
  min-width: 15rem;
 
  text-transform: none;
 
}
...
 
@@ -242,2 +246,35 @@ body > header {
 

	
 
#menu-icon:active, #search-icon:active {
 
  transform: scale(1.1);
 
}
 
#navbar-outer { min-height: .5rem; }
 
#navbar.mobile {
 
  display: block;
 
  max-width: 32rem;
 
}
 
#navbar.mobile.search { display: block; }
 
#navbar.mobile li {
 
  display: block;
 
}
 
#navbar.mobile ul {
 
  padding-left: .5rem;
 
  padding-right: .5rem;
 
  display: block !important;
 
  position: relative !important;
 
  top: auto !important;
 
  left: 0 !important;
 
  right: auto !important;
 
  text-align: left !important;
 
}
 
#navbar.mobile > ul > li {
 
  padding-top: .5rem;
 
  padding-bottom: .5rem;
 
}
 
#navbar.mobile > ul > li {
 
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
 
}
 
#navbar.mobile li ul {
 
  margin-left: .5rem;
 
}
 

	
 

	
www/conservancy/static/img/font_awesome.svg
Show inline comments
...
 
@@ -24,2 +24,11 @@ License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL
 
  </symbol>
 
  <symbol id="bars" viewBox="0 0 448 512">
 
    <path fill="currentColor" d="M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"></path>
 
  </symbol>
 
  <symbol id="heart" viewBox="0 0 512 512">
 
    <path fill="currentColor" d="M462.3 62.6C407.5 15.9 326 24.3 275.7 76.2L256 96.5l-19.7-20.3C186.1 24.3 104.5 15.9 49.7 62.6c-62.8 53.6-66.1 149.8-9.9 207.9l193.5 199.8c12.5 12.9 32.8 12.9 45.3 0l193.5-199.8c56.3-58.1 53-154.3-9.8-207.9z"></path>
 
  </symbol>
 
  <symbol id="search" viewBox="0 0 512 512">
 
    <path fill="currentColor" d="M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"></path>
 
  </symbol>
 
</svg>
www/conservancy/static/js/conservancy.js
Show inline comments
...
 
@@ -102,2 +102,9 @@ $(document).ready(function() {
 
    }).filter(':checked').trigger('change', 0);
 

	
 
    function toggleMenu(event) {
 
        $('#navbar').toggleClass('mobile');
 
        $('#search-query').focus();
 
    }
 
    $('#menu-icon').on('click', toggleMenu);
 
    $('#search-icon').on('click', toggleMenu);
 
});
www/conservancy/templates/base_conservancy.html
Show inline comments
...
 
@@ -41,5 +41,11 @@
 
        <div class="w-40-ns mt2 mt4-ns mb2 mb2-ns mh2 pt1 flex flex-wrap justify-center items-center">
 
          <span id="menu-icon" class="dn-ns ph2 pointer">
 
            <svg style="color: var(--orange); width: 30px; height: 30px;"><use href="{% static 'img/font_awesome.svg' %}#bars"></use></svg>
 
          </span>
 
          <a href="/donate/" class="f5 mh1 mv1 ph2 pv1 ttu b btn-orange">Donate</a>
 
          <a href="/sustainer/" class="f5 mh1 mv1 ph2 pv1 ttu b btn-orange">Join</a>
 
          <a href="#fixme" class="f5 mh1 mv1 ph2 pv1 mr2 ttu b btn-white">Special</a>
 
          <a href="#fixme" class="f5 mh1 mv1 ph2 pv1 ttu b btn-white">Special</a>
 
          <span id="search-icon" class="dib ph2 pointer">
 
            <svg style="color: var(--orange); width: 30px; height: 30px;"><use href="{% static 'img/font_awesome.svg' %}#search"></use></svg>
 
          </span>
 
        </div>
...
 
@@ -48,5 +54,5 @@
 

	
 
    <div id="navbar-outer" class="mb2">
 
      <div id="navbar" class="center mw8 nested-list-resetb">
 
        <ul class="f5 b ttu flex flex-wrap justify-center">
 
    <div id="navbar-outer" class="mt2 mt0-ns mb2">
 
      <div id="navbar" class="center mw8 nested-list-resetb dn db-ns">
 
        <ul class="f5 ttu flex flex-wrap justify-center">
 
          <!-- Remaining previous menu items
...
 
@@ -56,4 +62,13 @@
 

	
 
          <li class="search dn-ns">
 
            <form method="get" action="https://duckduckgo.com" class="ml2 flex mw6">
 
              <input id="search-query" type="text" name="q" placeholder="Search with DuckDuckGo" class="pa2 ba b--gray br0" style="x-border-right: none; flex: 1 1 auto; width: 1%;" />
 
              <input type="hidden" name="sites" value="sfconservancy.org" />
 
              <button type="submit" class="bg-orange bn white pa2 pointer btn-orange" style="margin-left: -1px;">
 
                <svg style="color: white; width: 20px; height: 20px;"><use href="{% static 'img/font_awesome.svg' %}#search"></use></svg></a>
 
              </button>
 
    </form>
 
          </li>
 
          <li class="home dn db-ns"><a href="/">Home</a></li>
 
          <li class="what"><a href="#fixme">What <span class="dn di-ns">we do</span></a>
 
          <li class="what"><a href="#fixme">What we do</a>
 
            <ul>
...
 
@@ -66,3 +81,3 @@
 
          </li>
 
          <li class="who"><a href="#fixme">Who <span class="dn di-ns">we are</span></a>
 
          <li class="who"><a href="#fixme">Who we are</a>
 
            <ul>
www/conservancy/templates/frontpage.html
Show inline comments
...
 
@@ -16,2 +16,3 @@
 
   font-size: 1em;
 
   font-style: normal;
 
   margin-top: 0;
0 comments (0 inline, 0 general)