Skip to content

Commit

Permalink
Image Block: Add border radius support (#27667)
Browse files Browse the repository at this point in the history
* Add border radius support to image block
* Update theme-json docs with border radius addition
  • Loading branch information
aaronrobertshaw authored Jan 25, 2021
1 parent cdf61b8 commit b58732d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/designers-developers/developers/themes/theme-json.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ h4 {
| Context | Radius |
| --- | --- |
| Group | Yes |
| Image | Yes |

#### Color Properties

Expand Down
5 changes: 4 additions & 1 deletion packages/block-library/src/image/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@
}
},
"supports": {
"anchor": true
"anchor": true,
"__experimentalBorder": {
"radius": true
}
},
"editorStyle": "wp-block-image-editor",
"style": "wp-block-image"
Expand Down
4 changes: 4 additions & 0 deletions packages/block-library/src/image/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ figure.wp-block-image:not(.wp-block) {
margin-top: -9px;
margin-left: -9px;
}

&:not(.is-style-rounded) > div {
border-radius: inherit;
}
}

// This is necessary for the editor resize handles to accurately work on a non-floated, non-resized, small image.
Expand Down
4 changes: 4 additions & 0 deletions packages/block-library/src/image/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
max-width: 100%;
}

&:not(.is-style-rounded) img {
border-radius: inherit;
}

&.aligncenter {
text-align: center;
}
Expand Down

0 comments on commit b58732d

Please sign in to comment.