import React from "react";
import CoverImage from "./CoverImage";
import ComponentToImg from "./ComponentToImg";
import Select from 'react-select';
import RandomTheme from './RandomTheme';
// import resetIcon from '../assets/icons/reset.svg'
const defaultSettings = {
title: "How I built my first project with react",
bgColor: "#dcd6f7",
pattern: "",
download: "PNG",
author: 'Rutik Wankhade',
icon: { 'label': 'react', 'value': 'react' },
devIconOptions: {},
font: 'font-sans',
theme: 'modern',
customIcon: ''
};
const devIconsUrl = "https://raw.githubusercontent.com/devicons/devicon/master/devicon.json"
// const devIconOptions = [
// { value: 'None', label: 'None' },
// { value: 'javascript', label: 'Javascript' },
// { value: 'python', label: 'Python' },
class Editor extends React.Component {
state = defaultSettings;
componentDidMount() {
console.log("Mount")
fetch(devIconsUrl).then(r => r.json()).then(data => {
data.push({ name: 'custom' })
this.setState({ devIconOptions: data.map(item => ({ 'value': item.name, 'label': item.name })) })
})
}
handleReset = () => {
this.setState(defaultSettings);
};
getRandomTheme = (theme, Pattern) => {
this.setState({ bgColor: theme.bgColor, borderColor: theme.bdColor, pattern: Pattern });
}
formatOptionLabel = ({ value, label }) => (
);
// customOption = props => {
// const { data, innerRef, innerProps } = props;
// return data.name === 'custom' ? (
//
// this.setState({ 'customIcon': URL.createObjectURL(e.target.files[0]) })}
// />
//
// ) : (
//
// );
// };
render() {
return (
{/*
🛠Creating cover images for your blogs is now super easy
*/}
Blog Title
Author
this.setState({ author: e.target.value })}
>
Font
Icon
{this.state.icon.label === 'custom' ?
this.setState({ 'customIcon': URL.createObjectURL(e.target.files[0]) })}
/>
:
}
Pattern
Theme
Made with 💖 by Rutik Wankhade
{/*
Download As
*/}
{/*
*/}
Coverview is live on Product Hunt Today.
);
}
}
export default Editor;