Skip to content

Commit

Permalink
[Waste] SVG inline images.
Browse files Browse the repository at this point in the history
  • Loading branch information
dracos committed Jun 21, 2024
1 parent 23ca00c commit 1615200
Show file tree
Hide file tree
Showing 42 changed files with 514 additions and 37 deletions.
16 changes: 16 additions & 0 deletions docs/_includes/waste/box.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions docs/_includes/waste/communal.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions docs/_includes/waste/sack-stripe.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions docs/_includes/waste/sack.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 46 additions & 0 deletions docs/_includes/waste/wheelie.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/_layouts/wasteworks.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
<li><a href="/ww-manual/admin-tasks/#site-message">Displaying a site message</a>
</ul>
</li>
<li><a href="/ww-manual/container-picture-generator/">Container picture generator</a></li>
</ul>
</nav>
</div>
Expand Down
105 changes: 105 additions & 0 deletions docs/ww-manual/container-picture-generator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
---
layout: wasteworks
title: What is WasteWorks
order: 1
user-guide: true
category: user-guide
---

<style>
svg { max-width: 100%; height: auto; }
</style>

# Container picture generator

This can be used to test/pick colours to use as WasteWorks container icons on a bin day page.

<div style="display:flex; gap: 1em; flex: 1">
<div>

<h2>Sack</h2>

<p><label>Sack colour: <input type="color" value='#333333' name="sack-colour" data-picture='svgsack' data-style='--primary-color'></label></p>

{% capture svg %}
{% include waste/sack.svg %}
{% endcapture %}

<div class="svg-wrapper" style="--primary-color: #333333" id="svgsack">{{ svg }}</div>

</div>
<div>

<h2>Sack, with stripe</h2>

<p><label>Stripe colour: <input type="color" value='#4f4cf0' name="stripe-colour" data-picture='svgstripe' data-style="--primary-color"></label></p>

{% capture svg %}
{% include waste/sack-stripe.svg %}
{% endcapture %}

<div class="svg-wrapper" style="--primary-color: #4f4cf0" id="svgstripe">{{ svg }}</div>

</div>
</div>

<div style="display:flex; gap: 1em;">
<div style="flex: 1">

<h2>Wheelie bin</h2>

<p>
<label>Bin colour: <input value='#767472' type="color" name="bin-colour" data-picture='svgwheelie' data-style="--primary-color"></label>
<label>Lid colour: <input value='#8b5e3d' type="color" name="lid-colour" data-picture='svgwheelie' data-style="--lid-color"></label>
<label>Recycling logo: <input type="checkbox" name="recycling" data-picture='svgwheelie' data-style="--recycling-logo"></label>
</p>

{% capture svg %}
{% include waste/wheelie.svg %}
{% endcapture %}

<div class="svg-wrapper" style="--primary-color: #767472; --lid-color: #8b5e3d" id="svgwheelie">{{ svg }}</div>

</div>
<div style="flex: 1">

<h2>Communal bin</h2>

<p>
<label>Bin colour: <input value='#767472' type="color" name="bin-colour" data-picture='svgcommunal' data-style="--primary-color"></label>
<label>Lid colour: <input value='#41b38b' type="color" name="lid-colour" data-picture='svgcommunal' data-style="--lid-color"></label>
<label>Recycling logo: <input type="checkbox" name="recycling" data-picture='svgcommunal' data-style="--recycling-logo"></label>
</p>

{% capture svg %}
{% include waste/communal.svg %}
{% endcapture %}

<div class="svg-wrapper" style="--primary-color: #767472; --lid-color: #41b38b" id="svgcommunal">{{ svg }}</div>

</div>
</div>

## Box

<label>Box colour: <input value='#00a6d2' type="color" name="box-colour" data-picture='svgbox' data-style="--primary-color"></label>
<label>Recycling logo: <input checked type="checkbox" name="recycling" data-picture='svgbox' data-style="--recycling-logo"></label>

{% capture svg %}
{% include waste/box.svg %}
{% endcapture %}

<div class="svg-wrapper" style="--recycling-logo: 1; --primary-color: #00a6d2;" id="svgbox">{{ svg }}</div>

<script>
[].forEach.call(document.getElementsByTagName('input'), function(el) {
el.addEventListener('input', function() {
var svg = document.getElementById(this.dataset.picture).style;
if (this.name == 'recycling') {
svg.setProperty("--recycling-logo", this.checked ? 1 : 0);
} else {
svg.setProperty(this.dataset.style, this.value);
}
});
});
</script>
Loading

0 comments on commit 1615200

Please sign in to comment.