From 1ac04e68ae380808ac842f3ff0dea5bdb1935b49 Mon Sep 17 00:00:00 2001 From: rutik wankhade Date: Thu, 21 Apr 2022 23:43:36 +0530 Subject: [PATCH] feat: added new browser preview theme --- src/components/CoverImage.js | 3 ++ src/components/Editor.js | 2 ++ src/components/Themes/PreviewTheme.js | 49 +++++++++++++++++++++++++++ 3 files changed, 54 insertions(+) diff --git a/src/components/CoverImage.js b/src/components/CoverImage.js index e13552b..f882341 100644 --- a/src/components/CoverImage.js +++ b/src/components/CoverImage.js @@ -4,6 +4,7 @@ import "../assets/css/patterns.css"; import ModernTheme from "./Themes/ModernTheme"; import BasicTheme from "./Themes/BasicTheme"; import OutlineTheme from "./Themes/OutlineTheme"; +import PreviewTheme from "./Themes/PreviewTheme"; const CoverImage = (props) => { // hexToRgbA(hex, opacity) { @@ -26,6 +27,8 @@ const CoverImage = (props) => { case 'basic': return case 'modern': return case 'outline': return + case 'preview': return + default: return } } diff --git a/src/components/Editor.js b/src/components/Editor.js index 5786c81..c633007 100644 --- a/src/components/Editor.js +++ b/src/components/Editor.js @@ -171,6 +171,8 @@ class Editor extends React.Component { + + diff --git a/src/components/Themes/PreviewTheme.js b/src/components/Themes/PreviewTheme.js index e69de29..c3e669c 100644 --- a/src/components/Themes/PreviewTheme.js +++ b/src/components/Themes/PreviewTheme.js @@ -0,0 +1,49 @@ +import React, { useState } from 'react'; + +const PreviewTheme = ({ config }) => { + const {bgColor } = config; + + const [image, setImage] = useState() + + return ( +
+ + +
+ +
+
+
+
+
+ +
+ {image ? +
+ preview +
+ : +
+ setImage(URL.createObjectURL(e.target.files[0]))} + /> +
+ + } +
+ + + + + +
+ + +
+ ); +} + +export default PreviewTheme; \ No newline at end of file