-
Notifications
You must be signed in to change notification settings - Fork 97
Qianling - World Clock #67
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
Qiannnly
wants to merge
16
commits into
rocketacademy:main
Choose a base branch
from
Qiannnly:main
base: main
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 all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
e35cab2
imported WorldClock and passed in clockData prop array to WorldClock …
Qiannnly 0bce708
added Clock component
Qiannnly 395ba9e
added WorldClock component
Qiannnly 16c894a
added line to import css for bootstrap
Qiannnly 8334c24
added a new style to create spacing between logo and timezones
Qiannnly 79ade5f
added classes to rows and cols
Qiannnly 74d0e16
edited class names
Qiannnly e9a624d
added a style to reflect border on timezones
Qiannnly 1f09125
added bootstrap button
Qiannnly fc138da
updated height of space
Qiannnly b3998a6
updated WorkClock component
Qiannnly ddb12b8
updated Clock component
Qiannnly 381009d
imported bootstrap features
Qiannnly 2610865
added bootstrap features
Qiannnly 1c04242
updated App component with toggle clock button
Qiannnly 5d91ef9
added index key to col tag
Qiannnly 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
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
|---|---|---|
|
|
@@ -17,3 +17,7 @@ | |
| font-size: calc(10px + 2vmin); | ||
| color: white; | ||
| } | ||
|
|
||
| .create-space { | ||
| height: 40px; | ||
| } | ||
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 |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import React from "react"; | ||
|
|
||
| class Clock extends React.Component { | ||
| constructor(props) { | ||
| super(props); | ||
|
|
||
| this.state = { | ||
| date: new Date(), | ||
| }; | ||
| } | ||
|
|
||
| tick = () => { | ||
| this.setState({ | ||
| date: new Date(), | ||
| }); | ||
| }; | ||
|
|
||
| componentDidMount = () => { | ||
| this.timerID = setInterval(() => { | ||
| this.tick(); | ||
| }, 1000); | ||
| }; | ||
|
|
||
| componentWillUnmount = () => { | ||
| clearInterval(this.timerID); | ||
| }; | ||
|
|
||
| render() { | ||
| const { date } = this.state; | ||
| return ( | ||
| <div> | ||
| <p> | ||
| {`${date.toLocaleString("en-GB", { | ||
| timeZone: this.props.timeZone, | ||
| })}`} | ||
| </p> | ||
| </div> | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| export default Clock; |
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 |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import React from "react"; | ||
| import Clock from "./Clock"; | ||
| import Container from "react-bootstrap/Container"; | ||
| import Row from "react-bootstrap/Row"; | ||
| import Col from "react-bootstrap/Col"; | ||
| import "./worldClock.css"; | ||
|
|
||
| class WorldClock extends React.Component { | ||
| render() { | ||
| const timeZoneOfCountries = this.props.clockData; | ||
|
|
||
| return ( | ||
| <Container> | ||
| {timeZoneOfCountries.map((zone, index) => ( | ||
| <Row className="deco"> | ||
| <Col md={6} className="deco"> | ||
| Current time in {zone} : | ||
| </Col> | ||
| <Col md={6} className="deco" key={index}> | ||
| <Clock timeZone={zone} /> | ||
| </Col> | ||
| </Row> | ||
| ))} | ||
| </Container> | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| export default WorldClock; | ||
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 |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| .deco { | ||
| border: 2px solid white; | ||
| } |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you still get the
keywarning in the console? If yes, you might need to place this on the Row component, as it usually requires the most parent component in the list to have that property. If not, then all good.