Merge pull request #33 from rutikwankhade/improve-editor
Improve editor ui and themes section
13864
package-lock.json
generated
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
@ -41,13 +41,11 @@ const CoverImage = (props) => {
|
|||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="md:w-full md:scale-100 scale-50">
|
<div className={`border-2 border-gray-50 md:scale-100 scale-50 ${props.platform}`}>
|
||||||
{selectTheme(theme)} </div>
|
{selectTheme(theme)}
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default CoverImage;
|
export default CoverImage;
|
||||||
|
@ -5,23 +5,14 @@ import Select from 'react-select';
|
|||||||
import RandomTheme from './RandomTheme';
|
import RandomTheme from './RandomTheme';
|
||||||
import { ImgProvider } from '../utils/ImgContext'
|
import { ImgProvider } from '../utils/ImgContext'
|
||||||
import Header from "./Header";
|
import Header from "./Header";
|
||||||
import { Tab } from '@headlessui/react'
|
|
||||||
|
|
||||||
import theme1 from '../assets/images/theme1.webp'
|
|
||||||
import theme2 from '../assets/images/theme2.webp'
|
|
||||||
import theme3 from '../assets/images/theme3.webp'
|
|
||||||
import theme4 from '../assets/images/theme4.webp'
|
|
||||||
import theme5 from '../assets/images/theme5.webp'
|
|
||||||
import theme6 from '../assets/images/theme6.webp'
|
|
||||||
import theme7 from '../assets/images/theme7.webp'
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import { THEMES } from "../utils/constants";
|
||||||
|
|
||||||
const defaultIcon = { 'label': 'react', 'value': 'react' }
|
const defaultIcon = { 'label': 'react', 'value': 'react' }
|
||||||
|
|
||||||
const defaultSettings = {
|
const defaultSettings = {
|
||||||
title: "A begineers guide to frontend development",
|
title: "A beginners guide to frontend development",
|
||||||
bgColor: "#949ee5",
|
bgColor: "#949ee5",
|
||||||
pattern: "",
|
pattern: "",
|
||||||
download: "PNG",
|
download: "PNG",
|
||||||
@ -35,19 +26,13 @@ const defaultSettings = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const devIconsUrl = "https://raw.githubusercontent.com/devicons/devicon/master/devicon.json"
|
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 {
|
class Editor extends React.Component {
|
||||||
|
|
||||||
|
|
||||||
state = defaultSettings;
|
state = defaultSettings;
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
console.log("Mount")
|
// console.log("Mount")
|
||||||
fetch(devIconsUrl).then(r => r.json()).then(data => {
|
fetch(devIconsUrl).then(r => r.json()).then(data => {
|
||||||
data.push({ name: 'custom' })
|
data.push({ name: 'custom' })
|
||||||
this.setState({ devIconOptions: data.map(item => ({ 'value': item.name, 'label': item.name })) })
|
this.setState({ devIconOptions: data.map(item => ({ 'value': item.name, 'label': item.name })) })
|
||||||
@ -77,67 +62,59 @@ class Editor extends React.Component {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div className="max-w-[1400px] mx-auto">
|
||||||
<Header />
|
<Header />
|
||||||
|
|
||||||
<ImgProvider>
|
<ImgProvider>
|
||||||
<div className="flex md:flex-row flex-col bg-gray-50 ">
|
|
||||||
|
|
||||||
<div className="bg-white flex flex-col h-100 md:w-4/12">
|
|
||||||
|
|
||||||
<Tab.Group>
|
|
||||||
<div className="flex md:flex-row flex-col ">
|
<div className="flex md:flex-row flex-col ">
|
||||||
|
|
||||||
<Tab.List className=" bg-white md:p-0 p-2 flex flex-row md:flex-col">
|
<div className="bg-white flex flex-col h-100 md:w-3/12">
|
||||||
<Tab className="flex items-center font-semibold ">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" className="text-gray- bg-white rounded-xl w-12 m-2 h-12 p-2 rounded border" width="24" height="24" viewBox="0 0 24 24" ><path d="M19.045 7.401c.378-.378.586-.88.586-1.414s-.208-1.036-.586-1.414l-1.586-1.586c-.378-.378-.88-.586-1.414-.586s-1.036.208-1.413.585L4 13.585V18h4.413L19.045 7.401zm-3-3 1.587 1.585-1.59 1.584-1.586-1.585 1.589-1.584zM6 16v-1.585l7.04-7.018 1.586 1.586L7.587 16H6zm-2 4h16v2H4z"></path></svg>
|
|
||||||
</Tab>
|
|
||||||
|
|
||||||
<Tab className="flex items-center font-semibold text-lg">
|
<div>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" className=" text-gray-800 bg-white rounded-xl w-12 h-12 p-2 m-2 rounded border" width="24" height="24" viewBox="0 0 24 24" ><path d="M11.024 11.536 10 10l-2 3h9l-3.5-5z"></path><circle cx="9.503" cy="7.497" r="1.503"></circle><path d="M19 2H6c-1.206 0-3 .799-3 3v14c0 2.201 1.794 3 3 3h15v-2H6.012C5.55 19.988 5 19.806 5 19s.55-.988 1.012-1H21V4c0-1.103-.897-2-2-2zm0 14H5V5c0-.806.55-.988 1-1h13v12z"></path></svg>
|
<div className="flex md:flex-row flex-col">
|
||||||
</Tab>
|
|
||||||
</Tab.List>
|
|
||||||
|
|
||||||
|
|
||||||
<Tab.Panels className="bg-white border-l w-full p-4 ">
|
|
||||||
<Tab.Panel>
|
<div className="bg-white font-Inter border-dashed border-r-2 border-gray-100 w-full p-4 ">
|
||||||
|
<div>
|
||||||
|
|
||||||
<div className="m-2 flex flex-col">
|
<div className="m-2 flex flex-col">
|
||||||
<span className="font-medium pb-1">Blog Title</span>
|
<span className="font-medium text-sm pb-1">Blog Title</span>
|
||||||
<textarea
|
<textarea
|
||||||
type="text"
|
type="text"
|
||||||
value={this.state.title}
|
value={this.state.title}
|
||||||
placeholder="Enter title here"
|
placeholder="Enter title here"
|
||||||
className="focus:outline-none border text-gray-700 text-xl rounded p-2 h-24"
|
className="focus:outline-none border text-gray-700 text-lg rounded p-2 h-24"
|
||||||
onChange={(e) => this.setState({ title: e.target.value })}
|
onChange={(e) => this.setState({ title: e.target.value })}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex flex-col m-2 ">
|
<div className="flex flex-col m-2 ">
|
||||||
<span className="font-medium pb-1">Author</span>
|
<span className="font-medium text-sm pb-1">Author</span>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
value={this.state.author}
|
value={this.state.author}
|
||||||
placeholder="Author"
|
placeholder="Author"
|
||||||
className="focus:outline-none border text-gray-700 text-xl rounded bg-white p-2"
|
className="focus:outline-none border text-gray-700 text-lg rounded bg-white p-2"
|
||||||
onChange={(e) => this.setState({ author: e.target.value })}
|
onChange={(e) => this.setState({ author: e.target.value })}
|
||||||
></input>
|
></input>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex flex-col m-2 ">
|
<div className="flex flex-col m-2 ">
|
||||||
<span className="font-medium pb-1">Icon</span>
|
<span className="font-medium text-sm pb-1">Icon</span>
|
||||||
<Select value={this.state.icon}
|
<Select value={this.state.icon}
|
||||||
onChange={(selectedOption) => this.setState({ icon: selectedOption })}
|
onChange={(selectedOption) => this.setState({ icon: selectedOption })}
|
||||||
options={this.state.devIconOptions}
|
options={this.state.devIconOptions}
|
||||||
formatOptionLabel={this.formatOptionLabel}
|
formatOptionLabel={this.formatOptionLabel}
|
||||||
className="outline-none focus:outline-none text-xl text-gray-700"
|
className="outline-none focus:outline-none items-center text-lg text-gray-700"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="w-full">
|
||||||
|
|
||||||
{this.state.icon.label === 'custom' ?
|
{this.state.icon.label === 'custom' ?
|
||||||
<div className="flex items-center justify-center m-2">
|
<div className="flex items-center justify-center w-72 mx-auto">
|
||||||
<input type="file"
|
<input type="file"
|
||||||
className="focus:outline-none text-lg cursor-pointer bg-white rounded border"
|
className="focus:outline-none w-full text-lg cursor-pointer bg-white rounded border"
|
||||||
onChange={(e) => this.setState({ 'customIcon': URL.createObjectURL(e.target.files[0]) })}
|
onChange={(e) => this.setState({ 'customIcon': URL.createObjectURL(e.target.files[0]) })}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -145,15 +122,17 @@ class Editor extends React.Component {
|
|||||||
<div></div>
|
<div></div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
|
|
||||||
<div className="flex flex-col m-2 w-1/2">
|
<div className="flex flex-col m-2 w-1/2">
|
||||||
<span className="font-medium pb-1">Font</span>
|
<span className="font-medium text-sm pb-1">Font</span>
|
||||||
|
|
||||||
<select
|
<select
|
||||||
value={this.state.font}
|
value={this.state.font}
|
||||||
onChange={(e) => this.setState({ font: e.target.value })}
|
onChange={(e) => this.setState({ font: e.target.value })}
|
||||||
className="focus:outline-none text-gray-700 text-xl p-2 rounded border">
|
className="focus:outline-none text-gray-700 text-lg p-2 rounded border">
|
||||||
<option>font-serif</option>
|
<option>font-serif</option>
|
||||||
<option>font-sans</option>
|
<option>font-sans</option>
|
||||||
<option>font-mono</option>
|
<option>font-mono</option>
|
||||||
@ -163,13 +142,13 @@ class Editor extends React.Component {
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col m-2 w-1/2">
|
<div className="flex flex-col m-2 w-1/2">
|
||||||
<span className="font-medium pb-1">Color</span>
|
<span className="font-medium text-sm pb-1">Color</span>
|
||||||
<div className="border rounded flex items-center p-2">
|
<div className="border rounded flex items-center p-1">
|
||||||
|
|
||||||
<span className="text-xl text-gray-700 mx-2">{this.state.bgColor}</span>
|
{/* <span className="text-base text-gray-700 mx-2">{this.state.bgColor}</span> */}
|
||||||
<input type="color" value={this.state.bgColor}
|
<input type="color" value={this.state.bgColor}
|
||||||
onChange={(e) => this.setState({ bgColor: e.target.value })}
|
onChange={(e) => this.setState({ bgColor: e.target.value })}
|
||||||
className="h-8 w-8 ml-auto mr-1 rounded"
|
className="h-8 w-full rounded"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -178,11 +157,11 @@ class Editor extends React.Component {
|
|||||||
|
|
||||||
|
|
||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
{/* <div className="flex flex-col m-2 w-1/2">
|
<div className="flex flex-col m-2 w-1/2">
|
||||||
<span className="font-medium pb-1">Pattern</span>
|
<span className="font-medium text-sm pb-1">Pattern</span>
|
||||||
<select
|
<select
|
||||||
onChange={(e) => this.setState({ pattern: e.target.value })}
|
onChange={(e) => this.setState({ pattern: e.target.value })}
|
||||||
className="focus:outline-none border text-xl p-2 rounded"
|
className="focus:outline-none border text-lg p-2 rounded"
|
||||||
value={this.state.pattern}>
|
value={this.state.pattern}>
|
||||||
|
|
||||||
<option>none</option>
|
<option>none</option>
|
||||||
@ -205,15 +184,15 @@ class Editor extends React.Component {
|
|||||||
<option>jupiter</option>
|
<option>jupiter</option>
|
||||||
<option>sun</option>
|
<option>sun</option>
|
||||||
</select>
|
</select>
|
||||||
</div> */}
|
</div>
|
||||||
|
|
||||||
<div className="flex flex-col m-2 w-full">
|
<div className="flex flex-col m-2 w-full">
|
||||||
<span className="font-medium pb-1">Platform</span>
|
<span className="font-medium text-sm pb-1">Platform</span>
|
||||||
|
|
||||||
<select
|
<select
|
||||||
onChange={(e) => this.setState({ platform: e.target.value })}
|
onChange={(e) => this.setState({ platform: e.target.value })}
|
||||||
value={this.state.platform}
|
value={this.state.platform}
|
||||||
className="focus:outline-none text-gray-700 text-xl p-2 rounded border">
|
className="focus:outline-none text-gray-700 text-lg p-2 rounded border">
|
||||||
<option>hashnode</option>
|
<option>hashnode</option>
|
||||||
<option>dev</option>
|
<option>dev</option>
|
||||||
</select>
|
</select>
|
||||||
@ -222,64 +201,20 @@ class Editor extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
className="flex items-center bg-gray-700 text-white rounded-lg mt-6 text-lg font-semibold p-1 px-4 mx-auto border"
|
className="flex items-center bg-gray-700 hover:bg-gray-800 text-white rounded-lg mt-6 text-base p-1 px-4 mx-auto border"
|
||||||
onClick={this.handleReset}>
|
onClick={this.handleReset}>
|
||||||
<span>Reset All</span>
|
<svg xmlns="http://www.w3.org/2000/svg" className="w-5 h-5 text-white mr-2 " fill="currentColor" viewBox="0 0 24 24" ><path d="M12 16c1.671 0 3-1.331 3-3s-1.329-3-3-3-3 1.331-3 3 1.329 3 3 3z"></path><path d="M20.817 11.186a8.94 8.94 0 0 0-1.355-3.219 9.053 9.053 0 0 0-2.43-2.43 8.95 8.95 0 0 0-3.219-1.355 9.028 9.028 0 0 0-1.838-.18V2L8 5l3.975 3V6.002c.484-.002.968.044 1.435.14a6.961 6.961 0 0 1 2.502 1.053 7.005 7.005 0 0 1 1.892 1.892A6.967 6.967 0 0 1 19 13a7.032 7.032 0 0 1-.55 2.725 7.11 7.11 0 0 1-.644 1.188 7.2 7.2 0 0 1-.858 1.039 7.028 7.028 0 0 1-3.536 1.907 7.13 7.13 0 0 1-2.822 0 6.961 6.961 0 0 1-2.503-1.054 7.002 7.002 0 0 1-1.89-1.89A6.996 6.996 0 0 1 5 13H3a9.02 9.02 0 0 0 1.539 5.034 9.096 9.096 0 0 0 2.428 2.428A8.95 8.95 0 0 0 12 22a9.09 9.09 0 0 0 1.814-.183 9.014 9.014 0 0 0 3.218-1.355 8.886 8.886 0 0 0 1.331-1.099 9.228 9.228 0 0 0 1.1-1.332A8.952 8.952 0 0 0 21 13a9.09 9.09 0 0 0-.183-1.814z"></path></svg>
|
||||||
|
<span className="font-Inter">Reset All</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</Tab.Panel>
|
|
||||||
|
|
||||||
|
|
||||||
<Tab.Panel className="h-99 w-full flex flex-col justify-center">
|
|
||||||
|
|
||||||
<div className="flex items-center border rounded-xl border-gray-50 px-4">
|
|
||||||
<h2 className="text-lg pl-2 font-inter font-semibold">Themes</h2>
|
|
||||||
<div className="ml-auto mr-1 p-2">
|
|
||||||
<RandomTheme onThemeChange={this.getRandomTheme} />
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="p-4 flex flex-wrap overflow-y-scroll ">
|
|
||||||
|
|
||||||
<img src={theme7} alt="basic theme"
|
|
||||||
onClick={(e) => this.setState({ theme: "background" })}
|
|
||||||
className=" cursor-pointer border border-gray-100 hover:border-gray-200 hover:scale-105 duration-300 m-2"
|
|
||||||
/>
|
|
||||||
<img src={theme1} alt="basic theme"
|
|
||||||
onClick={(e) => this.setState({ theme: "basic" })}
|
|
||||||
className=" cursor-pointer border-gray-100 hover:scale-105 duration-300 hover:border-gray-200 border m-2 "
|
|
||||||
/>
|
|
||||||
<img src={theme2} alt="basic theme"
|
|
||||||
onClick={(e) => this.setState({ theme: "modern" })}
|
|
||||||
className="cursor-pointer border-gray-100 hover:scale-105 hover:border-gray-200 duration-300 border m-2 "
|
|
||||||
/>
|
|
||||||
<img src={theme3} alt="basic theme"
|
|
||||||
onClick={(e) => this.setState({ theme: "stylish" })}
|
|
||||||
className=" cursor-pointer border border-gray-100 hover:border-gray-200 hover:scale-105 duration-300 m-2"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<img src={theme5} alt="basic theme"
|
|
||||||
onClick={(e) => this.setState({ theme: "outline" })}
|
|
||||||
className=" cursor-pointer border border-gray-100 hover:border-gray-200 hover:scale-105 duration-300 m-2"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<img src={theme4} alt="basic theme"
|
|
||||||
onClick={(e) => this.setState({ theme: "preview" })}
|
|
||||||
className=" cursor-pointer border border-gray-100 hover:border-gray-200 hover:scale-105 duration-300 m-2"
|
|
||||||
/>
|
|
||||||
<img src={theme6} alt="basic theme"
|
|
||||||
onClick={(e) => this.setState({ theme: "mobile" })}
|
|
||||||
className=" cursor-pointer border border-gray-100 hover:border-gray-200 hover:scale-105 duration-300 m-2"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</Tab.Panel>
|
|
||||||
</Tab.Panels>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</Tab.Group>
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
{/* <div className="mx-4 my-1">
|
{/* <div className="mx-4 my-1">
|
||||||
@ -292,17 +227,51 @@ class Editor extends React.Component {
|
|||||||
</select>
|
</select>
|
||||||
</div> */}
|
</div> */}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className=" flex m-6 flex-col items-center justify-center ">
|
{/* cover image preview */}
|
||||||
|
|
||||||
|
<div className=" flex m-2 flex-col items-center justify-center ">
|
||||||
|
|
||||||
<ComponentToImg downloadAs={this.state.download}>
|
<ComponentToImg downloadAs={this.state.download}>
|
||||||
<CoverImage {...this.state} />
|
<CoverImage {...this.state} />
|
||||||
</ComponentToImg>
|
</ComponentToImg>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* themes section */}
|
||||||
|
|
||||||
|
<div className="md:w-60 px-4 border-dashed border-l-2 border-gray-100 bg-white">
|
||||||
|
<div className="h-99 w-full flex flex-col justify-center">
|
||||||
|
|
||||||
|
<div className="flex items-center">
|
||||||
|
<h2 className="text-lg pl-2 font-inter font-semibold">Themes</h2>
|
||||||
|
<div className="ml-auto mr-1 p-2">
|
||||||
|
<RandomTheme onThemeChange={this.getRandomTheme} />
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className=" flex gap-2 flex-wrap justify-center overflow-y-scroll ">
|
||||||
|
|
||||||
|
{
|
||||||
|
THEMES.map(themePlaceholder => (
|
||||||
|
<div className={`${themePlaceholder.label === this.state.theme ? 'border-blue-400 border-2' : ''}`} key={themePlaceholder.label}>
|
||||||
|
|
||||||
|
|
||||||
|
<img src={themePlaceholder.preview} alt={themePlaceholder.label}
|
||||||
|
onClick={(e) => this.setState({ theme: themePlaceholder.label })}
|
||||||
|
className=" cursor-pointer border border-gray-100 hover:border-gray-200 hover:scale-105 duration-300 "
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</ImgProvider>
|
</ImgProvider>
|
||||||
</div>
|
</div>
|
||||||
|
@ -3,21 +3,21 @@ import { Link } from 'react-router-dom'
|
|||||||
import logo from '../assets/icons/logo.png'
|
import logo from '../assets/icons/logo.png'
|
||||||
const Header = () => {
|
const Header = () => {
|
||||||
|
|
||||||
const tweetText = encodeURIComponent(`type your thoughts here, Try https://coverview.vercel.app by @WankhadeRutik`)
|
const tweetText = encodeURIComponent(`type your thoughts here, Try https://coverview.vercel.app by @rutikdotdev`)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
||||||
<div className="text-xl md:px-2 flex border-b border-gray-100 p-2">
|
<div className="text-xl md:px-2 flex border-dashed border-b-2 border-gray-100 p-2">
|
||||||
<Link to="/" className="flex items-center">
|
<Link to="/" className="flex items-center">
|
||||||
<img src={logo} alt="logo" className="w-8 h-8 mx-4" />
|
<img src={logo} alt="logo" className="w-8 h-8 mx-4" />
|
||||||
<h1 className="font-semibold">Coverview</h1>
|
<h1 className="font-semibold">Coverview</h1>
|
||||||
|
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
<div className="ml-auto md:mr-4 ">
|
<div className="ml-auto md:mr-4 flex items-center ">
|
||||||
<Link to="/faq" className="text-gray-700 hover:text-gray-800 text-base font-Nunito mx-4"><span className="hidden md:inline-block">How to use</span></Link>
|
{/* <Link to="/faq" className="text-gray-700 hover:text-gray-800 text-base font-Nunito mx-4"><span className="hidden md:inline-block">How to use</span></Link> */}
|
||||||
<a href="https://www.buymeacoffee.com/rutikwankhade" target="_blank" rel="noreferrer" className="text-base mx-2 font-Nunito">🥤 <span className="hidden md:inline-block">Buy me a coffee</span></a>
|
<a href="https://github.com/rutikwankhade/CoverView" target="_blank" rel="noreferrer" className="bg-gray-700 hover:bg-gray-800 px-4 rounded-full p-1 text-white md:text-sm md:flex hidden items-center text-xs mx-2 font-Nunito">⭐ Star on Github</a>
|
||||||
<a href={`https://twitter.com/intent/tweet?text=${tweetText}`} className="mx-2 bg-blue-400 md:text-sm text-xs rounded-full px-4 font-semibold text-white p-1">Share on Twitter</a>
|
<a href={`https://x.com/intent/tweet?text=${tweetText}`} className="mx-2 bg-blue-400 hover:bg-blue-500 md:text-sm text-xs rounded-full px-4 font-semibold text-white p-1">Share on Twitter</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
.shuffle-btn:active{
|
.shuffle-btn:active{
|
||||||
transform: rotate(360deg);
|
transform: rotate(720deg);
|
||||||
transition: all 0.2s ease-out;
|
transition: all 0.6s ease-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bi-shuffle{
|
.bi-shuffle{
|
||||||
height: 30px;
|
height: 20px;
|
||||||
width: 30px;
|
width: 20px;
|
||||||
opacity: 0.6;
|
opacity: 0.6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,8 +108,8 @@ class RandomTheme extends React.Component {
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col justify-center">
|
<div className="flex flex-col justify-center">
|
||||||
<div className="shuffle-btn w-10 flex justify-center items-center shadow-xl shadow-gray-100 h-10 p-2 bg-indigo-400 rounded-xl cursor-pointer" onClick={this.changeTheme}>
|
<div className="shuffle-btn flex justify-center items-center p-2 cursor-pointer" onClick={this.changeTheme}>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" className="text-white w-10 h-10" width="24" height="24" viewBox="0 0 24 24" ><path d="M17 17h-1.559l-9.7-10.673A1 1 0 0 0 5.001 6H2v2h2.559l4.09 4.5-4.09 4.501H2v2h3.001a1 1 0 0 0 .74-.327L10 13.987l4.259 4.686a1 1 0 0 0 .74.327H17v3l5-4-5-4v3z"></path><path d="M15.441 8H17v3l5-3.938L17 3v3h-2.001a1 1 0 0 0-.74.327l-3.368 3.707 1.48 1.346L15.441 8z"></path></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" className="text-gray-600 hover:text-gray-700 " width="20" height="20" viewBox="0 0 24 24" ><path d="M17 17h-1.559l-9.7-10.673A1 1 0 0 0 5.001 6H2v2h2.559l4.09 4.5-4.09 4.501H2v2h3.001a1 1 0 0 0 .74-.327L10 13.987l4.259 4.686a1 1 0 0 0 .74.327H17v3l5-4-5-4v3z"></path><path d="M15.441 8H17v3l5-3.938L17 3v3h-2.001a1 1 0 0 0-.74.327l-3.368 3.707 1.48 1.346L15.441 8z"></path></svg>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -2,11 +2,11 @@ import React from 'react';
|
|||||||
|
|
||||||
|
|
||||||
const BasicTheme = ({ config }) => {
|
const BasicTheme = ({ config }) => {
|
||||||
const { title, bgColor, pattern, author, icon, font, customIcon,platform } = config;
|
const { title, bgColor, pattern, author, icon, font, customIcon } = config;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="p-4 bg-white ">
|
<div className=" bg-white w-full h-full ">
|
||||||
<div className={`overflow-y-hidden flex text-gray-800 items-center h-full ${platform} ${pattern} `}
|
<div className={`overflow-y-hidden flex text-gray-800 items-center h-full ${pattern} `}
|
||||||
style={{ backgroundColor: bgColor }}
|
style={{ backgroundColor: bgColor }}
|
||||||
>
|
>
|
||||||
|
|
||||||
|
@ -1,22 +1,22 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
const MobileMockupTheme = ({ config }) => {
|
const MobileMockupTheme = ({ config }) => {
|
||||||
const { bgColor, platform, title,font } = config;
|
const { bgColor, title, font } = config;
|
||||||
|
|
||||||
const [image, setImage] = useState()
|
const [image, setImage] = useState()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="p-4 bg-white">
|
<div className={`bg-white w-full h-full`}>
|
||||||
|
|
||||||
|
|
||||||
<div className={`overflow-y-hidden flex flex-row px-10 items-center justify-center rounded px-8 pt-4 ${platform}`}
|
<div className={`overflow-y-hidden flex flex-row px-10 items-center w-full h-full justify-center pt-4`}
|
||||||
style={{ backgroundColor: bgColor }}
|
style={{ backgroundColor: bgColor }}
|
||||||
>
|
>
|
||||||
|
|
||||||
|
|
||||||
<h1 className={`${font} text-2xl w-1/2 md:text-4xl px-4 text-white font-bold text-left`}>{title}</h1>
|
<h1 className={`${font} text-2xl w-1/2 md:text-4xl px-4 text-white font-bold text-left`}>{title}</h1>
|
||||||
|
|
||||||
<div className="w-5/12 mx-auto m-4 mt-10 group mx-auto h-full shadow-lg flex flex-col bg-white border-t-8 border-x-8 border-gray-800 rounded-t-3xl border-white">
|
<div className="w-5/12 mx-auto m-4 mt-10 group h-full shadow-lg flex flex-col bg-white border-t-8 border-x-8 border-gray-800 rounded-t-3xl border-white">
|
||||||
<div className="bg-gray-800 h-8 w-full p-2 pb-3 flex items-center rounded-t">
|
<div className="bg-gray-800 h-8 w-full p-2 pb-3 flex items-center rounded-t">
|
||||||
|
|
||||||
<div className="flex mx-auto items-center">
|
<div className="flex mx-auto items-center">
|
||||||
|
@ -3,12 +3,12 @@ import React from 'react';
|
|||||||
|
|
||||||
const ModernTheme = ({ config }) => {
|
const ModernTheme = ({ config }) => {
|
||||||
|
|
||||||
const { title, bgColor, pattern, author, icon, font, customIcon, platform } = config;
|
const { title, bgColor, pattern, author, icon, font, customIcon } = config;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-full p-4 bg-white ">
|
<div className="w-full h-full bg-white ">
|
||||||
<div className=" overflow-y-hidden w-full flex items-center">
|
<div className=" overflow-y-hidden w-full h-full flex items-center">
|
||||||
<div className={` h-full w-full rounded-xl p-4 text-gray-800 flex items-center ${pattern} ${platform}`}
|
<div className={` h-full w-full p-4 text-gray-800 flex items-center ${pattern} `}
|
||||||
style={{ backgroundColor: bgColor }}
|
style={{ backgroundColor: bgColor }}
|
||||||
>
|
>
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
const OutlineTheme = ({ config }) => {
|
const OutlineTheme = ({ config }) => {
|
||||||
const { title, bgColor, author, icon, font, customIcon, platform } = config;
|
const { title, bgColor, author, icon, font, customIcon } = config;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="p-4 bg-white ">
|
<div className="w-full h-full bg-white ">
|
||||||
|
|
||||||
|
|
||||||
<div className={`overflow-y-hidden rounded flex flex-col text-gray-800 px-10 ${platform} `}
|
<div className={`overflow-y-hidden flex flex-col text-gray-800 px-10 h-full`}
|
||||||
style={{ backgroundColor: bgColor }}
|
style={{ backgroundColor: bgColor }}
|
||||||
>
|
>
|
||||||
|
|
||||||
|
@ -1,19 +1,18 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
const PreviewTheme = ({ config }) => {
|
const PreviewTheme = ({ config }) => {
|
||||||
const { bgColor, platform, title, font } = config;
|
const { bgColor, title, font } = config;
|
||||||
|
|
||||||
const [image, setImage] = useState()
|
const [image, setImage] = useState()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="p-4 bg-white">
|
<div className="w-full h-full bg-white">
|
||||||
|
|
||||||
|
|
||||||
<div className={`overflow-y-hidden flex flex-col rounded px-4 pt-4 ${platform}`}
|
<div className={`overflow-y-hidden flex flex-col px-4 pt-4 w-full h-full`}
|
||||||
style={{ backgroundColor: bgColor }}
|
style={{ backgroundColor: bgColor }}
|
||||||
>
|
>
|
||||||
|
|
||||||
|
|
||||||
<h1 className={`${font} text-2xl md:text-3xl p-10 text-white font-bold text-center`}>{title}</h1>
|
<h1 className={`${font} text-2xl md:text-3xl p-10 text-white font-bold text-center`}>{title}</h1>
|
||||||
|
|
||||||
<div className="w-10/12 group mx-auto mt-auto mb-0 shadow-lg flex flex-col bg-white rounded-t-xl border-white">
|
<div className="w-10/12 group mx-auto mt-auto mb-0 shadow-lg flex flex-col bg-white rounded-t-xl border-white">
|
||||||
@ -30,7 +29,6 @@ const PreviewTheme = ({ config }) => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{image ?
|
{image ?
|
||||||
<div className="">
|
<div className="">
|
||||||
<img src={image && image} className="object-cover " alt="preview" />
|
<img src={image && image} className="object-cover " alt="preview" />
|
||||||
@ -48,13 +46,8 @@ const PreviewTheme = ({ config }) => {
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ import unsplash from "../../utils/unsplashConfig";
|
|||||||
import { ImgContext } from '../../utils/ImgContext';
|
import { ImgContext } from '../../utils/ImgContext';
|
||||||
|
|
||||||
const StylishTheme = ({ config }) => {
|
const StylishTheme = ({ config }) => {
|
||||||
const { title, author, font, icon, customIcon, platform,bgColor } = config;
|
const { title, author, font, icon, customIcon, bgColor } = config;
|
||||||
|
|
||||||
// const [image, setImage] = useState({})
|
// const [image, setImage] = useState({})
|
||||||
|
|
||||||
@ -65,14 +65,14 @@ const StylishTheme = ({ config }) => {
|
|||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className=" bg-white rounded">
|
<div className=" bg-white w-full h-full">
|
||||||
|
|
||||||
|
|
||||||
<div className={` overflow-y-hidden flex flex-col rounded ${platform}`}
|
<div className={` overflow-y-hidden flex flex-col`}
|
||||||
style={{ backgroundColor: bgColor }}
|
style={{ backgroundColor: bgColor }}
|
||||||
>
|
>
|
||||||
|
|
||||||
<div className="flex flex-row items-center bg-white justify-center m-4 ">
|
<div className="flex flex-row items-center bg-white justify-center">
|
||||||
|
|
||||||
<div className="h-full w-1/2 bg-white rounded-l-xl">
|
<div className="h-full w-1/2 bg-white rounded-l-xl">
|
||||||
<div className={`${font} px-12 justify-center text-left rounded-xl h-full p-4 flex flex-col`}>
|
<div className={`${font} px-12 justify-center text-left rounded-xl h-full p-4 flex flex-col`}>
|
||||||
|
41
src/utils/constants.js
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
|
||||||
|
|
||||||
|
import backgroundThemePlaceholder from '../assets/images/background-theme-placeholder.webp'
|
||||||
|
import basicThemePlaceholder from '../assets/images/basic-theme-placeholder.webp'
|
||||||
|
import modernThemePlaceholder from '../assets/images/modern-theme-placeholder.webp'
|
||||||
|
import stylishThemePlaceholder from '../assets/images/stylish-theme-placeholder.webp'
|
||||||
|
import outlineThemePlaceholder from '../assets/images/outline-theme-placeholder.webp'
|
||||||
|
import previewThemePlaceholder from '../assets/images/preview-theme-placeholder.webp'
|
||||||
|
import mobileThemePlaceholder from '../assets/images/mobile-theme-placeholder.webp'
|
||||||
|
|
||||||
|
|
||||||
|
export const THEMES = [
|
||||||
|
{
|
||||||
|
label: 'background',
|
||||||
|
preview: backgroundThemePlaceholder
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'basic',
|
||||||
|
preview: basicThemePlaceholder
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'modern',
|
||||||
|
preview: modernThemePlaceholder
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'stylish',
|
||||||
|
preview: stylishThemePlaceholder
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'outline',
|
||||||
|
preview: outlineThemePlaceholder
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'preview',
|
||||||
|
preview: previewThemePlaceholder
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'mobile',
|
||||||
|
preview: mobileThemePlaceholder
|
||||||
|
},
|
||||||
|
]
|