-
Notifications
You must be signed in to change notification settings - Fork 10
challenge attempts #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
LiamBorner
wants to merge
9
commits into
InfuseGroup:master
Choose a base branch
from
LiamBorner:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f7b58ff
challenge attempts
LiamBorner 4af35fe
minor amend to cards file
LiamBorner 2969765
amends made to work based on feedback
LiamBorner aaf54da
attempted fix of cards but ended up attempting to fix errors on login…
LiamBorner 8aa6334
further email validation attempts, addition of carousel to rotate thr…
LiamBorner 1e84703
added unadditional unstaged files
LiamBorner a885794
pushed unsaved changes to cards file
LiamBorner aeedbf7
working slider
LiamBorner 3042d72
final attempts a fixing outstanding issues...no joy
LiamBorner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,11 +4,27 @@ export default function Cards() { | |
| const nasaApiKey = '6H6EdNLLrDu8SC1LZMJkbJzoGIghjvrjzgQpF72W'; | ||
| const baseUri = 'https://api.nasa.gov/planetary/apod'; | ||
|
|
||
| const [] | ||
|
|
||
| const Component = React.Component; | ||
| const Shuffle = window.Shuffle; | ||
|
|
||
| /* I understand that I need to assign these images a random number | ||
| and pass through to the onClick action of the button, so that | ||
| each time it's clicked, it will grab a different image | ||
| */ | ||
|
|
||
| const randomID = Math.floor(Math.random + 1); | ||
|
|
||
| /* these probably need turning into an array for the slider | ||
| this guide looks useful: https://medium.com/@ItsMeDannyZ/build-an-image-slider-with-react-es6-264368de68e4 | ||
| */ | ||
| const [image1Url, setImage1Url] = React.useState<string>(''); | ||
| const [image2Url, setImage2Url] = React.useState<string>(''); | ||
| const [image3Url, setImage3Url] = React.useState<string>(''); | ||
| const [image4Url, setImage4Url] = React.useState<string>(''); | ||
|
|
||
|
|
||
| React.useEffect(() => { | ||
| getImage('2020-02-13').then(response => setImage1Url(response)); | ||
| getImage('2020-02-12').then(response => setImage2Url(response)); | ||
|
|
@@ -40,7 +56,12 @@ export default function Cards() { | |
| {/* NASA API docs here: https://api.nasa.gov/ */} | ||
| <h3>Slider</h3> | ||
| <h3>1. Refactor this code to remove duplication and make it more 'Reacty'.</h3> | ||
| /* I can see that the refactoring task here is to take the repeated code below | ||
| and use some sort of iterating loop, but I really can't figure out how to do this. I | ||
| also lack the knowledge to make this more Reacty | ||
| */ | ||
| <h3>2. Convert the images into a slider using the pagination buttons.</h3> | ||
|
|
||
| <div className="cards"> | ||
| <div className="card" style={{ backgroundImage: `url(${image1Url})` }} /> | ||
| <div className="card" style={{ backgroundImage: `url(${image2Url})` }} /> | ||
|
|
@@ -53,8 +74,11 @@ export default function Cards() { | |
| </div> | ||
| <h3>Randomised Image</h3> | ||
| <h3>1. Randomise the image when you click the button.</h3> | ||
| /* this can potentially be achieved by using the NASA api documentation to fetch | ||
| an image from their database each time */ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So basically NASA has 1 image per day so you need to create a random date and pass it into the |
||
| <div className="cards"> | ||
| <div className="card" style={{ backgroundImage: `url(${image1Url})` }} /> | ||
|
|
||
| </div> | ||
| <div style={{ display: 'flex', justifyContent: 'center' }}> | ||
| <button style={buttonStyles}>Randomise</button> | ||
|
|
||
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| <%# This is the link to the first challenge -> challenge_1_path %> | ||
| <%= react_component 'staticPages/Home', linkPath: nil %> | ||
| <%= react_component 'staticPages/Home', linkPath: challenge_1_path %> | ||
|
LiamBorner marked this conversation as resolved.
|
||
Empty file.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.