Skip to content

Commit 84e7e40

Browse files
committed
Responsive
1 parent f80fd9d commit 84e7e40

File tree

2 files changed

+73
-35
lines changed

2 files changed

+73
-35
lines changed

src/Components/CSS/Main.css

Lines changed: 57 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
#main-div{
2+
height: 100%;
3+
width: 100%;
4+
position: relative;
5+
z-index: 1;
6+
}
7+
18
#navbar {
29
text-align: center ;
310
background-image: url("../Images/Navbg.png");
@@ -51,29 +58,31 @@ textarea:focus, input:focus, button:focus{
5158
}
5259

5360
.leaflet-container {
54-
height: 66.5vh;
61+
height: 68vh;
5562
width: 100%;
5663
}
5764

5865
.displaybox{
5966
font-family: 'Varela Round', sans-serif;
60-
z-index: 1000;
61-
background-color: white;
67+
background-color: rgb(255, 255, 255);
6268
position: absolute;
63-
top:165px;
64-
min-height:150px;
69+
z-index: 100;
70+
margin-top: -75px;
6571
border-radius: 15px;
6672
box-shadow: rgba(149, 157, 165, 0.2) 0px 8px 24px;
67-
left: 0;
68-
right: 0;
69-
margin-left: auto;
70-
margin-right: auto;
73+
margin-left: 90px;
74+
margin-right: 90px;
75+
left:0;
76+
right: 0;
7177
padding-top: 30px;
7278
padding-bottom: 0px;
7379
}
80+
.rowStyle{
81+
border-radius: 15px;
7482

83+
}
7584
.cols{
76-
margin-left: 15px;
85+
text-align: center;
7786
}
7887

7988
.bods{
@@ -90,13 +99,19 @@ textarea:focus, input:focus, button:focus{
9099
font-weight: 900;
91100
}
92101

102+
#maps{
103+
z-index: 5;
93104

105+
}
94106

95107
@media only screen and (max-device-width: 500px) {
96108

97109
.displaybox{
110+
margin-top: -110px;
111+
margin-left: 30px;
112+
margin-right: 30px;
98113

99-
top:150px;
114+
100115

101116
}
102117

@@ -122,27 +137,51 @@ textarea:focus, input:focus, button:focus{
122137
color: white;
123138
padding-top: 20px;
124139
padding-bottom: 20px;
125-
font-size: 28px;
140+
font-size: 25px;
126141
}
127142

128143
.leaflet-container {
129144
height: 90vh;
130145

131146
}
132147

133-
.cols{
134-
text-align: center;
135-
148+
.cols p{
149+
font-size: 10px;
136150
}
137151

152+
.cols h4{
153+
font-size: 18px;
154+
}
155+
156+
157+
::placeholder {
158+
font-size: 13px;
159+
}
160+
138161

162+
163+
}
164+
165+
166+
@media only screen and (max-device-width: 800px) and (min-device-width: 500px) {
167+
168+
169+
170+
.displaybox{
171+
margin-top: -80px;
172+
margin-left: 50px;
173+
margin-right: 50px;
174+
175+
}
176+
139177
.cols p{
140-
font-size: 12px;
178+
font-size: 15px;
141179
}
142180

143181
.cols h4{
144-
font-size: 23px;
182+
font-size: 21px;
145183
}
146184

147-
185+
186+
148187
}

src/Components/JSX/Main.jsx

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { Component } from 'react';
22
import '../CSS/Main.css'
33
import {MapContainer, TileLayer, Marker } from 'react-leaflet'
44
import L from 'leaflet';
5-
import { Col, Row , Container } from 'react-bootstrap';
5+
import { Col, Row } from 'react-bootstrap';
66
import { ReactComponent as Arrow } from '../Images/icon-arrow.svg';
77

88
const publicIp = require('public-ip');
@@ -81,7 +81,7 @@ class Main extends Component {
8181
lng:data.data.location.lng,
8282
ip: data.data.ip,
8383
isp:data.data.isp,
84-
time:data.data.location.timezone,
84+
time: "UTC" + " " + data.data.location.timezone,
8585
loc:data.data.location.city + ", " +data.data.location.region + ", " + data.data.location.country ,
8686
position:[data.data.location.lat, data.data.location.lng]
8787

@@ -101,9 +101,18 @@ class Main extends Component {
101101

102102
render() {
103103
return (
104-
<div>
105-
<Container className="displaybox " >
106-
<Row className="rowstyle" style={{paddingBottom:"20px"}}>
104+
<div id="main-div" >
105+
<div id="navbar">
106+
107+
<h2>IP Address Tracker</h2>
108+
<form type="submit" onSubmit={ this.handleSubmit }>
109+
<input type="text" placeholder="Search for any IP address or domain" value={this.state.ipaddress} onChange={this.handleChange} />
110+
<button>< Arrow/></button>
111+
</form>
112+
</div>
113+
114+
<div className="displaybox" >
115+
<Row className="rowstyle" style={{paddingBottom:"20px",}}>
107116
<Col md className="cols bods ">
108117
<p>IP ADDRESS</p>
109118
<h4>{this.state.ip}</h4>
@@ -116,28 +125,18 @@ class Main extends Component {
116125

117126
<Col md className="cols bods">
118127
<p>TIMEZONE</p>
119-
<h4>UTC {this.state.time}</h4>
128+
<h4>{this.state.time}</h4>
120129
</Col>
121130

122131
<Col md style={{marginRight:"10px"}} className="cols">
123132
<p>ISP</p>
124133
<h4>{this.state.isp}</h4>
125134
</Col>
126135
</Row>
127-
</Container>
128-
129-
130-
<div id="navbar">
131-
132-
<h2>IP Address Tracker</h2>
133-
<form type="submit" onSubmit={ this.handleSubmit }>
134-
<input type="text" placeholder="Search for any IP address or domain" value={this.state.ipaddress} onChange={this.handleChange} />
135-
<button>< Arrow/></button>
136-
</form>
137136
</div>
138137

139138

140-
<MapContainer center={{ lat: 51.505, lng: -0.09 }} zoom={5} whenCreated={map => this.setState({ map })}>
139+
<MapContainer id="maps" center={{ lat: 51.505, lng: -0.09 }} zoom={5} whenCreated={map => this.setState({ map })}>
141140
<TileLayer
142141
attribution='&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
143142
url='https://{s}.tile.osm.org/{z}/{x}/{y}.png'

0 commit comments

Comments
 (0)