FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(AboutModal): provide a way to set the background using props by seanforyou23 · Pull Request #1940 · patternfly/patternfly-react · GitHub

fix(AboutModal): provide a way to set the background using props - #1940

Merged
jschuler merged 1 commit into
patternfly:masterfrom
seanforyou23:about-modal-bg
May 8, 2019
Merged

fix(AboutModal): provide a way to set the background using props#1940
jschuler merged 1 commit into
patternfly:masterfrom
seanforyou23:about-modal-bg

Conversation

seanforyou23 commented May 6, 2019
edited
Loading

Copy link
Copy Markdown
Contributor

What: This PR removes the logoImageSrc and logoImageAlt props from about modal as they were never actually used. Beyond removing these dead API parts, I've replaced them with a single prop, bgImgSrc which I believe fulfills the original intent - which is making the background graphic on the right side of the modal configurable.

I've added a new example for AboutModal, one that illustrates how to set a custom background image.

The value passed for backgroundImageSrc is used to set the value for the css variable "--pf-c-about-modal-box__hero--sm--BackgroundImage". This is different than how we typically set CSS vars, and the need for it is described here #1919. In a nutshell, the need is driven by having assets served by a caching service or using generated asset filenames of which you don't know the exact name of a file, which in turn prevents you from setting this in a stylesheet.

Additional issues: #1919

Copy link
Copy Markdown
Collaborator

PatternFly-React preview: https://1940-pr-patternfly-react-patternfly.surge.sh

codecov-io commented May 6, 2019
edited
Loading

Copy link
Copy Markdown

Codecov Report

Merging #1940 into master will decrease coverage by <.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #1940      +/-   ##
==========================================
- Coverage   82.59%   82.59%   -0.01%     
==========================================
  Files         624      624              
  Lines        6878     6876       -2     
  Branches       93       93              
==========================================
- Hits         5681     5679       -2     
  Misses       1157     1157              
  Partials       40       40
Flag Coverage Δ
#patternfly3 84.89% <ø> (ø) ⬆️
#patternfly4 79.27% <100%> (-0.02%) ⬇️
#patternflymisc 95.68% <ø> (ø) ⬆️
Impacted Files Coverage Δ
...e/src/components/AboutModal/AboutModalContainer.js 88.88% <ø> (ø) ⬆️
...react-core/src/components/AboutModal/AboutModal.js 66.66% <ø> (-4.17%) ⬇️
...ore/src/components/AboutModal/AboutModalBoxHero.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 82f8002...09cbd42. Read the comment docs.

mcoker previously approved these changes May 6, 2019

mcoker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

👍

seanforyou23 requested a review from redallen May 6, 2019 21:32

dlabaj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Few comments. Other then that it looks good.

"--pf-c-about-modal-box__hero--sm--BackgroundImage": `url(${bgImgSrc})`
} : {};
return (
<div {...props} style={bgStyle} className={css(styles.aboutModalBoxHero, className)} />

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

What happens if it doesn't find the image?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Good question, so if you're referencing a local module like in the example, and it can't be found, your IDE should notice this and throw an error. If you're providing a value like https://www.site.com/image.svg and that asset doesn't properly fetch, you'd get a standard 404 just as if you provide an inaccessible asset in any regular background definition, in which case you'd get a black background.

logoImageAlt: props => {
if (props.logoImageSrc && !props.logoImageAlt) {
return new Error('logoImageAlt is required when a logoImageSrc is specified');
brandImageAlt: props => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

since brandImageSrc is already required, we can also simply set brandImageAlt to required.
Although i'm questioning whether the brand image should be required...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

For now I left it as required, can change at a later point if you like. The main focus for this PR is just to make the background image configurable.

tlabaj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM

jschuler merged commit 4ad711d into patternfly:master May 8, 2019
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants


Back | FazBrowse Home | New Git URL