Social badge support for static previews (#2871)

The static previews don't support the social badges. Adding that lets us remove support for `exampleUrl`. Close #2479.

This includes `style` and `namedLogo` in the service-definition export and updates the frontend to use it. To accomplish this, it passes `namedLogo` through `coalesceBadge`. After logo resolution is moved to `makeBadge` this duplication can be removed, as `logo` will no longer be needed in the result of `coalesceBadge`.
This commit is contained in:
Paul Melnikow
2019-01-28 22:44:25 -06:00
committed by GitHub
parent e10e8b1b6d
commit 5b122ddd73
12 changed files with 76 additions and 25 deletions

View File

@@ -30,22 +30,26 @@ module.exports = class GithubFollowers extends LegacyService {
return [
{
title: 'GitHub followers',
previewUrl: 'espadrine',
// https://github.com/badges/shields/issues/2479
// namedParams: {
// user: 'espadrine',
// },
// staticPreview: {
// label: 'Follow',
// message: '150',
// style: 'social',
// },
queryParams: { style: 'social', label: 'Follow' },
namedParams: {
user: 'espadrine',
},
staticPreview: {
label: 'Follow',
message: '150',
style: 'social',
},
queryParams: { label: 'Follow' },
documentation,
},
]
}
static get defaultBadgeData() {
return {
namedLogo: 'github',
}
}
static registerLegacyRouteHandler({ camp, cache, githubApiProvider }) {
camp.route(
/^\/github\/followers\/([^/]+)\.(svg|png|gif|jpg|json)$/,