-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add stretched link variations from plugin (#2270)
* Add stretched link variations - Include styles and JS code from plugin --------- Co-authored-by: Dan Tovbein <dtovbein@gmail.com>
- Loading branch information
1 parent
e4d9709
commit 38cf0a1
Showing
6 changed files
with
71 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const {registerBlockVariation} = wp.blocks; | ||
const {__} = wp.i18n; | ||
|
||
/* | ||
This file will register general block variations. In case of register a very | ||
specific block variation, such as PostsList or ActionsList ,you can create an isolated file. | ||
*/ | ||
|
||
export const registerBlockVariations = () => { | ||
// Group Stretched Link variation | ||
registerBlockVariation('core/group', { | ||
name: 'group-stretched-link', | ||
title: __('Stretched Link', 'planet4-blocks-backend'), | ||
description: __('Make the entire block contents clickable, using the first link inside.', 'planet4-blocks-backend'), | ||
attributes: {className: 'group-stretched-link'}, | ||
scope: ['inserter', 'transform'], | ||
isActive: blockAttributes => { | ||
return blockAttributes.className === 'group-stretched-link'; | ||
}, | ||
icon: 'admin-links', | ||
}); | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.group-stretched-link { | ||
outline: 1px dashed grey; | ||
outline-offset: 2px; | ||
} |
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,35 @@ | ||
.group-stretched-link { | ||
position: relative; | ||
|
||
[class*="is-style-rounded-"].force-no-caption { | ||
overflow: hidden; | ||
border-radius: 50%; | ||
transform: translateZ(0); // This is needed for Safari, otherwise the animation looks off. | ||
|
||
img { | ||
transition: transform .2s ease-in-out; | ||
} | ||
} | ||
|
||
&:hover { | ||
[class*="is-style-rounded-"] img { | ||
transform: scale(1.3); | ||
} | ||
} | ||
|
||
// Ensure it's only applying to the first link. | ||
a:first-of-type { | ||
&:before { | ||
content: ""; | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
bottom: 0; | ||
right: 0; | ||
} | ||
|
||
&:after { | ||
display: none; | ||
} | ||
} | ||
} |