0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-27 22:49:56 -05:00

First pass towards including custom fonts in theme preview

This commit is contained in:
Aileen Booker 2024-10-09 13:04:19 +01:00
parent 41579cea1a
commit 6a7b99e212
4 changed files with 18 additions and 4 deletions

View file

@ -180,7 +180,9 @@ const DesignModal: React.FC = () => {
icon,
logo,
coverImage,
themeSettings: formState.themeSettings
themeSettings: formState.themeSettings,
headingFont,
bodyFont
}}
url={selectedTabURL}
/>;

View file

@ -10,6 +10,8 @@ type BrandSettings = {
logo: string;
coverImage: string;
themeSettings?: Array<CustomThemeSetting & { dirty?: boolean }>;
bodyFont: string;
headingFont: string;
}
interface ThemePreviewProps {
@ -23,14 +25,18 @@ function getPreviewData({
icon,
logo,
coverImage,
themeSettings
themeSettings,
bodyFont,
headingFont
}: {
description: string;
accentColor: string;
icon: string;
logo: string;
coverImage: string;
themeSettings?: Array<CustomThemeSetting & { dirty?: boolean }>,
themeSettings?: Array<CustomThemeSetting & { dirty?: boolean }>;
bodyFont: string;
headingFont: string;
}) {
// Don't render twice while theme settings are loading
if (!themeSettings) {
@ -44,6 +50,8 @@ function getPreviewData({
params.append('icon', icon);
params.append('logo', logo);
params.append('cover', coverImage);
params.append('bf', bodyFont);
params.append('hf', headingFont);
const custom: {
[key: string]: string | typeof hiddenCustomThemeSettingValue;
} = {};

View file

@ -239,6 +239,8 @@ export default class ThemeManagementService extends Service {
params.append('icon', this.settings.icon);
params.append('logo', this.settings.logo);
params.append('cover', this.settings.coverImage);
params.append('bf', this.settings.bodyFont);
params.append('hf', this.settings.headingFont);
if (this.settings.announcementContent) {
params.append('announcement', this.settings.announcementContent);

View file

@ -22,7 +22,9 @@ function getPreviewData(previewHeader, customThemeSettingKeys = []) {
logo: 'logo',
cover: 'cover_image',
custom: 'custom',
d: 'description'
d: 'description',
bf: 'body_font',
hf: 'heading_font'
};
let opts = new URLSearchParams(previewHeader);