diff --git a/src/components/CoverImage.js b/src/components/CoverImage.js
index 4c6b64e..5742cce 100644
--- a/src/components/CoverImage.js
+++ b/src/components/CoverImage.js
@@ -7,6 +7,7 @@ import OutlineTheme from "./Themes/OutlineTheme";
import PreviewTheme from "./Themes/PreviewTheme";
import StylishTheme from "./Themes/StylishTheme";
import MobileMockupTheme from "./Themes/MobileMockupTheme";
+import BackgroundTheme from "./Themes/BackgroundTheme";
const CoverImage = (props) => {
// hexToRgbA(hex, opacity) {
@@ -32,6 +33,7 @@ const CoverImage = (props) => {
case 'preview': return
case 'stylish': return
case 'mobile': return
+ case 'background': return
default: return
}
diff --git a/src/components/Editor.js b/src/components/Editor.js
index 0e09fad..16fc92a 100644
--- a/src/components/Editor.js
+++ b/src/components/Editor.js
@@ -25,7 +25,7 @@ const defaultSettings = {
icon: { 'label': 'react', 'value': 'react' },
devIconOptions: {},
font: 'font-Anek',
- theme: 'stylish',
+ theme: 'background',
customIcon: '',
platform: 'hashnode'
diff --git a/src/components/Themes/BackgroundTheme.js b/src/components/Themes/BackgroundTheme.js
new file mode 100644
index 0000000..e14670c
--- /dev/null
+++ b/src/components/Themes/BackgroundTheme.js
@@ -0,0 +1,179 @@
+import React, { useState, useEffect, useContext } from 'react';
+import unsplash from "../../utils/unsplashConfig";
+import { ImgContext } from '../../utils/ImgContext';
+
+const BackgroundTheme = ({ config }) => {
+ const { title, author, font, icon, customIcon, platform, bgColor } = config;
+
+ // const [image, setImage] = useState({})
+
+ const [imageList, setImageList] = useState([]);
+ const [searchText, setSearchText] = useState('dev');
+
+ const { unsplashImage, setUnsplashImage } = useContext(ImgContext);
+
+ const searchImages = () => {
+
+ unsplash.search
+ .getPhotos({
+ query: searchText,
+ page: 1,
+ per_page: 25,
+ // orientation:'portrait'
+
+
+ })
+ .then(response => {
+ // console.log(response.response.results);
+ setImageList(response.response.results)
+ });
+ }
+
+ useEffect(() => {
+
+ unsplash.search
+ .getPhotos({
+ query: 'dev',
+ page: 1,
+ per_page: 25
+
+ })
+ .then(response => {
+ // console.log(response.response.results);
+ setImageList(response.response.results)
+ });
+ }, [])
+
+ const selectImage = (image) => {
+ setUnsplashImage({
+ url: image.urls.regular,
+ name: image.user.name,
+ avatar: image.user.profile_image.small,
+ profile: `${image.user.links.html}?utm_source=https://coverview.vercel.app&utm_medium=referral`,
+ downloadLink: image.links.download_location
+
+ })
+
+
+ }
+
+ const handleSearchSubmit = (e) => {
+ e.preventDefault();
+ searchImages(searchText);
+
+ }
+
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+ {unsplashImage ?
+
+
+
+
+
+

+
+
+
+
+
+
+
+
+
+
{title}
+
+
+
{author}
+ {
+ customIcon ?
+
+

+
+ :
+
+
+
+ }
+
+
+
+
+
+
+
+ :
+
+
+
+
+
+
+ {
+ imageList.map(image => {
+ return

selectImage(image)
+ }
+ />
+ })
+ }
+
+
+
+ }
+
+
+
+
+
+
+
+
+ );
+}
+
+export default BackgroundTheme;
\ No newline at end of file