Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Bartosik committed May 17, 2021
1 parent 797ae12 commit 03809c9
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 53 deletions.
Empty file added readmetemplate.md
Empty file.
3 changes: 2 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@ function App() {
.then(data => {
setCountries(data);
setIsLoading(false);
setIsError(false);
})
.catch(() => {
setIsLoading(false);
setIsError(true);
});
}, []);

const handleSelectedRegion = (target: any) => {
const handleSelectedRegion = (target: any): void => {
setSelectedRegion(target.selectedItem);
};

Expand Down
24 changes: 0 additions & 24 deletions src/components/Button/Button.tsx

This file was deleted.

6 changes: 0 additions & 6 deletions src/components/CountriesList/CountriesList.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
`;
23 changes: 4 additions & 19 deletions src/components/CountriesList/CountriesList.tsx
Original file line number Diff line number Diff line change
@@ -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[];
Expand All @@ -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;
Expand All @@ -37,8 +33,6 @@ const CountriesList: React.FC<{
);
}

const DISPLAY_LIMIT = 20;

return (
<>
<ClipLoader
Expand All @@ -48,19 +42,10 @@ const CountriesList: React.FC<{
size={60}
></ClipLoader>
<Wrapper>
{countries
.slice(0, showAll ? countries.length - 1 : DISPLAY_LIMIT)
.map((country: Country) => {
return <CountryCard key={country.alpha3Code} {...country} />;
})}
{countries.map((country: Country) => {
return <CountryCard key={country.alpha3Code} {...country} />;
})}
</Wrapper>
{!showAll && countries.length > DISPLAY_LIMIT && (
<ButtonWrapper>
<Button handleClick={() => setShowAll(prevState => !prevState)}>
Show All
</Button>
</ButtonWrapper>
)}
</>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/DropDownSelect/DropDownSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const items = ['All', 'Africa', 'Americas', 'Asia', 'Europe', 'Oceania'];

type DropDownSelectProps = {
selectedRegion: string;
handleSelectedItem: any;
handleSelectedItem: (target: any) => void;
};

const DropDownSelect = ({
Expand Down
1 change: 0 additions & 1 deletion src/hooks/useDarkMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/CountryDetails/CountryDetails.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const CountryInfo = styled.div`
ul:first-child {
@media (min-width: ${breakpoints.desktop}) {
margin-right: 7.3125rem;
margin-right: 5rem;
}
}
Expand Down

1 comment on commit 03809c9

@vercel
Copy link

@vercel vercel bot commented on 03809c9 May 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.