chore: Update ThemePage component to display theme readme
This commit is contained in:
@@ -7,13 +7,19 @@ export interface ZenTheme {
|
||||
downloadUrl: string
|
||||
id: string
|
||||
homepage?: string
|
||||
readme: string
|
||||
preferences: {
|
||||
[key: string]: string
|
||||
},
|
||||
author: string
|
||||
}
|
||||
|
||||
const THEME_API = "https://zen-browser.github.io/theme-store/themes.json";
|
||||
const CACHE_OPTIONS = {};
|
||||
|
||||
export function getAllThemes(): ZenTheme[] {
|
||||
// Fetch from the API
|
||||
const response = fetch(THEME_API, {});
|
||||
const response = fetch(THEME_API, CACHE_OPTIONS);
|
||||
const themes = response.json();
|
||||
// transform in to a ZenTheme[] as it is currently an object
|
||||
let themesArray: ZenTheme[] = [];
|
||||
@@ -30,3 +36,7 @@ export function getThemesFromSearch(themes: ZenTheme[], query: string): ZenTheme
|
||||
export function getThemeFromId(id: string): ZenTheme | undefined {
|
||||
return getAllThemes().find((theme) => theme.id === id);
|
||||
}
|
||||
|
||||
export function getThemeMarkdown(theme: ZenTheme): string {
|
||||
return fetch(theme.readme, CACHE_OPTIONS).text();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user