Skip to content

Commit ef8318d

Browse files
Make Gallery API look more like Filmstrip. Create start of doc website.
1 parent 826fa8b commit ef8318d

33 files changed

+1267
-40
lines changed

doc/website/.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Build output
2+
/build
3+
4+
# https://dart.dev/guides/libraries/private-files
5+
# Created by `dart pub`
6+
.dart_tool/
7+
8+
# Android Studio and IntelliJ IDEA
9+
.idea
10+
11+
.DS_Store
12+
13+
# Avoid committing pubspec.lock for library packages; see
14+
# https://dart.dev/guides/libraries/private-files#pubspeclock.
15+
pubspec.lock

doc/website/analysis_options.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This file configures the static analysis results for your project (errors,
2+
# warnings, and lints).
3+
#
4+
# This enables the 'recommended' set of lints from `package:lints`.
5+
# This set helps identify many issues that may lead to problems when running
6+
# or consuming Dart code, and enforces writing Dart using a single, idiomatic
7+
# style and format.
8+
#
9+
# If you want a smaller set of lints you can change this to specify
10+
# 'package:lints/core.yaml'. These are just the most critical lints
11+
# (the recommended set includes the core lints).
12+
# The core lints are also what is used by pub.dev for scoring packages.
13+
14+
include: package:lints/recommended.yaml
15+
16+
# Uncomment the following section to specify additional rules.
17+
18+
# linter:
19+
# rules:
20+
# - camel_case_types
21+
22+
# analyzer:
23+
# exclude:
24+
# - path/to/excluded/files/**
25+
26+
# For more information about the core and recommended set of lints, see
27+
# https://dart.dev/go/core-lints
28+
29+
# For additional information about configuring this file, see
30+
# https://dart.dev/guides/language/analysis-options

doc/website/bin/main.dart

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import 'dart:io';
2+
3+
import 'package:static_shock/static_shock.dart';
4+
5+
Future<void> main(List<String> arguments) async {
6+
// Configure the static website generator.
7+
final staticShock = StaticShock()
8+
// Here, you can directly hook into the StaticShock pipeline. For example,
9+
// you can copy an "images" directory from the source set to build set:
10+
..pick(DirectoryPicker.parse("images"))
11+
// All 3rd party behavior is added through plugins, even the behavior
12+
// shipped with Static Shock.
13+
..plugin(const MarkdownPlugin())
14+
..plugin(const JinjaPlugin())
15+
..plugin(const PrettyUrlsPlugin())
16+
..plugin(const RedirectsPlugin())
17+
..plugin(const SassPlugin())
18+
19+
..plugin(const PubPackagePlugin({
20+
"flutter_test_goldens",
21+
}))
22+
23+
24+
..plugin(
25+
GitHubContributorsPlugin(
26+
// To load the contributors for a given GitHub package using credentials,
27+
// place your GitHub API token in an environment variable with the following name.
28+
authToken: Platform.environment["github_doc_website_token"],
29+
),
30+
)
31+
32+
..plugin(DraftingPlugin(
33+
showDrafts: arguments.contains("preview"),
34+
));
35+
36+
// Generate the static website.
37+
await staticShock.generateSite();
38+
}

doc/website/pubspec.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: flutter_test_goldens_docs
2+
description: Documentation for Flutter Test Goldens
3+
version: 1.0.0
4+
publish_to: none
5+
6+
environment:
7+
sdk: ^3.0.0
8+
9+
dependencies:
10+
static_shock: any
11+
12+
dev_dependencies:
13+
lints: ^2.0.0
14+
test: ^1.21.0

doc/website/source/_data.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Configuration for the package that this website documents.
2+
package:
3+
name: flutter_test_goldens
4+
title: Flutter Test Goldens
5+
description: Generate better goldens with Flutter
6+
is_on_pub: true
7+
8+
github:
9+
url: https://github.com/flutter-bounty-hunters/flutter_test_goldens
10+
organization: flutter-bounty-hunters
11+
name: flutter_test_goldens
12+
13+
discord:
14+
sponsorship: https://flutterbountyhunters.com
15+
16+
# Configuration of the GitHub plugin for loading info about GitHub repositories.
17+
github:
18+
contributors:
19+
repositories:
20+
21+
- { organization: flutter-bounty-hunters, name: flutter_test_goldens }
22+
23+
24+
# The default layout applied to all pages in this website.
25+
layout: layouts/docs_page.jinja
26+
27+
# The global navigation manu for all documentation pages in this website.
28+
navigation:
29+
30+
show_contributors: true
31+
32+
33+
items:
34+
- title: Welcome
35+
url: /
36+
37+
- title: "Get Started"
38+
url: /get-started
39+
40+
- title: Golden Scenes
41+
tag: scenes
42+
sortBy: navOrder
43+
44+
- title: Golden Metadata
45+
tag: metadata
46+
sortBy: navOrder
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css">
2+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/oxygen.min.css">
3+
4+
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
5+
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/dart.min.js"></script>
6+
7+
<script>
8+
const lightTheme = "oxygen";
9+
const darkTheme = "obsidian";
10+
11+
hljs.highlightAll();
12+
13+
function goToHighlightJsLightMode() {
14+
removeHighlightJsTheme(darkTheme);
15+
addHighlightJsTheme(lightTheme);
16+
}
17+
18+
function goToHighlightJsDarkMode() {
19+
removeHighlightJsTheme(lightTheme);
20+
addHighlightJsTheme(darkTheme);
21+
}
22+
23+
function removeHighlightJsTheme(themeName) {
24+
const existingStylesheet = document.querySelector(`link[href*="${themeName}"]`);
25+
if (existingStylesheet) {
26+
existingStylesheet.remove();
27+
} else {
28+
console.log("Couldn't find the light stylesheet to remove it");
29+
}
30+
}
31+
32+
function addHighlightJsTheme(themeName) {
33+
const link = document.createElement("link");
34+
link.rel = "stylesheet";
35+
link.href = `https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/${themeName}.min.css`;
36+
37+
document.querySelector("head").append(link);
38+
document.querySelector("span").textContent = themeName;
39+
}
40+
</script>
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<nav class="main">
2+
<ol class="organization-links">
3+
<!-- Hard-coded, specific top-level menu items -->
4+
{% if package.github != null %}
5+
<a href="{{ package.github.url }}" target="_blank" role="button" class="btn"><span class="fa fa-brands fa-github"></span>&nbsp;&nbsp;GitHub</a>
6+
{% endif %}
7+
8+
{% if package.discord != null %}
9+
<a href="{{ package.discord }}" target="_blank" role="button" class="btn"><span class="fa fa-brands fa-discord"></span>&nbsp;&nbsp;Discord</a>
10+
{% endif %}
11+
12+
{% if package.sponsorship != null %}
13+
<a href="{{ package.sponsorship }}" target="_blank" role="button" class="btn"><span class="fa fa-dollar-sign"></span>&nbsp;&nbsp;Sponsor</a>
14+
{% endif %}
15+
</ol>
16+
17+
<div class="organization-nav-divider">&nbsp;</div>
18+
19+
{% if navigation != null %}
20+
<ol>
21+
{% for item in navigation.items %}
22+
{% if item.tag == null %}
23+
<!-- Top-level menu item -->
24+
<li><a href="{{ item.url }}">{{ item.title }}</a></li>
25+
{% else %}
26+
<!-- Group of menu items -->
27+
<div class="link-group">
28+
<span class="title">{{ item.title }}</span>
29+
<ol>
30+
{% for page in pages.byTag(item.tag, sortBy=item.sortBy) %}
31+
<li><a href="{{ page.data.url }}">{{ page.data.title }}</a></li>
32+
{% endfor %}
33+
</ol>
34+
</div>
35+
{% endif %}
36+
{% endfor %}
37+
</ol>
38+
39+
{% if navigation.show_contributors %}
40+
{% set contributors = github[package.github.organization][package.github.name] %}
41+
<div class="contributors">
42+
<span class="title">Contributors <span class="count">({{ contributors | length }})</span></span>
43+
<ol>
44+
{% for contributor in (contributors|take(4)) %}
45+
<li class="contributor">
46+
<!-- Note: We show the contributor photo as a background image because -->
47+
<!-- displaying it as an <img> results in a few extra pixels above -->
48+
<!-- the image that we couldn't get rid of -->
49+
<a href="{{ contributor.userUrl }}" target="_blank" title="{{ contributor.userId }}" style="background-image: url('{{ contributor.avatarUrl }}');">
50+
</a>
51+
</li>
52+
{% endfor %}
53+
54+
{% if contributors|length > 4 %}
55+
<li class="remaining-count">
56+
<div class="bubble">
57+
<span class="count">+{{ contributors|length - 4 }}</span>
58+
</div>
59+
</li>
60+
{% endif %}
61+
</ol>
62+
</div>
63+
{% endif %}
64+
65+
{% endif %}
66+
</nav>

0 commit comments

Comments
 (0)