This project was bootstrapped with Create React App. Using API from SWAPI.
To see this project in action, go to Demo Star Wars
Clone this repo :
git clone https://github.com/finmavis/swapi-task.git
Navigate to the root folder and install all dependencies :
yarn
ornpm install
Start Development Mode :
yarn start
ornpm start
- Open http://localhost:3000 to view it in the browser.
- Happy Hacking!
In the project directory, you can run:
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
Launches the test runner in the interactive watch mode.
See the section about running tests for more information.
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!
See the section about deployment for more information.
Note: this is a one-way operation. Once you eject
, you can’t go back!
If you aren’t satisfied with the build tool and configuration choices, you can eject
at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject
will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
You don’t have to ever use eject
. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
To check javascript linting rules.
To format or prettier codebase using Prettier
.
|-- src/
|-- components/
|-- shared/
|-- assets/
|-- fonts/
|-- icon/
|-- images/
|-- components/
|-- Loader/
|-- constants/
|-- helpers/
|-- hooks/
|-- styles/
|-- base/
|-- themes/
|-- App.js
|-- index.js
|-- serviceWorker.js
|-- setupTests.js
components
: Folder to put all non shared Componentshared/assets
: Folder to put assets like fonts, icons and imagesshared/components
: Folder to put all shared Componentshared/constants
: Folder to put all of ours constant likeapi url
,mock
,action types
and all others constant data that dont changedshared/helpers
: Folder to put our helpers function like Consume API and formating data or others helpersshared/hooks
: Folder to put all of ours custom hooks/logic for componentstyles
: Folder to put our Styled Component that reusable
This project using relative unit based 10px. so you can use 1rem
which means 10px
propeties in css to help ours styling more easier handling Resposive.
This project using Grid System which is using 3 Column because based on Content/Data, we only need 3 Column. This Grid system i made it myself using Flexbox. You can find Grid
file in src/shared/styles/base/grid.js
. This Grid
system contain Container
, Row
and Col
.
-
How to use it
import { Container, Row, Col } from 'path/to/grid/file'; <Container> <Row> <Col>Column 1</Col> <Col>Column 2</Col> <Col>Column 3</Col> </Row> <Container>
or if you only want to use
Container
, well, you dont have to importRow
andCol
. but if you want to useCol
you must wrap withContainer
andRow
.import { Container, Row, Col } from 'path/to/grid/file'; <Container> <YourComponentHere /> <Container>
-
Custom Grid
Also you can modifyContainer
,Row
orCol
to achieve something that thisGrid
cannot do, or you want to add some value or edit some value.import styled from 'styled-components'; import { Col } from 'path/to/grid/file'; const YourCustomComponent = styled(Col)` background: orangered; `; <Container> <Row> <YourCustomComponent>Column 1</YourCustomComponent> <YourCustomComponent>Column 2</YourCustomComponent> <YourCustomComponent>Column 3</YourCustomComponent> </Row> <Container>
State | Properties |
---|---|
Default | 1rem = 10px |
max-width 768px | 1rem = 9px |
max-width 576px | 1rem = 8px |
State | Properties |
---|---|
Default | width = 100% |
min-width 576px | width = 540px |
min-width 768px | width = 720px |
min-width 992px | width = 960px |
min-width 1200px | width = 1140px |
State | Numbers of Column in Row |
---|---|
Default | 1 |
min-width 768px | 2 |
min-width 992px | 3 |