Skip to content

Commit 5be785f

Browse files
committed
prettier rc, Countries file, ReadMe instructions
1 parent f03ea88 commit 5be785f

File tree

3 files changed

+42
-48
lines changed

3 files changed

+42
-48
lines changed

.prettierrc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"printWidth": 80,
2+
"arrowParens": "avoid",
3+
"bracketSpacing": true,
4+
"semi": false,
35
"tabWidth": 2,
4-
"useTabs": false,
5-
"semi": true,
66
"singleQuote": true,
77
"trailingComma": "all",
8-
"arrowParens": "avoid"
9-
}
8+
"useTabs": false
9+
}

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ This is a simple web app that based on the [react-boilerplate CRA template](http
44

55
It currently has two pages, an index and a `/countries` page which downloads a list of countries from the CareRev API and displays links to a country detail page. Right now the link leads to a 404. Your task is to add the missing route which will download the details for the selected country and display them.
66

7-
**NOTE:** The task is broken up into smaller steps and shouldn't take more than an hour or two in total. If you find yourself stuck on any step, simply note where you ran into any problems and what you were trying to do so we can discuss it later, then move on to the next step.
7+
**NOTE:** If you find yourself stuck on any step, simply note where you ran into any problems and what you were trying to do so we can discuss it later, then move on to the next step.
88

9-
1. Get the app running with `yarn install` and `yarn start`
9+
1. Get the app running with `npm install` and `npm start`
1010

1111
2. Add a route for `/country/:id`
1212

@@ -20,6 +20,12 @@ It currently has two pages, an index and a `/countries` page which downloads a l
2020

2121
7. Display that country's name and currency code in the container when it loads, using the selector(s).
2222

23-
8. Bonus (optional): Add an error view in case the data fetching has a problem.
23+
8. Add an error view in case the data fetching has a problem.
2424

25-
This added container should function roughly like the existing `Countries` container. In the interview, we'll discuss this app, ways to improve it, architectural concepts, best practices and what ideas you think are important in making a strong, reliable and easy to use app.
25+
9. Style the page with tailwind.
26+
27+
10. Ensure the page meets accessibility standards.
28+
29+
11. Add unit tests.
30+
31+
This added container should function roughly like the existing `Countries` container. In the interview, we'll discuss this app, ways to improve it, architectural concepts, best practices and what ideas you think are important in making a strong, reliable and easy to use app.
Lines changed: 27 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,41 @@
1-
import React, { useEffect } from 'react';
2-
import styled from 'styled-components/macro';
3-
import { useSelector, useDispatch } from 'react-redux';
4-
import { useInjectReducer, useInjectSaga } from 'utils/redux-injectors';
5-
import { saga } from './saga';
6-
import { key, countriesReducer } from './reducer';
7-
import { actions } from './actions';
8-
import { selectCountries, selectLoading, selectError } from './selectors';
9-
import { LoadingIndicator } from 'app/components/LoadingIndicator';
10-
import { Link } from 'app/components/Link';
11-
import { PageWrapper } from 'app/components/PageWrapper';
1+
import React, { useEffect } from 'react'
2+
import { useSelector, useDispatch } from 'react-redux'
3+
import { useInjectReducer, useInjectSaga } from 'utils/redux-injectors'
4+
import { saga } from './saga'
5+
import { key, countriesReducer } from './reducer'
6+
import { actions } from './actions'
7+
import { selectCountries, selectLoading, selectError } from './selectors'
8+
import { LoadingIndicator } from 'app/components/LoadingIndicator'
9+
import { Link } from 'app/components/Link'
10+
import { PageWrapper } from 'app/components/PageWrapper'
1211

13-
export function Countries() {
14-
useInjectReducer({ key: key, reducer: countriesReducer });
15-
useInjectSaga({ key: key, saga });
12+
export const Countries = () => {
13+
useInjectReducer({ key: key, reducer: countriesReducer })
14+
useInjectSaga({ key: key, saga })
1615

17-
const countries = useSelector(selectCountries);
18-
const isLoading = useSelector(selectLoading);
19-
const error = useSelector(selectError);
16+
const countries = useSelector(selectCountries)
17+
const isLoading = useSelector(selectLoading)
18+
const error = useSelector(selectError)
2019

21-
const dispatch = useDispatch();
20+
const dispatch = useDispatch()
2221
useEffect(() => {
23-
dispatch(actions.fetchCountries());
24-
}, [dispatch]);
22+
dispatch(actions.fetchCountries())
23+
}, [dispatch])
2524

2625
return (
2726
<PageWrapper>
2827
<h1>Countries</h1>
2928
{isLoading && <LoadingIndicator small />}
30-
{countries?.length > 0 ? (
31-
<List>
29+
{countries?.length > 0 && (
30+
<ul>
3231
{countries.map(country => (
33-
<Country key={country.id}>
32+
<li key={country.id}>
3433
<Link to={`/country/${country.id}`}>{country.name}</Link>
35-
</Country>
34+
</li>
3635
))}
37-
</List>
38-
) : error ? (
39-
<ErrorText>{error}</ErrorText>
40-
) : null}
36+
</ul>
37+
)}
38+
{error && <div>{error}</div>}
4139
</PageWrapper>
42-
);
40+
)
4341
}
44-
45-
const Country = styled.li`
46-
color: blue;
47-
`;
48-
49-
const ErrorText = styled.span`
50-
color: ${p => p.theme.text};
51-
`;
52-
53-
const List = styled.div``;

0 commit comments

Comments
 (0)