aboutsummaryrefslogtreecommitdiff
path: root/components/travel-advisory
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2023-07-19 00:48:11 -0400
committerAndrew Lee <alee14498@protonmail.com>2023-07-19 00:48:11 -0400
commitd57226e5a802ecd6607faf67f32621e2da725a35 (patch)
treed2073bbc14409095c61255ea83b2ca3815df309d /components/travel-advisory
parent3c80755e70aa85daa59edc5dbe200400894254c7 (diff)
downloadalure-website-d57226e5a802ecd6607faf67f32621e2da725a35.tar.gz
alure-website-d57226e5a802ecd6607faf67f32621e2da725a35.tar.bz2
alure-website-d57226e5a802ecd6607faf67f32621e2da725a35.zip
Moved all components to app folder
Diffstat (limited to 'components/travel-advisory')
-rw-r--r--components/travel-advisory/HistoryModal.js40
-rw-r--r--components/travel-advisory/ListCountries.js66
2 files changed, 0 insertions, 106 deletions
diff --git a/components/travel-advisory/HistoryModal.js b/components/travel-advisory/HistoryModal.js
deleted file mode 100644
index 3ef2ea8..0000000
--- a/components/travel-advisory/HistoryModal.js
+++ /dev/null
@@ -1,40 +0,0 @@
-const HistoryModal = ({ isVisible, onClose, countries, dangerLevel, history }) => {
- if (!isVisible) return null;
- const handleClose = (e) => {
- if(e.target.id === 'wrapper') onClose();
- }
-
- let historyList;
- if (history && history.length > 0) {
- historyList = history.map((event, index) => {
- return (
- <li key={index}>{event}</li>
- )
- })
- } else {
- historyList = <li>Currently no diplomatic tensions in this country.</li>;
- }
-
- return (
- <div id="wrapper" className="fixed inset-0 bg bg-opacity-25 backdrop-blur-sm flex justify-center items-center" onClick={handleClose}>
- <div className="w-[700px]">
- <div className="flex flex-col">
- <div className="bg-zinc-800 p-5 rounded-lg border border-gray-700">
- <div className="divide-y space-y-3">
- <div>
- <h1 className="font-medium text-3xl">{countries}</h1>
- <h2 className="font-medium text-xl">{dangerLevel}</h2>
- </div>
- <div>
- <h1 className="font-medium text-2xl pt-3">History</h1>
- <ul>{historyList}</ul>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- )
-}
-
-export default HistoryModal;
diff --git a/components/travel-advisory/ListCountries.js b/components/travel-advisory/ListCountries.js
deleted file mode 100644
index 078af5c..0000000
--- a/components/travel-advisory/ListCountries.js
+++ /dev/null
@@ -1,66 +0,0 @@
-"use client"
-import countriesData from '@/app/travel-advisory/countries.json' assert { type: 'json' };
-import HistoryModal from "@/components/travel-advisory/HistoryModal";
-import { useState } from "react";
-
-export function getDangerLevel(danger) {
- let dangerLevel;
- switch (danger) {
- case 0:
- dangerLevel = "Take normal security precautions"
- break;
- case 1:
- dangerLevel = "Exercise a high degree of caution"
- break;
- case 2:
- dangerLevel = "Avoid non-essential travel"
- break;
- case 3:
- dangerLevel = "Avoid all travel"
- break;
- default:
- dangerLevel = "Seems like the danger level is broken!"
- break;
- }
-
- return dangerLevel;
-}
-
-export function Countries(){
- // eslint-disable-next-line react-hooks/rules-of-hooks
- const [showModal, setShowModal] = useState(false);
- const [selectedCountry, setSelectedCountry] = useState(null);
- const [selectedDangerLevel, setSelectedDangerLevel] = useState(null);
- const [selectedCountryHistory, setSelectedCountryHistory] = useState(null);
- const countries = countriesData.countries;
-
- return countries.map((country) => {
- let dangerLevel = getDangerLevel(country.danger);
-
- const settlementsList = country.settlements.map((settlement) => {
- return (
- <div key={settlement.name}>
- <h2 className="font-medium md:text-3xl text-xl">{settlement.name}</h2>
- <h2 className="text-base">{getDangerLevel(settlement.danger)}</h2>
- </div>
- )
- })
-
- return (
- <div key="countries" className="bg-center bg-no-repeat bg-[image:var(--image-url)] bg-gray-500 bg-blend-multiply" style={{'--image-url': `url(${country.image})`}} >
- <div className="sm:px-40 px-10 py-10 space-y-3">
- <h1 className="font-medium md:text-5xl text-3xl">{country.name}</h1>
- <h2 className="text-lg">{dangerLevel}</h2>
- <div className="space-y-3">{settlementsList}</div>
- <button className="transition duration-200 ease-in-out px-4 py-2 font-medium rounded-full bg-blue-600 hover:bg-blue-700 active:bg-blue-800" onClick={()=> {
- setSelectedCountry(country.name);
- setSelectedDangerLevel(dangerLevel)
- setSelectedCountryHistory(country.history)
- setShowModal(true)
- }}>Information</button>
- </div>
- <HistoryModal isVisible={showModal} onClose={() => setShowModal(false)} countries={selectedCountry} dangerLevel={selectedDangerLevel} history={selectedCountryHistory} />
- </div>
- )
- })
-}