From c6076be5e670d59b227d8d351af72acb9215fb46 Mon Sep 17 00:00:00 2001 From: Brian Hann Date: Thu, 28 Feb 2019 11:09:06 -0600 Subject: [PATCH 1/2] Add 'Improve this Tutorial' link --- site/src/routes/tutorial/[slug]/index.svelte | 30 ++++++++++++++++++-- site/src/routes/tutorial/index.json.js | 6 ++-- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/site/src/routes/tutorial/[slug]/index.svelte b/site/src/routes/tutorial/[slug]/index.svelte index 4396517f84..1fc262c86f 100644 --- a/site/src/routes/tutorial/[slug]/index.svelte +++ b/site/src/routes/tutorial/[slug]/index.svelte @@ -45,7 +45,12 @@ }); }); + // TODO: this will need to be changed to the master branch, and probably should be dynamic instead of included + // here statically + const tutorial_repo_link = 'https://github.com/sveltejs/svelte/tree/restructure-docs/site/content/tutorial'; + $: selected = lookup.get(slug); + $: improve_link = `${tutorial_repo_link}/${selected.chapter.section_dir}/${selected.chapter.chapter_dir}/text.md`; // TODO once reactive values are fixed // $: app = { @@ -159,10 +164,10 @@ .controls { border-top: 1px solid rgba(255,255,255,0.1); padding: 1em 0 0 0; + display: flex; } .show { - float: left; text-transform: uppercase; background: rgba(255,255,255,0.1); padding: 0.2em 0.7em; @@ -178,8 +183,25 @@ } a.next { - float: right; + margin-left: auto; + text-decoration: none; + } + + .improve-chapter { + text-align: center; + padding: 1em 0 .5em 0; + } + + .improve-chapter > a { + font-size: 0.6em; text-decoration: none; + border-radius: 0.7em; + background: rgba(255,255,255,0.1); + padding: 0.2em 0.7em; + } + + .improve-chapter > a:hover { + background: rgba(255,255,255,0.2); } @@ -205,6 +227,10 @@ {/if} + +
+ Improve this Tutorial +
diff --git a/site/src/routes/tutorial/index.json.js b/site/src/routes/tutorial/index.json.js index 6a59aa22d4..f51c82c842 100644 --- a/site/src/routes/tutorial/index.json.js +++ b/site/src/routes/tutorial/index.json.js @@ -26,7 +26,9 @@ function get_sections() { return { slug, - title: metadata.title + title: metadata.title, + section_dir: dir, + chapter_dir: tutorial, }; }) } @@ -45,4 +47,4 @@ export function get(req, res) { }); res.end(json); -} \ No newline at end of file +} From 8c6ef56428d9a8b20811091a6fb735fc37607dc9 Mon Sep 17 00:00:00 2001 From: Brian Hann Date: Thu, 28 Feb 2019 11:22:14 -0600 Subject: [PATCH 2/2] Accidentally removed styling from link --- site/src/routes/tutorial/[slug]/index.svelte | 1 - 1 file changed, 1 deletion(-) diff --git a/site/src/routes/tutorial/[slug]/index.svelte b/site/src/routes/tutorial/[slug]/index.svelte index 1fc262c86f..3c81b4356d 100644 --- a/site/src/routes/tutorial/[slug]/index.svelte +++ b/site/src/routes/tutorial/[slug]/index.svelte @@ -184,7 +184,6 @@ a.next { margin-left: auto; - text-decoration: none; } .improve-chapter {