mirror of
https://github.com/Noratrieb/hugos-lieblingsflugzeuge.git
synced 2026-01-16 20:55:05 +01:00
hugo
This commit is contained in:
parent
4e2d32cf04
commit
9bb74df734
6 changed files with 14 additions and 13 deletions
|
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 492 KiB After Width: | Height: | Size: 492 KiB |
|
|
@ -1,15 +1,14 @@
|
||||||
import React, {Component} from "react";
|
import React, {Component} from "react";
|
||||||
import ModelImage from "./Plane";
|
import ModelImage from "./Plane";
|
||||||
import f22 from './img/f22.png'
|
|
||||||
|
|
||||||
class Home extends Component {
|
class Home extends Component {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h1>Hugos Favoriten</h1>
|
<h1>Hugos Favoriten</h1>
|
||||||
<ModelImage img={f22} name="F-22 Raptor"/>
|
<ModelImage src="f22.png" name="F-22 Raptor"/>
|
||||||
</div>
|
</div>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,16 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ModelImage from './Plane'
|
import ModelImage from './Plane'
|
||||||
import f22 from './img/f22.png'
|
|
||||||
import harrier from './img/harrier.jpg'
|
|
||||||
|
|
||||||
class Modern extends React.Component {
|
class Modern extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
const items = Array(100).fill(1).map((x, y) => x + y)
|
const items = Array(100).fill(1).map((x, y) => x + y)
|
||||||
.map(x => <ModelImage img={f22} name={'F' + (20 + x) + ' Raptor'}/>);
|
.map(x => <ModelImage src="f22.png" name={'F' + (20 + x) + ' Raptor'}/>);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{items}
|
{items}
|
||||||
<ModelImage img={harrier} name="AV-8B Harrier"/>
|
<ModelImage src="harrier.jpg" name="AV-8B Harrier"/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
:root {
|
||||||
|
--model-image-height: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
.model {
|
.model {
|
||||||
position: relative;
|
position: relative;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
@ -26,7 +30,7 @@
|
||||||
left: 50%;
|
left: 50%;
|
||||||
transform: translate(-50%, -50%);
|
transform: translate(-50%, -50%);
|
||||||
|
|
||||||
line-height: 200px;
|
line-height: var(--model-image-height);
|
||||||
}
|
}
|
||||||
|
|
||||||
.model:hover .model-info {
|
.model:hover .model-info {
|
||||||
|
|
@ -35,7 +39,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.model img {
|
.model img {
|
||||||
height: 200px;
|
height: var(--model-image-height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,20 +6,19 @@ class ModelImage extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
img: '',
|
|
||||||
name: '',
|
name: '',
|
||||||
|
src: '',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static getDerivedStateFromProps(props) {
|
static getDerivedStateFromProps(props) {
|
||||||
return {img: props.img, name: props.name};
|
return {name: props.name, src: props.src};
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
//const style = {backgroundImage: `url('/img/${this.state.img}')`};
|
|
||||||
return (
|
return (
|
||||||
<a href="" className="model">
|
<a href="" className="model">
|
||||||
<img src={this.state.img} alt={this.state.name}/>
|
<img src={process.env.PUBLIC_URL + '/img/' + this.state.src} alt={this.state.name}/>
|
||||||
<div className="model-info">
|
<div className="model-info">
|
||||||
<span className="model-info-text">{this.state.name}</span>
|
<span className="model-info-text">{this.state.name}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue