-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2285 from vektor-inc/add/outer/divider-book
【二人目確認待ち】[ Outer ] 区切りに本とピラミッドを追加
- Loading branch information
Showing
12 changed files
with
1,136 additions
and
29 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
103 changes: 103 additions & 0 deletions
103
src/blocks/_pro/outer/deprecated/save/1.89.0/GenerateBgImage.js
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,103 @@ | ||
const GenerateBgImage = (props) => { | ||
const { attributes, prefix } = props; | ||
const { bgImageMobile, bgImageTablet, bgImage, bgSize, blockId } = | ||
attributes; | ||
|
||
const mobileViewport = 'max-width: 575.98px'; | ||
const tabletViewport = 'min-width: 576px'; | ||
const pcViewport = 'min-width: 992px'; | ||
const underPcViewport = 'max-width: 992.98px'; | ||
|
||
let backgroundStyle; | ||
const backgroundPosition = 'background-position:center!important;'; | ||
if ('cover' === bgSize) { | ||
backgroundStyle = `background-size:${bgSize}!important; ${backgroundPosition}`; | ||
} else if ('repeat' === bgSize) { | ||
backgroundStyle = `background-repeat:${bgSize}!important; background-size: auto; ${backgroundPosition}`; | ||
} else { | ||
backgroundStyle = ``; | ||
} | ||
|
||
//moible only | ||
if (bgImageMobile && !bgImageTablet && !bgImage) { | ||
return ( | ||
<style>{`.${prefix}-${blockId}{background-image: url(${bgImageMobile}); ${backgroundStyle}}`}</style> | ||
); | ||
} | ||
//tablet only | ||
if (!bgImageMobile && bgImageTablet && !bgImage) { | ||
return ( | ||
<style>{`.${prefix}-${blockId}{background-image: url(${bgImageTablet}); ${backgroundStyle}}`}</style> | ||
); | ||
} | ||
//pc only | ||
if (!bgImageMobile && !bgImageTablet && bgImage) { | ||
return ( | ||
<style>{`.${prefix}-${blockId}{background-image: url(${bgImage}); ${backgroundStyle}}`}</style> | ||
); | ||
} | ||
//pc -mobile | ||
if (bgImageMobile && !bgImageTablet && bgImage) { | ||
return ( | ||
<style> | ||
{` | ||
@media screen and (${underPcViewport}) { | ||
.${prefix}-${blockId}{background-image: url(${bgImageMobile}); ${backgroundStyle}} | ||
} | ||
@media screen and (${pcViewport}) { | ||
.${prefix}-${blockId}{background-image: url(${bgImage}); ${backgroundStyle}} | ||
} | ||
`} | ||
</style> | ||
); | ||
} | ||
//pc -tablet | ||
if (!bgImageMobile && bgImageTablet && bgImage) { | ||
return ( | ||
<style> | ||
{` | ||
@media screen and (${underPcViewport}) { | ||
.${prefix}-${blockId}{background-image: url(${bgImageTablet}); ${backgroundStyle}} | ||
} | ||
@media screen and (${pcViewport}) { | ||
.${prefix}-${blockId}{background-image: url(${bgImage}); ${backgroundStyle}} | ||
} | ||
`} | ||
</style> | ||
); | ||
} | ||
//tablet - mobile | ||
if (bgImageMobile && bgImageTablet && !bgImage) { | ||
return ( | ||
<style> | ||
{` | ||
@media screen and (${mobileViewport}) { | ||
.${prefix}-${blockId}{background-image: url(${bgImageMobile}); ${backgroundStyle}} | ||
} | ||
@media screen and (${tabletViewport}) { | ||
.${prefix}-${blockId}{background-image: url(${bgImageTablet}); ${backgroundStyle}} | ||
} | ||
`} | ||
</style> | ||
); | ||
} | ||
//pc -tablet - mobile | ||
if (bgImageMobile && bgImageTablet && bgImage) { | ||
return ( | ||
<style> | ||
{` | ||
@media screen and (${mobileViewport}) { | ||
.${prefix}-${blockId}{background-image: url(${bgImageMobile}); ${backgroundStyle}} | ||
} | ||
@media screen and (${tabletViewport}) { | ||
.${prefix}-${blockId}{background-image: url(${bgImageTablet}); ${backgroundStyle}} | ||
} | ||
@media screen and (${pcViewport}) { | ||
.${prefix}-${blockId}{background-image: url(${bgImage}); ${backgroundStyle}} | ||
} | ||
`} | ||
</style> | ||
); | ||
} | ||
}; | ||
export default GenerateBgImage; |
Oops, something went wrong.