style: download btn and card style changes

This commit is contained in:
rutik wankhade 2020-08-10 22:43:39 +05:30
parent 111d355545
commit a348fb13f9
5 changed files with 32 additions and 38 deletions

View File

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import { exportComponentAsJPEG, exportComponentAsPNG } from "react-component-export-image"; import { exportComponentAsJPEG, exportComponentAsPNG } from "react-component-export-image";
// import CoverImage from './CoverImage' // import CoverImage from './CoverImage'
import './CoverImage.css'
class ComponentToImg extends React.Component { class ComponentToImg extends React.Component {
@ -11,6 +11,8 @@ class ComponentToImg extends React.Component {
} }
render() { render() {
console.log(this.props.children);
return ( return (
<React.Fragment> <React.Fragment>
@ -18,12 +20,12 @@ class ComponentToImg extends React.Component {
{this.props.children} {this.props.children}
</div> </div>
<button onClick={() => exportComponentAsJPEG(this.componentRef)}> {/* <button onClick={() => exportComponentAsJPEG(this.componentRef)}>
Export As JPEG Export As JPEG
</button> </button> */}
<button onClick={() => exportComponentAsPNG(this.componentRef)}> <button onClick={() => exportComponentAsPNG(this.componentRef)}>
Export As PNG Download
</button> </button>
</React.Fragment>); </React.Fragment>);
} }

View File

@ -14,7 +14,7 @@ input{margin:4px;}
.inputTitle{ .inputTitle{
height:40px; height:40px;
width:300px; width:350px;
border-radius:4px; border-radius:4px;
padding-left:20px; padding-left:20px;
} }

View File

@ -8,9 +8,8 @@ class ConfigCover extends React.Component {
state = { state = {
title: 'How I built my first project with react', title: 'How I built my first project with react',
bgcolor: '', bgcolor: '',
bxshadow: '', border: ''
height:null,
width:null
}; };
render() { render() {
@ -21,23 +20,23 @@ class ConfigCover extends React.Component {
<input type="text" placeholder="Enter title here" className="inputTitle" <input type="text" placeholder="Enter title here" className="inputTitle"
onChange={e => this.setState({ title: e.target.value })}></input> onChange={e => this.setState({ title: e.target.value })}></input>
<div className="d-flex flex-row"> {/* <div className="d-flex flex-row">
<label >width</label> <label >width</label>
<input type="number" className="input-sm" <input type="number" className="input-sm"
onChange={e=>this.setState({width: e.target.value})}></input> onChange={e=>this.setState({width: e.target.value})}></input>
<label >height</label> <label >height</label>
<input type="number" className="input-sm" <input type="number" className="input-sm"
onChange={e=>this.setState({height: e.target.value})}></input> onChange={e=>this.setState({height: e.target.value})}></input>
</div> </div> */}
<label>Background</label> <label>Background</label>
<input type="color" defaultValue="#c5a8ff" <input type="color" defaultValue="#c5a8ff"
onChange={e => this.setState({ bgcolor: e.target.value })} /> onChange={e => this.setState({ bgcolor: e.target.value })} />
<label>box-shadow</label> <label>border</label>
<input type="color" defaultValue="#8c52ff" <input type="color" defaultValue="#8c52ff"
onChange={e => this.setState({ bxshadow: e.target.value })} /> onChange={e => this.setState({ border: e.target.value })} />
</div> </div>
@ -47,9 +46,8 @@ class ConfigCover extends React.Component {
title={this.state.title} title={this.state.title}
bgcolor={this.state.bgcolor} bgcolor={this.state.bgcolor}
bxshadow={this.state.bxshadow} border={this.state.border}
height={this.state.height}
width={this.state.width}
/> />

View File

@ -1,38 +1,33 @@
.container{
margin:auto;
justify-content: center;
align-items: center;
overflow: hidden;
}
.cover{ .cover{
/* width:800px;
height:420px; */
background-color: #c5a8ff; background-color: #c5a8ff;
text-align: center; text-align: center;
position:relative; justify-content: center;
align-items: center;
height:420px;
width:800px;
padding:90px;
} }
.card{ .card{
height:auto;
width:auto;
border-radius: 10px; border-radius: 10px;
margin:50px;
background-color: #ffffff; background-color: #ffffff;
display:inline-block;
/* box-shadow: 10px 10px #8c52ff; */
position:relative;
text-align: center; text-align: center;
color:#676683; color:#676683;
border:none;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
vertical-align: middle; vertical-align: middle;
padding:50px; padding:50px;
} }
h1{height:auto;} h1{height:auto;}
button{background-color: #8c52ff;
color:#ffffff;
border:none;
border-radius:4px;
padding:10px;
margin:20px;}

View File

@ -7,15 +7,14 @@ class CoverImage extends React.Component {
render() { render() {
return ( return (
<div className="img-fluid"> <div className="cover"
<div className="cover container " style={{ backgroundColor:this.props.bgcolor }}>
style={{ backgroundColor:this.props.bgcolor, height: this.props.height, width: this.props.width }}>
<div className="card" <div className="card"
style={{ border: `15px ${this.props.bxshadow}` }}> style={{ borderTop: `15px solid ${this.props.border}`}}>
<h1>{this.props.title}</h1> <h1>{this.props.title}</h1>
</div> </div>
</div> </div>
</div>
); );
} }