0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -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, icon,
logo, logo,
coverImage, coverImage,
themeSettings: formState.themeSettings themeSettings: formState.themeSettings,
headingFont,
bodyFont
}} }}
url={selectedTabURL} url={selectedTabURL}
/>; />;

View file

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

View file

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