-
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 #1017 from vektor-inc/develop
[ Change version ] 1.24.5
- Loading branch information
Showing
15 changed files
with
249 additions
and
119 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
export const prefix = 'vk_card_'; | ||
const generateInlineCss = (attributes) => { | ||
let { clientId, mobile, tablet, pc, unit } = attributes; | ||
|
||
//For recovering block. | ||
if (undefined === unit) { | ||
unit = 'px'; | ||
} | ||
if (undefined === mobile) { | ||
mobile = 150; | ||
} | ||
if (undefined === tablet) { | ||
tablet = 150; | ||
} | ||
if (undefined === pc) { | ||
pc = 150; | ||
} | ||
|
||
const cardImgSelector = `.${prefix}${clientId} .vk_card_item .vk_post_imgOuter::before`; | ||
return `@media (max-width: 576px) { | ||
${cardImgSelector}{ | ||
padding-top:${mobile}${unit}!important; | ||
} | ||
} | ||
@media (min-width: 577px) and (max-width: 768px) { | ||
${cardImgSelector}{ | ||
padding-top:${tablet}${unit}!important; | ||
} | ||
} | ||
@media (min-width: 769px) { | ||
${cardImgSelector}{ | ||
padding-top:${pc}${unit}!important; | ||
} | ||
}`; | ||
}; | ||
|
||
export default function CardHook( {el,attributes}) { | ||
const cssTag = generateInlineCss(attributes); | ||
return ( | ||
<> | ||
{el} | ||
<style type="text/css">{cssTag}</style> | ||
</> | ||
); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { InnerBlocks, useBlockProps } from '@wordpress/block-editor'; | ||
|
||
export default function save({ attributes }) { | ||
const { clientId } = attributes; | ||
const blockProps = useBlockProps.save({ | ||
className: `vk_posts vk_card_${clientId}`, | ||
}); | ||
|
||
return ( | ||
<div {...blockProps}> | ||
<InnerBlocks.Content /> | ||
</div> | ||
); | ||
} |
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
Oops, something went wrong.