-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Redesign UI + responsiveness - Minor refactorings - Add favicon - Repo cleanup
- Loading branch information
Showing
11 changed files
with
117 additions
and
53 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import App from './App'; | ||
import { render } from "@testing-library/react"; | ||
|
||
test('renders learn react link', () => { | ||
import App from "./App"; | ||
|
||
test("renders learn react link", () => { | ||
render(<App />); | ||
const linkElement = screen.getByText(/learn react/i); | ||
expect(linkElement).toBeInTheDocument(); | ||
expect(true).toBe(true); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import React, { useEffect, useState } from "react"; | ||
|
||
interface ICountries { | ||
countryName: string; | ||
onClick: (event: React.MouseEvent<HTMLButtonElement>) => void; | ||
} | ||
|
||
const CountriesOptions = (props: ICountries) => { | ||
const { countryName, onClick } = props; | ||
|
||
return ( | ||
<> | ||
<button onClick={onClick}>{countryName}</button> | ||
</> | ||
); | ||
}; | ||
|
||
const OptionsGrid = () => { | ||
const [selection, setSelection] = useState<string | null>(null); | ||
const [isSelectionCorrect, setIsSelectionCorrect] = useState<boolean>(false); | ||
const [emoji, setEmoji] = useState<string>("🌐"); | ||
|
||
const tempOptions = ["Mauritius", "Australia", "France", "England"]; | ||
|
||
useEffect(() => { | ||
if (selection === "Mauritius") { | ||
setIsSelectionCorrect(true); | ||
setEmoji("🤗"); | ||
} | ||
}, [selection]); | ||
|
||
const handleCountrySelection = (selectedCountry: string) => { | ||
if (!isSelectionCorrect) { | ||
setSelection(selectedCountry); | ||
} | ||
}; | ||
|
||
return ( | ||
<> | ||
<h2>{emoji}</h2> | ||
{!isSelectionCorrect ? ( | ||
<div className="options-grid"> | ||
{tempOptions.map((country) => ( | ||
<CountriesOptions | ||
key={country} | ||
countryName={country} | ||
onClick={() => { | ||
handleCountrySelection(country); | ||
if (selection !== "Mauritius") setEmoji("😱"); | ||
}} | ||
/> | ||
))} | ||
</div> | ||
) : ( | ||
<h3>Indeed, this is the Mauritian flag!</h3> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
export default OptionsGrid; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,39 @@ | ||
.flags-guessr-main{ | ||
.flags-guessr-main { | ||
color: aliceblue; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
gap: 1rem; | ||
gap: .4rem; | ||
height: 100vh; | ||
text-align: center; | ||
|
||
.mu{ | ||
height: 25rem; | ||
.flag { | ||
height: 20rem; | ||
} | ||
|
||
.options-grid { | ||
display: grid; | ||
grid-template-columns: repeat(2, auto); | ||
grid-gap: 2rem; | ||
|
||
button { | ||
width: 14rem; | ||
} | ||
} | ||
} | ||
|
||
@media screen and (max-width: 768px) { | ||
.flags-guessr-main { | ||
.flag { | ||
height: 13.4rem; | ||
} | ||
|
||
.options-grid { | ||
button { | ||
width: 9rem; | ||
font-size: 1rem; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters