Skip to content
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

Inline and Modal background image layouts #326

Closed
wants to merge 2 commits into from

Conversation

krothenbaum
Copy link

@krothenbaum krothenbaum commented Apr 12, 2019

Closes #304

Adds a new layout variant with a background image for modal and inline layouts. Includes option for background to cover the entire widget or positioned to cover the top, bottom, right or left half of the widget.

Added tests and updated documentation.

Note: I'm not sure about the giant line change on the pathfora.js file. I'm assuming a build command I ran modified it. What's the best way to revert that change? Ran npm run prod.

Modal
image

Inline
image

@codecov
Copy link

codecov bot commented Apr 12, 2019

Codecov Report

Merging #326 into develop will increase coverage by 0.06%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #326      +/-   ##
===========================================
+ Coverage     89.6%   89.66%   +0.06%     
===========================================
  Files          109      109              
  Lines         2087     2100      +13     
  Branches       638      641       +3     
===========================================
+ Hits          1870     1883      +13     
  Misses         217      217
Impacted Files Coverage Δ
src/rollup/widgets/construct-widget-layout.js 87.24% <100%> (+0.9%) ⬆️

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 c59c0c5...beaf1b7. Read the comment docs.

position: '.inline-module',
headline: 'Welcome!',
msg: 'Please sign up for our newsletter for more updates.',
variant: 4,
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be something we need to discuss in person, but what was the deciding factor on making this a separate variant? Given the existing patterns with variants, it does sort of make sense. But in general I think we want to avoid using variants in the future as they are kind of a bad API design, and I think we'd like to support background images on other variant modals such as content recommendations.

<pre data-src="../../examples/src/layouts/inline/image.js"></pre>

## background image
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be backgroundImage the titles are formatted as they appear in the config.

Define the background image and position you would like to use for the module.

**Note:** This setting is only valid for modules with a variant value of 2.
Copy link
Contributor

Choose a reason for hiding this comment

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

value of 4 (although I vote that this is subject to change).

@@ -56,3 +60,57 @@ Define the featured image you would like to use for the module.
![Image Slideout Module](../examples/img/layouts/modal/image.png)

<pre data-src="../../examples/src/layouts/modal/image.js"></pre>

## background image
Copy link
Contributor

Choose a reason for hiding this comment

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

same on title formatting

@@ -27,6 +27,10 @@ Variant determines any extra content (dictated by extra keys in the config) that
<td>3</td>
<td>module includes a <a href="../../content_recommend">content recommendation</a></td>
</tr>
<tr>
<td>4</td>
<td>module icludes a background image</td>
Copy link
Contributor

Choose a reason for hiding this comment

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

includes

var modalWidget = $('#' + modal.id),
inlineWidget = $('#' + inline.id);
expect(modalWidget.find('.pf-widget-background-image')).toBeDefined();
expect(inlineWidget.find('.pf-widget-background-image')).toBeDefined();
Copy link
Contributor

Choose a reason for hiding this comment

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

I would go ahead and check the inline styling here too.

@@ -397,6 +397,70 @@ describe('Widgets', function () {
expect(inlineWidget.find('.pf-widget-content').find('img').html()).toBeDefined();
expect(modalWidget.find('.pf-widget-text').find('img').html()).toBeUndefined();
});
//variant 4
it('should append div with pf-widget-background-image for modal and inline layout', function() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
it('should append div with pf-widget-background-image for modal and inline layout', function() {
it('should support backgroundImage src', function() {

expect(inlineWidget.find('.pf-widget-background-image')).toBeDefined();
});

it('should append position class to pf-widget-background-image and pf-widget-text for modal and inline layouts', function() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
it('should append position class to pf-widget-background-image and pf-widget-text for modal and inline layouts', function() {
it('should support backgroundImage position', function() {

Copy link
Contributor

Choose a reason for hiding this comment

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

My general thought is, these test names don't need to be super descriptive. Just defining what feature it is attempting to test is enough. Also using the config setting name is more informative to other devs than the class names.

@ashyablok ashyablok closed this Nov 6, 2023
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.

Add a background image option for modals
2 participants