Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/css/doc.css
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,8 @@
padding: 0.25rem 0;
}

.doc .conum[data-value] {
.doc .conum[data-value],
.doc .step {
@include text-overline;

color: var(--ds-text-inverse);
Expand All @@ -963,6 +964,12 @@
display: none;
}

.doc .step {
position: relative;
top: -0.25em;
margin-right: var(--ds-space-q);
}

.doc hr {
border: solid var(--section-divider-color);
border-width: 2px 0 0;
Expand Down
6 changes: 6 additions & 0 deletions src/css/ds-button.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
}
}

a.ds-button:hover {
text-decoration: none;
}

/* icon button */
.ds-button--is-icon {
height: var(--ds-space-5);
Expand All @@ -24,10 +28,12 @@

.ds-button--leading-icon {
margin-right: var(--ds-space-1);
display: flex;
}

.ds-button--trailing-icon {
margin-left: var(--ds-space-1);
display: flex;
}

.ds-button--variant-outlined {
Expand Down
1 change: 1 addition & 0 deletions src/css/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@
@import "footer.css";
@import "highlight.css";
@import "print.css";
@import "tutorial-info.css";
15 changes: 15 additions & 0 deletions src/css/tutorial-info.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.tutorial-info {
display: flex;
align-items: center;
gap: var(--ds-space-2h);
margin-bottom: var(--ds-space-3);
}

.tutorial-info .info-item {
display: flex;
gap: var(--ds-space-1);
}

.tutorial-info .tutorial-actions {
margin-left: auto;
}
7 changes: 7 additions & 0 deletions src/helpers/stepcount.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict'

module.exports = (html) => {
const matches = html.toString().match(/class="step"/g)
if (!matches) return undefined
return matches.length
}
10 changes: 10 additions & 0 deletions src/helpers/svg.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
'use strict'

const fs = require('fs')
const path = require('path')

module.exports = (iconName) => {
const pathName = path.join(__dirname, '/src/img/', iconName + '.svg')
const content = fs.readFileSync(pathName, 'utf8')
return content
}
18 changes: 18 additions & 0 deletions src/img/colab.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions src/layouts/tutorial.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
{{> head defaultPageTitle='Untitled'}}
</head>
<body class="article{{#with (or page.attributes.role page.role)}} {{{this}}}{{/with}}">
{{> header}}
{{> body}}
{{> footer}}
</body>
</html>
15 changes: 9 additions & 6 deletions src/partials/article.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<article class="doc">
{{#with page.title}}
<h1 class="page">{{{this}}}</h1>
{{/with}}
{{{page.contents}}}
{{> pagination}}
</article>
{{#with page.title}}
<h1 class="page">{{{this}}}</h1>
{{/with}}
{{#if (eq page.layout 'tutorial')}}
{{> tutorial-info}}
{{/if}}
{{{page.contents}}}
{{> pagination}}
</article>
28 changes: 28 additions & 0 deletions src/partials/tutorial-info.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<div class="tutorial-info">
{{#with page.attributes.skill-level}}
<div class="info-item">
<span class="material-icons">network_check</span>
{{{this}}}
</div>
{{/with}}
{{#with (stepcount page.contents)}}
<div class="info-item">
<span class="material-icons">playlist_add_check</span>
{{{this}}} Steps
</div>
{{/with}}
{{#with page.attributes.time-commitment}}
<div class="info-item">
<span class="material-icons">query_builder</span>
{{{this}}}
</div>
{{/with}}
<div class="tutorial-actions">
{{#with page.attributes.colab-link}}
<a href="{{{this}}}" target="_blank" class="colab ds-button ds-button--variant-outlined ds-button--color-neutral">
<div class="ds-button--leading-icon">{{{svg 'colab'}}}</div>
Run this on Colab
</a>
{{/with}}
</div>
</div>