From b5fa840e66028fd3fcaf51cf3a9e6b19e896c7da Mon Sep 17 00:00:00 2001 From: anime Date: Thu, 27 Feb 2025 18:13:34 +0800 Subject: [PATCH 1/4] feat(ImageSize): Support customized image size --- src/components/CoverImage.js | 8 ++++++-- src/components/Editor.js | 40 +++++++++++++++++++++++++++++++----- 2 files changed, 41 insertions(+), 7 deletions(-) diff --git a/src/components/CoverImage.js b/src/components/CoverImage.js index 8dafd0c..ff5c7c6 100644 --- a/src/components/CoverImage.js +++ b/src/components/CoverImage.js @@ -39,9 +39,13 @@ const CoverImage = (props) => { } } - + const {CoverImageWidth, CoverImageHeight, platform} = props + const isCustomSize = platform === 'custom' return ( -
+
{selectTheme(theme)}
); diff --git a/src/components/Editor.js b/src/components/Editor.js index 5796605..846b1d3 100644 --- a/src/components/Editor.js +++ b/src/components/Editor.js @@ -3,11 +3,11 @@ import CoverImage from "./CoverImage"; import ComponentToImg from "./ComponentToImg"; import Select from 'react-select'; import RandomTheme from './RandomTheme'; -import { ImgProvider } from '../utils/ImgContext' +import {ImgProvider} from '../utils/ImgContext' import Header from "./Header"; -import { THEMES } from "../utils/constants"; +import {THEMES} from "../utils/constants"; const defaultIcon = { 'label': 'react', 'value': 'react' } @@ -22,7 +22,9 @@ const defaultSettings = { font: 'font-Anek', theme: 'background', customIcon: '', - platform: 'hashnode' + platform: 'hashnode', + CoverImageWidth: '750', + CoverImageHeight: '750', }; const devIconsUrl = "https://raw.githubusercontent.com/devicons/devicon/master/devicon.json" @@ -195,11 +197,39 @@ class Editor extends React.Component { className="focus:outline-none text-gray-700 text-lg p-2 rounded border"> +
- - + {this.state.platform === 'custom' ? ( +
+ Platform +
+
+ + +
+
+
+ ) : null} -
+

{title}

From ab443e9849898e69a36a24d2faf5a3a701e461f5 Mon Sep 17 00:00:00 2001 From: anime Date: Thu, 27 Feb 2025 20:54:24 +0800 Subject: [PATCH 4/4] feat(StylishTheme): adjust layout to ensure theme fits properly in custom size --- src/components/Themes/StylishTheme.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/Themes/StylishTheme.js b/src/components/Themes/StylishTheme.js index 3cc81ff..bacc4b8 100644 --- a/src/components/Themes/StylishTheme.js +++ b/src/components/Themes/StylishTheme.js @@ -11,13 +11,13 @@ const StylishTheme = ({ config }) => {
-
-
+
-
+

{title}

@@ -41,7 +41,7 @@ const StylishTheme = ({ config }) => { {unsplashImage ? -
+
preview