Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from hydrosquall/cameron.yick/add-sponsor-logo…
…-to-footer feat: add demo site landing page, with sponsor logo in footer
- Loading branch information
Showing
7 changed files
with
91 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,30 @@ | ||
|
||
.PHONY: publish-vercel, install | ||
|
||
# None of this is needed since publish is happening | ||
# in the CI environment using the statics from PyPI, not from a local build | ||
# Need to re-evaluate how to use locally created plugins/statics for this in a future iteration. For now, just use published assets for simplicity. | ||
# Flags used during local dev and in the published demo. | ||
DATASETTE_DEMO_FLAGS := \ | ||
--plugins-dir=demo/demo-plugins \ | ||
--metadata=demo/demo-metadata.yml | ||
|
||
# We didn't need to install yarn, npm packages etc | ||
# in the CI environment using the statics from PyPI, not from contents of the local repo. | ||
# We need to re-evaluate how to use locally created plugins/statics for this someday. For now, just use published assets on PyPI for simplicity. | ||
|
||
install: | ||
pip install -r demo/requirements.txt | ||
# # pip install -e . | ||
|
||
# https://github.com/simonw/datasette-publish-vercel#other-options | ||
publish-vercel: install | ||
|
||
datasette publish vercel demo/happy_planet_index.db \ | ||
--project=datasette-nteract-data-explorer \ | ||
--scope=datasette-visualization-plugin-demos \ | ||
--token=${VERCEL_TOKEN} \ | ||
--install datasette-nteract-data-explorer \ | ||
--public | ||
--public \ | ||
${DATASETTE_DEMO_FLAGS} | ||
|
||
|
||
run-demo: | ||
datasette -i demo/happy_planet_index.db \ | ||
${DATASETTE_DEMO_FLAGS} | ||
# --template-dir=demo/demo-templates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
title: | ||
Datasette Nteract Data Explorer Demo | ||
|
||
description_html: | ||
<iframe src="https://a.cl.ly/yAuK9LRE?embed=true" width="780" height="520" style="border:none" frameborder="0" allowtransparency="true" allowfullscreen="true"></iframe> | ||
|
||
|
||
<p>This is a demo site for the <a href="https://github.com/hydrosquall/datasette-nteract-data-explorer"> Data Explorer</a> plugin for Datasette, a free tool for publishing and exploring open datasets. We are using the <a href="https://happyplanetindex.org/" target="_blank">Happy Planet Index</a> dataset to show how this tool can help you explore your data. </p> | ||
|
||
<p> For more information, please refer to the project <a href="https://github.com/hydrosquall/datasette-nteract-data-explorer">documentation</a>. </p> | ||
|
||
license: "Apache License" | ||
license_url: "https://www.apache.org/licenses/LICENSE-2.0" | ||
source: Happy Planet Index | ||
source_url: "https://raw.githubusercontent.com/lux-org/lux-datasets/master/data/hpi_cleaned.csv" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Append footer with the Vercel logo to every page. | ||
// TODO: Check if there a way to server-side render this someday? | ||
|
||
// Link + picture | ||
const imageElement = document.createElement("img"); | ||
imageElement.src = | ||
"https://www.datocms-assets.com/31049/1618983297-powered-by-vercel.svg"; | ||
const linkElement = document.createElement('a'); | ||
linkElement.href = | ||
"https://vercel.com/?utm_source=datasette-visualization-plugin-demos&utm_campaign=oss"; | ||
linkElement.target = "_blank"; | ||
linkElement.rel = 'noopener noreferrer'; | ||
linkElement.ariaLabel = 'Site hosted by Vercel'; | ||
|
||
// A block element so we can limit the size of the logo | ||
const buttonElement = document.createElement('div'); | ||
buttonElement.style = "width: 212px; padding-left: 1rem"; | ||
linkElement.appendChild(imageElement); | ||
buttonElement.appendChild(linkElement); | ||
|
||
// Final insertion + add to page. | ||
// A wrapper element to hold everything and supply some background coloring | ||
const sponsorContainer = document.createElement('div'); | ||
sponsorContainer.style = 'background-color: rgb(31,41,55); padding-top: 1rem; padding-bottom: 1rem;'; | ||
sponsorContainer.appendChild(buttonElement); | ||
// Attach as sibling of the official footer | ||
const footerElement = document.querySelector('footer'); | ||
footerElement.insertAdjacentHTML("afterend", sponsorContainer.outerHTML); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from datasette import hookimpl | ||
from os import path | ||
|
||
# Store JS in separate file to enable basic IDE hinting support | ||
script_name = path.join(path.dirname(__file__), "footer.js") | ||
SCRIPT = open(script_name).read() | ||
|
||
|
||
@hookimpl | ||
def extra_body_script(): | ||
return SCRIPT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{% extends "default:base.html" %} | ||
|
||
{% block content %} | ||
{{ super() }} | ||
<footer> | ||
<h1>Unused: theoretically this could be a custom footer</h1> | ||
</footer> | ||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<h1>hello world - a custom template</h1> |