This file contains hidden or 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
| const peopleReducer: Reducer<IPeopleState, PeopleActions> = ( | |
| state = initialPeopleState, | |
| action, | |
| ) => { | |
| switch (action.type) { | |
| case 'GettingPeople': { | |
| return { | |
| ...state, | |
| loading: true, | |
| }; |
This file contains hidden or 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
| export function configureStore(): Store<IAppState> { | |
| const store = createStore(rootReducer, undefined, applyMiddleware(thunk)); | |
| return store; | |
| } |
This file contains hidden or 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
| interface IProps { | |
| getPeople: () => Promise<IGotPeopleAction>; | |
| people: IPerson[]; | |
| peopleLoading: boolean; | |
| postPerson: (person: IPostPerson) => Promise<IPostedPersonAction>; | |
| personPosting: boolean; | |
| } | |
| const App: FC<IProps> = ({ | |
| getPeople, |
This file contains hidden or 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
| npm install styled-components | |
| npm install @types/styled-components --save-dev |
This file contains hidden or 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
| ... | |
| <div> | |
| <ul> | |
| {posts.map(({ id, title, body }) => ( | |
| <li key={id}> | |
| <div> | |
| <span>{title}</span> | |
| <span>{body}</span> | |
| </div> |
This file contains hidden or 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
| import styled from 'styled-components'; | |
| const Container = styled.div` | |
| width: 400px; | |
| margin: 30px auto; | |
| `; | |
| const App = () => ( | |
| <Container> | |
| <ul> |
This file contains hidden or 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
| // Grays | |
| export const gray1 = '#383737'; | |
| export const gray2 = '#565555'; | |
| export const gray3 = '#857c81'; | |
| export const gray4 = '#b9b9b9'; | |
| export const gray5 = '#e0dddd'; | |
| // Colors | |
| export const primary1 = '#6ca583'; | |
| export const accent1 = '#9b8dab'; |
This file contains hidden or 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
| ... | |
| import { fontFamily, fontSize, gray2 } from './Styles'; | |
| const Container = styled.div` | |
| width: 400px; | |
| margin: 30px auto; | |
| font-family: ${fontFamily}; | |
| font-size: ${fontSize}; | |
| color: ${gray2}; | |
| `; |
This file contains hidden or 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
| const Container = styled.div` | |
| width: 400px; | |
| margin: 30px auto; | |
| font-family: ${fontFamily}; | |
| font-size: ${fontSize}; | |
| color: ${gray2}; | |
| ul { | |
| list-style: none; | |
| padding: 0px 20px; | |
| background-color: #fff; |
This file contains hidden or 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
| const Container = styled.div` | |
| width: 400px; | |
| margin: 30px auto; | |
| font-family: ${fontFamily}; | |
| font-size: ${fontSize}; | |
| color: ${gray2}; | |
| `; | |
| const List = styled.ul` | |
| list-style: none; |