mirror of
https://github.com/woodchen-ink/CoverView.git
synced 2025-07-18 14:01:56 +08:00
feat:added imgconfig component
This commit is contained in:
parent
fd6f64a17d
commit
682ceafbcc
@ -1,5 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import CoverImage from './CoverImage';
|
import ConfigCover from './ConfigCover';
|
||||||
|
|
||||||
|
|
||||||
class App extends React.Component {
|
class App extends React.Component {
|
||||||
@ -7,8 +7,10 @@ class App extends React.Component{
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
|
<div>
|
||||||
|
<ConfigCover />
|
||||||
|
</div>
|
||||||
|
|
||||||
<CoverImage/>
|
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
|
12
src/components/ConfigCover.css
Normal file
12
src/components/ConfigCover.css
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
.container{
|
||||||
|
margin:20px;
|
||||||
|
display:flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
label{margin:5px;}
|
||||||
|
.input-sm{width:60px;}
|
||||||
|
input{margin:4px;}
|
63
src/components/ConfigCover.js
Normal file
63
src/components/ConfigCover.js
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import './ConfigCover.css'
|
||||||
|
import CoverImage from './CoverImage';
|
||||||
|
class ConfigCover extends React.Component {
|
||||||
|
|
||||||
|
state = {
|
||||||
|
title: 'How I built my first project with react',
|
||||||
|
height: 420,
|
||||||
|
width: 800,
|
||||||
|
bgcolor: '',
|
||||||
|
bxshadow: ''
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div className="container">
|
||||||
|
|
||||||
|
|
||||||
|
<input type="text" placeholder="Enter title here"
|
||||||
|
onChange={e=>this.setState({title:e.target.value})}></input>
|
||||||
|
|
||||||
|
<div className="d-flex flex-row">
|
||||||
|
<label >width</label>
|
||||||
|
<input type="number" name="width" className="input-sm"
|
||||||
|
onChange={e=>this.setState({width:e.target.value})}></input>
|
||||||
|
<label >height</label>
|
||||||
|
<input type="number" name="height" className="input-sm"
|
||||||
|
onChange={e=>this.setState({height:e.target.value})}></input>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<label>Background</label>
|
||||||
|
<input type="color" defaultValue="#c5a8ff"
|
||||||
|
onChange={e=>this.setState({bgcolor:e.target.value})}/>
|
||||||
|
|
||||||
|
<label>box-shadow</label>
|
||||||
|
<input type="color" defaultValue="#8c52ff"
|
||||||
|
onChange={e=>this.setState({bxshadow:e.target.value})} />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<CoverImage
|
||||||
|
title={this.state.title}
|
||||||
|
bgcolor={this.state.bgcolor}
|
||||||
|
bxshadow={this.state.bxshadow}
|
||||||
|
height={this.state.height}
|
||||||
|
width={this.state.width}
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ConfigCover;
|
@ -1,5 +1,11 @@
|
|||||||
.cover{
|
|
||||||
|
.container{
|
||||||
margin:auto;
|
margin:auto;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.cover{
|
||||||
|
|
||||||
width:auto;
|
width:auto;
|
||||||
height:auto;
|
height:auto;
|
||||||
background-color: #c5a8ff;
|
background-color: #c5a8ff;
|
||||||
@ -8,13 +14,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.card{
|
.card{
|
||||||
height:150px;
|
height:auto;
|
||||||
min-width:400px;
|
width:auto;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
margin:50px;
|
margin:50px;
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
display:inline-block;
|
display:inline-block;
|
||||||
box-shadow: 10px 10px #8c52ff;
|
box-shadow: 10px 10px #8c52ff;
|
||||||
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color:#676683;
|
color:#676683;
|
||||||
border:none;
|
border:none;
|
||||||
@ -25,3 +32,5 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
h1{height:auto;}
|
h1{height:auto;}
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,11 +5,15 @@ import './CoverImage.css';
|
|||||||
class CoverImage extends React.Component {
|
class CoverImage extends React.Component {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div className="cover img-fluid">
|
<div className="cover container"
|
||||||
<div className="card">
|
style={{ backgroundColor: this.props.bgcolor, height: this.props.height, width: this.props.width }}>
|
||||||
<h2>5 Simple apps I built while learning JavaScript</h2>
|
<div className="card"
|
||||||
|
style={{ boxShadow: `15px 15px ${this.props.bxshadow}` }}>
|
||||||
|
<h1>{this.props.title}</h1>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user