-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[YNGJ-574] Background Kit - Set Background Size (#1793)
* YNGJ-574 - add background size to background playbook kit * Add import to examples index.js * [YNGJ-574] Background Kit - Set Background Size * add unit test for background size - check css style for background size style * [YNGJ-574 Background Kit - Set Background Size] * add rspec test for new enum * [YNGJ-574] - Background Kit - Set Background Size * remove style from background kits with no image * add background image to kit examples documentation * [YNGJ-574] Background Kit - Set Background Size * fix test by including image in test case * Add each example * Add background-repeat and fix rails background color * Fix spec test Co-authored-by: Stephen <smarshall1980@gmail.com>
- Loading branch information
1 parent
ee7956d
commit ed00e12
Showing
10 changed files
with
101 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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 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 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 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
5 changes: 5 additions & 0 deletions
5
playbook/app/pb_kits/playbook/pb_background/docs/_background_size.html.erb
This file contains 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,5 @@ | ||
<%= pb_rails("background", props: { classname: "background-image", image_url: "https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80", background_size: "auto", padding: "xl" }) %> | ||
<br/> | ||
<%= pb_rails("background", props: { classname: "background-image", image_url: "https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80", background_size: "cover", padding: "xl" }) %> | ||
<br/> | ||
<%= pb_rails("background", props: { classname: "background-image", image_url: "https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80", background_repeat: "no-repeat", background_size: "contain", padding: "xl" }) %> |
36 changes: 36 additions & 0 deletions
36
playbook/app/pb_kits/playbook/pb_background/docs/_background_size.jsx
This file contains 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,36 @@ | ||
import React, { Fragment as F } from 'react' | ||
import { Background } from '../..' | ||
|
||
const BackgroundSize = (props) => ( | ||
<F> | ||
<Background | ||
alt="colorful background" | ||
backgroundSize="auto" | ||
className="background lazyload" | ||
imageUrl="https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80" | ||
padding="xl" | ||
{...props} | ||
/> | ||
<br/> | ||
<Background | ||
alt="colorful background" | ||
backgroundSize="cover" | ||
className="background lazyload" | ||
imageUrl="https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80" | ||
padding="xl" | ||
{...props} | ||
/> | ||
<br/> | ||
<Background | ||
alt="colorful background" | ||
backgroundRepeat="no-repeat" | ||
backgroundSize="contain" | ||
className="background lazyload" | ||
imageUrl="https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80" | ||
padding="xl" | ||
{...props} | ||
/> | ||
</F> | ||
) | ||
|
||
export default BackgroundSize |
3 changes: 3 additions & 0 deletions
3
playbook/app/pb_kits/playbook/pb_background/docs/_background_size.md
This file contains 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 @@ | ||
Background size can be passed into the background kit. Values `auto`, `cover`, and `contain` are accepted. | ||
|
||
💡 *Note:* When using `contain` you might not want to have a repeating background as this will not always look pleasant. To prevent this, you may pass `no-repeat` to the `backgroundRepeat` prop. |
This file contains 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 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 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