diff --git a/app/app/urls.py b/app/app/urls.py index 6b2b8f2f10d..808279b4a89 100644 --- a/app/app/urls.py +++ b/app/app/urls.py @@ -181,6 +181,7 @@ re_path(r'^about/?', retail.views.about, name='about'), re_path(r'^mission/?', retail.views.mission, name='mission'), re_path(r'^vision/?', retail.views.vision, name='vision'), + re_path(r'^styleguide-alpha/?', retail.views.ui, name='ui'), re_path(r'^results/?(?P.*)/?', retail.views.results, name='results_by_keyword'), re_path(r'^results/?', retail.views.results, name='results'), re_path(r'^activity/?', retail.views.activity, name='activity'), diff --git a/app/assets/v2/css/rain.css b/app/assets/v2/css/rain.css index 21400bc4b92..2ceec7dda4b 100644 --- a/app/assets/v2/css/rain.css +++ b/app/assets/v2/css/rain.css @@ -38,6 +38,10 @@ background: #f1e1e1; } +.rain.purple { + background-color: var(--gc-purple); +} + .rain:nth-of-type(1) { animation-name: rain-1; animation-delay: 3s; diff --git a/app/assets/v2/css/tabs.css b/app/assets/v2/css/tabs.css new file mode 100644 index 00000000000..74045293836 --- /dev/null +++ b/app/assets/v2/css/tabs.css @@ -0,0 +1,50 @@ + +.tab-container { + position: relative; + display: block; + text-align: center; +} + +.tab-container > button { + margin: 0 5px; +} + +.section-tab { + background: transparent; + outline: none; + border: none; + cursor: pointer; + color: var(--gc-purple); + padding: 0; +} + +.tab-indicator { + display: block; + height: 5px; + width: 20px; + background: var(--gc-blue); + transition: transform .3s, left .3s; +} + +.section-tab:hover, +.section-tab:active, +.section-tab:focus { + color: var(--gc-blue) !important; +} + +.section-tab.active { + color: var(--gc-blue); +} + +.tab-sections { + width: 100%; + position: relative; + transition: transform .3s; +} + +.tab-section { + width: 100%; + padding: 0 2rem; + margin: 0 1rem; + flex-shrink: 0; +} diff --git a/app/assets/v2/js/pages/tabs.js b/app/assets/v2/js/pages/tabs.js new file mode 100644 index 00000000000..d5ffa1dca4f --- /dev/null +++ b/app/assets/v2/js/pages/tabs.js @@ -0,0 +1,38 @@ + +function setupTabs(name) { + var indicator = document.querySelector(name + '.tab-indicator'); + var container = indicator.parentElement.parentElement; + var sections = container.querySelector(name + '.tab-sections'); + var buttons = indicator.previousElementSibling; + var firstButton = null; + var last = null; + + function onClick(evt) { + var width = evt.target.offsetWidth; + var offset = evt.target.offsetLeft; + var section = sections.querySelector('#' + evt.target.id); + + indicator.style.width = width + 'px'; + indicator.style.transform = 'translateX(' + offset + 'px)'; + + if (last) { + last.className = last.className.replace(' active', ''); + } + + evt.target.className += ' active'; + offset = -section.offsetLeft; + sections.style.transform = 'translateX(' + offset + 'px)'; + last = evt.target; + } + + while (buttons !== null) { + buttons.addEventListener('click', onClick, false); + + firstButton = buttons; + buttons = buttons.previousElementSibling; + if (buttons === null) { + // initial setup + onClick({ target: firstButton }); + } + } +} diff --git a/app/retail/templates/ui_inventory.html b/app/retail/templates/ui_inventory.html new file mode 100644 index 00000000000..8137133897a --- /dev/null +++ b/app/retail/templates/ui_inventory.html @@ -0,0 +1,442 @@ +{% comment %} +Copyright (C) 2018 Gitcoin Core + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published +by the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not,see +. + +{% endcomment %} +{% load i18n static %} + + + {% include 'shared/head.html' %} + + + + + + {% include 'shared/tag_manager_2.html' %} +
+ {% include 'shared/minihero.html' with h1='UI Inventory' position_h1_below_logo=1 %} +
+ + + + +
+
+

{% trans "Buttons" %}

+
+

btn btn-gc-..

+
+ + ..blue + +
+
+ + ..purple + +
+
+ + ..green + +
+
+ +
+

btn btn-outline-gc-..

+
+ + ..blue + +
+
+ + ..purple + +
+
+ + ..green + +
+
+ +
+

btn btn-..

+
+ + ..info + +
+
+ + ..warning + +
+
+ + ..success + +
+
+ +
+

btn btn-gc-purple pulseButton

+
pulseButton
+
+
+ +
+

+ {% trans "Colors" %} +

+
+

text-highlight-purple

+

text-highlight-green

+

text-highlight-dark-blue

+

text-highlight-gc-purple

