-
Notifications
You must be signed in to change notification settings - Fork 3
Add version and versionUrl props to Footer component #2
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| REACT_APP_VERSION=$npm_package_version |
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,3 +1,23 @@ | ||
|
|
||
| ```jsx | ||
| <Footer /> | ||
| ``` | ||
|
|
||
| Including the `version` prop displays an application version number along with the other content: | ||
|
|
||
| ```jsx | ||
| <Footer version /> | ||
| ``` | ||
|
|
||
| If you specify the `version` prop without supplying a string value, `Footer` will check the `REACT_APP_VERSION` environment variable. The [`dotenv`](https://github.com/motdotla/dotenv) package ([included in create-react-app](https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#user-content-adding-development-environment-variables-in-env)) can set this variable from your `package.json` file, if you add a `.env` file to the root of your project containing the following line: | ||
|
|
||
| ```bash | ||
| REACT_APP_VERSION=$npm_package_version | ||
| ``` | ||
|
|
||
| You may supply a version string directly, and an optional URL the version should link to. | ||
|
|
||
| ```jsx | ||
| <Footer version="1970-04-20v0" versionUrl="https://web.jcu.io/v2/#footer" /> | ||
| ``` | ||
|
|
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,3 +1,22 @@ | ||
|
|
||
| ```jsx | ||
| <Footer /> | ||
| ``` | ||
|
|
||
| Including the `version` prop displays an application version number along with the other content: | ||
|
|
||
| ```jsx | ||
| <Footer version /> | ||
| ``` | ||
|
|
||
| If you specify the `version` prop without supplying a string value, `Footer` will check the `REACT_APP_VERSION` environment variable. The [`dotenv`](https://github.com/motdotla/dotenv) package ([included in create-react-app](https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#user-content-adding-development-environment-variables-in-env)) can set this variable from your `package.json` file, if you add a `.env` file to the root of your project containing the following line: | ||
|
|
||
| ```bash | ||
| REACT_APP_VERSION=$npm_package_version | ||
| ``` | ||
|
|
||
| You may supply a version string directly, and an optional URL the version should link to. | ||
|
|
||
| ```jsx | ||
| <Footer version='1970-04-20v0' versionUrl='https://web.jcu.io/v2/#footer' /> | ||
| ``` |
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.
Added these
expectclauses so we check that the footer version is being rendered when it should and shouldn't. Previously, the tests just tested if rendering worked but not the outcome.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.
I think I need to be more careful about refreshing my pull req conversations -- twice now I've noticed a code update but missed the related comment.
Yes I originally wrote those tests to just confirm no crash; passing a boolean
falseas the prop value is technically allowed but not useful. I think there's a valid case where passingtrue(the code reformatting removes the explicit booleantrue, so it's just prop-exists-true) when there's no env var set will result in no version number appearing. I'll add an issue for that so i remember to come back around and fix it.