diff --git a/readmetemplate.md b/readmetemplate.md new file mode 100644 index 0000000..e69de29 diff --git a/src/App.tsx b/src/App.tsx index e0c7f06..8e794ad 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -24,6 +24,7 @@ function App() { .then(data => { setCountries(data); setIsLoading(false); + setIsError(false); }) .catch(() => { setIsLoading(false); @@ -31,7 +32,7 @@ function App() { }); }, []); - const handleSelectedRegion = (target: any) => { + const handleSelectedRegion = (target: any): void => { setSelectedRegion(target.selectedItem); }; diff --git a/src/components/Button/Button.tsx b/src/components/Button/Button.tsx deleted file mode 100644 index 3576d6b..0000000 --- a/src/components/Button/Button.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import styled from 'styled-components'; - -const StyledButton = styled.button` - background-color: var(--color-elements); - box-shadow: 0 0 0.4375rem rgba(0, 0, 0, 0.3); - padding: 0.375rem 1.4375rem; - border: none; - color: var(--color-text); - font-size: 0.875rem; - display: flex; - align-items: center; - gap: 0.5rem; - - :hover { - cursor: pointer; - } -`; - -const Button: React.FC<{ handleClick: () => void }> = ({ - children, - handleClick, -}) => {children}; - -export default Button; diff --git a/src/components/CountriesList/CountriesList.styles.ts b/src/components/CountriesList/CountriesList.styles.ts index bd3f631..68d75e8 100644 --- a/src/components/CountriesList/CountriesList.styles.ts +++ b/src/components/CountriesList/CountriesList.styles.ts @@ -27,9 +27,3 @@ export const Notification = styled.p` padding-top: 2rem; color: var(--color-text); `; - -export const ButtonWrapper = styled.div` - display: flex; - justify-content: center; - padding-bottom: 2rem; -`; diff --git a/src/components/CountriesList/CountriesList.tsx b/src/components/CountriesList/CountriesList.tsx index 4821104..0849e44 100644 --- a/src/components/CountriesList/CountriesList.tsx +++ b/src/components/CountriesList/CountriesList.tsx @@ -1,10 +1,8 @@ -import { useState } from 'react'; import ClipLoader from 'react-spinners/ClipLoader'; import { css } from '@emotion/core'; -import { Wrapper, Notification, ButtonWrapper } from './CountriesList.styles'; +import { Wrapper, Notification } from './CountriesList.styles'; import CountryCard from 'components/CountryCard/CountryCard'; import Country from 'models/Country'; -import Button from 'components/Button/Button'; const CountriesList: React.FC<{ countries: Country[]; @@ -13,8 +11,6 @@ const CountriesList: React.FC<{ isLoading: boolean; isError: boolean; }> = ({ countries, searchQuery, isLoading, isError }) => { - const [showAll, setShowAll] = useState(false); - const override = css` display: block; margin: 3rem auto; @@ -37,8 +33,6 @@ const CountriesList: React.FC<{ ); } - const DISPLAY_LIMIT = 20; - return ( <> - {countries - .slice(0, showAll ? countries.length - 1 : DISPLAY_LIMIT) - .map((country: Country) => { - return ; - })} + {countries.map((country: Country) => { + return ; + })} - {!showAll && countries.length > DISPLAY_LIMIT && ( - - - - )} ); }; diff --git a/src/components/DropDownSelect/DropDownSelect.tsx b/src/components/DropDownSelect/DropDownSelect.tsx index 6ab66b8..24f7fe0 100644 --- a/src/components/DropDownSelect/DropDownSelect.tsx +++ b/src/components/DropDownSelect/DropDownSelect.tsx @@ -12,7 +12,7 @@ const items = ['All', 'Africa', 'Americas', 'Asia', 'Europe', 'Oceania']; type DropDownSelectProps = { selectedRegion: string; - handleSelectedItem: any; + handleSelectedItem: (target: any) => void; }; const DropDownSelect = ({ diff --git a/src/hooks/useDarkMode.ts b/src/hooks/useDarkMode.ts index 3cb0c60..dff501a 100644 --- a/src/hooks/useDarkMode.ts +++ b/src/hooks/useDarkMode.ts @@ -7,7 +7,6 @@ const useDarkMode = (): [string, () => void] => { const setMode = useCallback((mode: string) => { window.localStorage.setItem('theme', mode); setTheme(mode); - document.body.className = mode; }, []); const themeToggler = (): void => { diff --git a/src/pages/CountryDetails/CountryDetails.styles.ts b/src/pages/CountryDetails/CountryDetails.styles.ts index eceafdc..36243ae 100644 --- a/src/pages/CountryDetails/CountryDetails.styles.ts +++ b/src/pages/CountryDetails/CountryDetails.styles.ts @@ -84,7 +84,7 @@ export const CountryInfo = styled.div` ul:first-child { @media (min-width: ${breakpoints.desktop}) { - margin-right: 7.3125rem; + margin-right: 5rem; } }