Skip to content

Commit

Permalink
Extend Image styles
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewalczak committed Aug 13, 2020
1 parent 8dea12b commit 16753b5
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
23 changes: 13 additions & 10 deletions packages/block-editor/src/components/block-styles/style.native.scss
Original file line number Diff line number Diff line change
@@ -1,38 +1,41 @@
$outline-space: 3px;
$image-height: 64px;

.image {
height: 58px;
margin-left: 3px;
margin-right: 3px;
margin-top: 3px;
margin-bottom: 3px;
height: $image-height - 2 * $outline-space;
margin-left: $outline-space;
margin-right: $outline-space;
margin-top: $outline-space;
margin-bottom: $outline-space;
}

.container {
padding-right: $grid-unit;
padding-bottom: $grid-unit;
align-items: center;
}

.imageWrapper {
height: 64px;
justify-content: center;
height: $image-height;
width: 100%;
}

.rounded {
border-radius: 32px;
border-radius: $image-height / 2;
overflow: hidden;
}

.label {
color: $gray-dark;
padding-top: $grid-unit;
text-align: center;
}

.labelDark {
color: $white;
}

.outline {
height: 64px;
height: $image-height;
border-color: $blue-wordpress;
border-width: 1px;
position: absolute;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {
TouchableWithoutFeedback,
Text,
Dimensions,
Image,
Animated,
Easing,
Image,
} from 'react-native';
/**
* WordPress dependencies
Expand Down Expand Up @@ -66,8 +66,8 @@ function StyleVariation( { onPress, isActive, style, url } ) {
animateOutline();
} }
>
<View style={ styles.container }>
<View style={ [ styles.imageWrapper, { width: itemWidth } ] }>
<View style={ [ styles.container, { width: itemWidth } ] }>
<View style={ styles.imageWrapper }>
{ isActive && (
<Animated.View
style={ [
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/image/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ export class ImageEdit extends React.Component {
retryMessage={ retryMessage }
url={ url }
width={ width }
style={ styles[ className ] }
imageShapeStyle={ styles[ className ] }
/>
);
} }
Expand Down
5 changes: 3 additions & 2 deletions packages/components/src/mobile/image/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const ImageComponent = ( {
openMediaOptions,
retryMessage,
url,
style,
imageShapeStyle,
width: imageWidth,
} ) => {
const [ imageData, setImageData ] = useState( null );
Expand Down Expand Up @@ -139,6 +139,7 @@ const ImageComponent = ( {
? containerSize?.width / imageData?.aspectRatio
: undefined,
},
imageShapeStyle,
];

return (
Expand Down Expand Up @@ -180,7 +181,7 @@ const ImageComponent = ( {
<View style={ focalPoint && styles.focalPointContent }>
<Image
aspectRatio={ imageData?.aspectRatio }
style={ [ imageStyles, style ] }
style={ imageStyles }
source={ { uri: url } }
{ ...( ! focalPoint && {
resizeMethod: 'scale',
Expand Down

0 comments on commit 16753b5

Please sign in to comment.