From e95bb21532a07242ce34aa4aeea23ee6a56ad6af Mon Sep 17 00:00:00 2001
From: rui hildt
Date: Mon, 10 Feb 2020 03:09:47 +0100
Subject: [PATCH] Improve styling
---
src/App.js | 14 +-----
src/assets/arrow-right.png | Bin 0 -> 2066 bytes
src/components/HomeView.jsx | 97 ++++++++++++++++++++++++++----------
3 files changed, 73 insertions(+), 38 deletions(-)
create mode 100644 src/assets/arrow-right.png
diff --git a/src/App.js b/src/App.js
index d96e822..7bd817a 100644
--- a/src/App.js
+++ b/src/App.js
@@ -1,22 +1,12 @@
import React from 'react';
-import { Layout } from 'antd';
import HomeView from './components/HomeView';
-import 'antd/dist/antd.css';
-import styled from 'styled-components';
function App() {
return (
-
- Dijkstra
- Find the shortest path between different cities in Belgium with Dijkstra algorithm.
+ <>
-
+ >
);
}
export default App;
-
-const MainSection = styled.main`
- max-width: 800px;
- margin: 0 auto;
-`
\ No newline at end of file
diff --git a/src/assets/arrow-right.png b/src/assets/arrow-right.png
new file mode 100644
index 0000000000000000000000000000000000000000..b35ba0208ff05b9ae294643cf904fce098a9b4ae
GIT binary patch
literal 2066
zcmWladpy(oAIEpGVVmVrGa~$yPOMQ5Dsz-WZa+)4F}KqkSMOm)>$YlvNV|B`L
ziZ&<7hG~?D(B+U{Mw?4fVLytZ@%#8b9-r6e`F+3NpV#~I`Tp_w{>Pi_s)5o+K_Czf
zcQ@w~U`_=?s)hvGIvZvVCY3}dcZwQ#($zvQfp>L=n_nUXf_<_%pk)@=?I5U^a_7c8+wY;*gUr)6R2U#Ulr#^$snMy+BbyjA7y(^ebM9ov_dnfn51QJl*419I*Rwo((7V-ZM`H!s){kf2XB*to~wD`G^=FA*AT2@QbAesT^v3e
zQwBarooa5ZDHDcoDUj;XXUr06SvS*qs^Gb?CgIAvz205tnobwEuSfNh$qFB~+1b|<
z#M_)HGW=I%PnBwJ3mcLC$e)d9tJ4P}cw2%+{ei9x6N*#ms^b!j`73?nbmk;T%`yh
zeearO-#GF~30E-?yOsVBTa%J&BHL%CMqN)nJm9!e9lvZ4{H|s7QltpUk%e{%1MMF#
zab(VWZTh_?KciK+q3A}A>KKB11iIxn#~JOaVhg$i@{Isc;
zqWwh1XZC_hTisjWG&*z%4MTqHLO^{B(T1vgL)}9dDI##@Cx$NrdZ9dFX{(D;pZncx
z4>9RXX5vQCEzM-4ut4}iOU9pYQf0MXMwh{vhPviR-25@BIzd`>7mk}BzYD|7XHnq<
zX;vMKCd~6CH86_#5p+3LK%>ixeAtpsL-7PF$No1LD4O{rABvj~-3B#KU*UIE3Dk8_
z5ZruHmGwE>2&L?fazC{Uiun
zrO=hX%;F@S{nnO1n(ti9sbro6D>lrKxL7@}FJkvP<+{6-oo4KEp+mCt%SxNQ&%H6HZaWZ&
z5e^1n8Vi;>3db`b6O{@g<+q%7(GpnQnOf#_K7Rou7RkA#17aA(o=|U~Q|iuseAH
zAAU+Rb~Od-ms?D_cLz>AI`{8}#JE&i+{w~P-?V{#3uT9@q)~_86v;h*d^1%2tR-*F
zLAYQ>`#{Vs= (
- { from: edge.start_city_id, to: edge.end_city_id, length: edge.distance }
+ { from: edge.start_city_id, to: edge.end_city_id, length: edge.distance * 2 }
))
setGraph({nodes, edges})
@@ -69,6 +72,7 @@ function HomeView() {
function handleSubmit() {
if (startingPoint === destination) {
+ setError({ message: 'Please select a start and a destination', flag: true});
return
} else
if (startingPoint && destination) {
@@ -117,14 +121,16 @@ function HomeView() {
// setGraph({...graph, edges: updatedEdges});
return(
-
-
- Select Starting Point
+
+ Dijkstra
+ Find the shortest path between different cities in Belgium with Dijkstra algorithm.
+
+ Starting Point
-
+
+
-
-
+
+ Destination
-
+
+
-
-
+
}
-
+
{
shortestPath &&
-
+
Shortest path from {startingPoint.name} to {destination.name} ({shortestPath.distance}km)
- {shortestPath.path.map(city => (
-
{city.name}
+
{shortestPath.path.map(city => (
+ {city.name}
))}
-
+
-
+
}
{ graph.nodes.length > 0 &&
@@ -184,8 +190,47 @@ function HomeView() {
}}
/>
}
-
+
);
}
export default HomeView
+
+const Main = styled.main`
+ padding-top: 20px;
+ max-width: 800px;
+ margin: 0 auto;
+`
+
+const Section = styled.section`
+ margin: 20px 0;
+`
+
+const StyledSelect = styled(Select)`
+ margin-right:10px;
+`
+
+const StyledSpan = styled.span`
+ ::after {
+ content: "";
+ background-image: url(${arrow});
+ background-size: 13px 17px;
+ display: inline-block;
+ width: 13px;
+ height: 17px;
+ margin-right: 10px;
+ margin-left: 10px;
+ padding-top: 10px;
+ bottom: -10px;
+ }
+ font-size:1.5rem;
+ color: #40a9ff;
+`
+
+const StyledP = styled.p`
+ span:last-child {
+ ::after {
+ background-image: none;
+ }
+ }
+`
\ No newline at end of file