mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-11-28 09:20:52 +01:00
Updated Sponsors listing
This commit is contained in:
parent
07655d3c01
commit
6d59b425aa
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -35,5 +35,5 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
<script src="{{ 'overrides/assets/javascripts/bundle.777564f6.min.js' | url }}"></script>
|
<script src="{{ 'overrides/assets/javascripts/bundle.5637e9f5.min.js' | url }}"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -33,12 +33,30 @@ import { Component, getComponentElement } from "../_"
|
|||||||
* Types
|
* Types
|
||||||
* ------------------------------------------------------------------------- */
|
* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sponsor type
|
||||||
|
*/
|
||||||
|
export type SponsorType =
|
||||||
|
| "user" /* Sponsor is a user */
|
||||||
|
| "organization" /* Sponsor is an organization */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sponsor visibility
|
* Sponsor visibility
|
||||||
*/
|
*/
|
||||||
export enum SponsorType {
|
export type SponsorVisibility =
|
||||||
PUBLIC = "PUBLIC", /* Public sponsorship */
|
| "public" /* Sponsor is a user */
|
||||||
PRIVATE = "PRIVATE" /* Private sponsorship */
|
| "private" /* Sponsor is an organization */
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sponsor user
|
||||||
|
*/
|
||||||
|
export interface SponsorUser {
|
||||||
|
type: SponsorType /* Sponsor type */
|
||||||
|
name: string /* Sponsor login name */
|
||||||
|
image: string /* Sponsor image URL */
|
||||||
|
url: string /* Sponsor URL */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
@ -47,17 +65,15 @@ export enum SponsorType {
|
|||||||
* Public sponsor
|
* Public sponsor
|
||||||
*/
|
*/
|
||||||
export interface PublicSponsor {
|
export interface PublicSponsor {
|
||||||
type: SponsorType.PUBLIC /* Sponsor visibility */
|
type: "public" /* Sponsor visibility */
|
||||||
name: string /* Sponsor login name */
|
user: SponsorUser /* Sponsor user */
|
||||||
image: string /* Sponsor image URL */
|
|
||||||
url: string /* Sponsor URL */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private sponsor
|
* Private sponsor
|
||||||
*/
|
*/
|
||||||
export interface PrivateSponsor {
|
export interface PrivateSponsor {
|
||||||
type: SponsorType.PRIVATE /* Sponsor visibility */
|
type: "private" /* Sponsor visibility */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
@ -94,7 +110,7 @@ export function mountSponsorship(
|
|||||||
el: HTMLElement
|
el: HTMLElement
|
||||||
): Observable<Component<Sponsorship>> {
|
): Observable<Component<Sponsorship>> {
|
||||||
const sponsorship$ = requestJSON<Sponsorship>(
|
const sponsorship$ = requestJSON<Sponsorship>(
|
||||||
"https://gpiqp43wvb.execute-api.us-east-1.amazonaws.com/_/"
|
"https://3if8u9o552.execute-api.us-east-1.amazonaws.com/_/"
|
||||||
)
|
)
|
||||||
|
|
||||||
/* Retrieve adjacent components */
|
/* Retrieve adjacent components */
|
||||||
@ -108,13 +124,13 @@ export function mountSponsorship(
|
|||||||
/* Render public sponsors with avatar and links */
|
/* Render public sponsors with avatar and links */
|
||||||
const list = getElementOrThrow(":scope > :first-child", el)
|
const list = getElementOrThrow(":scope > :first-child", el)
|
||||||
for (const sponsor of sponsorship.sponsors)
|
for (const sponsor of sponsorship.sponsors)
|
||||||
if (sponsor.type === SponsorType.PUBLIC)
|
if (sponsor.type === "public")
|
||||||
list.appendChild(renderPublicSponsor(sponsor))
|
list.appendChild(renderPublicSponsor(sponsor))
|
||||||
|
|
||||||
/* Render combined private sponsors */
|
/* Render combined private sponsors */
|
||||||
list.appendChild(renderPrivateSponsor(
|
list.appendChild(renderPrivateSponsor(
|
||||||
sponsorship.sponsors.filter(({ type }) => (
|
sponsorship.sponsors.filter(({ type }) => (
|
||||||
type === SponsorType.PRIVATE
|
type === "private"
|
||||||
)).length
|
)).length
|
||||||
))
|
))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user