+

text-highlight-gc-blue

+

text-highlight-light-blue

+

text-highlight-pink

+
+
+ class="card p-1 bg-dark text-highlight-green" +

text-light

+
+
+ class="card p-1 bg-light text-highlight-green" +

text-dark

+
+
class="card p-1 bg-white text-highlight-green"
+
+ +
+

Typography

+
+

h1

+

h2

+

h3

+

h4

+

h5

+

h6

+
+ +
+

font-title-lg

+

font-title

+

font-header

+

font-subheader

+

font-body

+

font-caption

+
+ +
+

font-bigger-1

+

font-bigger-2

+

font-bigger-3

+

font-bigger-4

+
+ +
+

font-smaller-1

+

font-smaller-2

+

font-smaller-3

+

font-smaller-4

+

font-smaller-5

+

font-smaller-6

+

font-smaller-7

+
+
+ +
+

Tabs

+
+ + + +
+
+ +
+
+
+
+

One

+
+
+
+
+
+
+

Two

+
+
+
+
+
+
+

Three

+
+
+
+
+
+ +
+

{% trans "Carousel" %}

+ +
+ +
+

{% trans "Forms" %}

+
+ + + +
+ + +
+ +
+
+
+
+ + +
+
+ +
+

{% trans "Banner" %}

+
+
+
+ {% trans "info" %} +
+
+ × +
+
+
+
+ {% trans "warning" %} +
+
+ × +
+
+
+
+ {% trans "error" %} +
+
+ × +
+
+ +
+

{% trans "Animations" %}

+
+
+
+ +
+
+
+
+ +
+
+
+ +

{% trans "Other whole page animations" %}

+

include 'shared/rain.html' with class="purple"

+ {% include 'shared/rain.html' with class="purple" %} + + +
+ +
+

{% trans "Other Elements" %}

+
+

progress-bar

+ + + +
+
+

{% trans "Quotes" %} | waitingRoomEntertainment()

+

+

+
+
+ +
+

{% trans "Header" %}

+

include 'shared/minihero.html' with h1='shared/minihero.html'

+
+ {% include 'shared/minihero.html' with h1='shared/minihero.html' %} +
+

include 'shared/hero.html'

+
+ {% include 'shared/hero.html' %} +
+
+ +
+

{% trans "Modal Dialog" %}

+ +
+ +
+

{% trans "Vector Graphics" %}

+ {% for svg in svgs %} + + {% endfor %} +
+ +
+

{% trans "Animated Static Assets" %}

+ {% for gif in gifs %} + + {% endfor %} +
+ +
+

{% trans "Static Assets" %}

+ {% for png in pngs %} + + {% endfor %} +
+
+ + {% include 'shared/footer.html' %} + {% include 'shared/analytics.html' %} + {% include 'shared/footer_scripts.html' with slideDurationInMs=3000 %} + {% include 'shared/rollbar.html' %} + {% include 'shared/messages.html' %} + + + + + + + + diff --git a/app/retail/views.py b/app/retail/views.py index d1cb62223be..1c4c66ff476 100644 --- a/app/retail/views.py +++ b/app/retail/views.py @@ -16,6 +16,8 @@ along with this program. If not, see . ''' +from os import walk as walkdir + from django.contrib.staticfiles.templatetags.staticfiles import static from django.core.exceptions import ValidationError from django.core.paginator import Paginator @@ -1020,3 +1022,32 @@ def tokens(request): key = f"{network}_tokens" context[key] = Token.objects.filter(network=network, approved=True) return TemplateResponse(request, 'tokens_js.txt', context, content_type='text/javascript') + + +def ui(request): + svgs = [] + pngs = [] + gifs = [] + for path, dirs, files in walkdir('assets/v2/images'): + if path.find('/avatar') != -1: + continue + for f in files: + if f.endswith('.svg'): + svgs.append(f'{path[7:]}/{f}') + continue + if f.endswith('.png'): + pngs.append(f'{path[7:]}/{f}') + continue + if f.endswith('.gif'): + gifs.append(f'{path[7:]}/{f}') + continue + + context = { + 'is_outside': True, + 'active': 'ui_inventory ', + 'title': 'UI Inventory', + 'svgs': svgs, + 'pngs': pngs, + 'gifs': gifs, + } + return TemplateResponse(request, 'ui_inventory.html', context) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 83c712ab351..f28727d4ff7 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -74,6 +74,10 @@ User facing copy / text should be run through [Django Translation Framework](htt 4. each of the models `help_text`s are internationalized 5. as are all the emails in `marketing/mails.py` +Take a look at `/styleguide-alpha` (ui_inventory.html), for a quick reference of user interface components. +If you are contributing user-facing assets, interface components or other relevant visuals, +then please add them to our UI Inventory page. + ### Step 1: Fork Fork the project [on GitHub](https://github.com/gitcoinco/web) and clone your