Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RNMobile] Gallery - GalleryImage component #18155

Merged
merged 48 commits into from
Dec 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
c470dfe
Add native gallery - gallery image
pinarol Oct 10, 2019
2e3e93a
WIP - refactor native gallery image
mkevins Oct 25, 2019
4865abd
WIP - gallery image - deselect caption when image tapped
mkevins Oct 29, 2019
30f09e2
Add MediaUploadProgress to GalleryImage
mkevins Nov 1, 2019
8d6f78d
Extract styles from gallery image
mkevins Nov 4, 2019
1d409a3
Add failed upload UI to gallery image
mkevins Nov 4, 2019
77ff571
Remove HOC from gallery image
mkevins Nov 4, 2019
596e3ab
Remove unused props / methods in gallery image
mkevins Nov 4, 2019
01f7b05
Remove gallery image when upload is cancelled
mkevins Nov 4, 2019
d62c85d
Remove unused code from gallery image
mkevins Nov 4, 2019
c77d8cd
Use accessibilityLabel prop on gallery image buttons
mkevins Nov 4, 2019
d5d6aba
Remove href code from gallery image
mkevins Nov 4, 2019
685a361
Extract remaining styles from gallery image
mkevins Nov 4, 2019
7b779e3
Fix lint errors
mkevins Nov 4, 2019
d12c5dc
[RNMobile] Gallery - Button (#18264)
mkevins Nov 6, 2019
d539cae
Fix isCropped style for mobile gallery image
mkevins Nov 7, 2019
47d1c37
Use withPreferredColorScheme in gallery image
mkevins Nov 12, 2019
7c77fa2
Add colorScheme styles for gallery image container
mkevins Nov 12, 2019
1b04436
Fix lint
mkevins Nov 12, 2019
52ddde2
Add buttonActive style for gallery image
mkevins Nov 12, 2019
1f12a91
Clean up button styles on gallery image
mkevins Nov 12, 2019
9109d7a
Fix lint
mkevins Nov 12, 2019
9393545
Accept style override props in RichText
mkevins Nov 12, 2019
5aabf79
Condense gallery changes to native RichText component
mkevins Nov 19, 2019
28b676e
Use withPreferredColorScheme HOC for gallery caption
mkevins Nov 12, 2019
e212fd5
Add some caption styles to gallery image
mkevins Nov 12, 2019
37bd880
Fix lint
mkevins Nov 12, 2019
438a4e1
Refactor GalleryImage styles
mkevins Nov 19, 2019
1758be3
Add ellipsis mode and ScrollView to gallery caption
mkevins Nov 19, 2019
51a1c87
Extract gallery caption type flags for readability
mkevins Nov 19, 2019
7880f45
Use RichText force blur prop in GalleryImage
mkevins Nov 19, 2019
839383b
Fix lint
mkevins Nov 19, 2019
b42894e
Remove unnecessary View from gallery button
mkevins Nov 21, 2019
1a625d2
Adjust gallery button icon styles
mkevins Nov 21, 2019
b8687a1
Center align gallery caption text
mkevins Nov 21, 2019
8a85d4d
Adjust gallery caption font-size to 12px
mkevins Nov 21, 2019
4ce0110
Use RichText to display unselected GalleryImage caption
mkevins Nov 21, 2019
406417b
Use child-first approach for gallery image UI components
mkevins Nov 21, 2019
a05c203
Fix lint
mkevins Nov 21, 2019
46295c3
Use full height for gallery caption scroll view
mkevins Nov 22, 2019
f47fc02
Use transparent background by default for gallery caption
mkevins Nov 22, 2019
adc3dfc
Eliminate <p> tags in gallery image caption
mkevins Nov 25, 2019
f96bfdb
Use variables instead of functions in gallery image scss
mkevins Nov 26, 2019
2152170
Extract gallery button icon sizes to constants
mkevins Nov 26, 2019
703c4ea
Tidy up gallery image style constants
mkevins Nov 26, 2019
664b35a
Fix scss imports for jest
mkevins Nov 28, 2019
b982d1d
Use "p" tagName in gallery image on iOS to fix alignment
mkevins Dec 4, 2019
c7ab5cb
Trigger travis
mkevins Dec 4, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions packages/block-library/src/gallery/gallery-button.native.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* External dependencies
*/
import { StyleSheet, TouchableOpacity } from 'react-native';

/**
* WordPress dependencies
*/
import { Icon } from '@wordpress/components';

/**
* Internal dependencies
*/
import style from './gallery-image-style.scss';

export function Button( props ) {
const {
icon,
iconSize = 24,
onClick,
disabled,
'aria-disabled': ariaDisabled,
accessibilityLabel = 'button',
style: customStyle,
} = props;

const buttonStyle = StyleSheet.compose( style.buttonActive, customStyle );

const isDisabled = disabled || ariaDisabled;

const { fill } = isDisabled ? style.buttonDisabled : style.button;

return (
<TouchableOpacity
style={ buttonStyle }
activeOpacity={ 0.7 }
accessibilityLabel={ accessibilityLabel }
accessibilityRole={ 'button' }
onPress={ onClick }
disabled={ isDisabled }
>
<Icon icon={ icon } fill={ fill } size={ iconSize } />
</TouchableOpacity>
);
}

export default Button;
161 changes: 161 additions & 0 deletions packages/block-library/src/gallery/gallery-image-style.native.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
$get-gallery-image-container-height: 150px;
$get-overlay-border-width: 3px;
$get-caption-background-color: rgba(0, 0, 0, 0.4);

.galleryImageContainer {
flex: 1;
height: $get-gallery-image-container-height;
background-color: $gray-lighten-30;
}

.galleryImageContainerDark {
background-color: $gray-90;
}

.image {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
opacity: 1;
}

.imageUploading {
opacity: 0.3;
}

.overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
border-width: $get-overlay-border-width;
border-color: #0000;
}

.overlaySelected {
border-color: $blue-wordpress;
}

.button {
fill: $gray-0;
width: 30px;
}

.buttonDisabled {
fill: $gray-30;
}

.buttonActive {
flex-direction: row;
justify-content: center;
align-items: center;
border-radius: 6px;
border-color: $gray-70;
background-color: $gray-70;
}

.moverButtonContainer {
flex-direction: row;
align-items: center;
border-radius: 3px;
background-color: $gray-70;
}

.separator {
border-right-color: $gray-30;
// border-right-width: StyleSheet.hairlineWidth;
border-right-width: 1px;
height: 20px;
}

.removeButton {
width: 30px;
border-radius: 30px;
}

.toolbar {
padding: 5px;
flex-direction: row;
justify-content: space-between;
}

.uploadFailedContainer {
position: absolute;
background-color: rgba(0, 0, 0, 0.5);
width: 100%;
height: 100%;
justify-content: center;
align-items: center;
}

.uploadFailed {
width: 24px;
height: 24px;
justify-content: center;
align-items: center;
}

.uploadFailedIcon {
fill: #fff;
width: 100%;
height: 100%;
}

.uploadFailedText {
color: #fff;
font-size: 14px;
margin-top: 5px;
}

.captionContainer {
flex: 1;
flex-direction: row;
align-items: flex-end;
}

@mixin caption-shared {
font-size: 12px;
background-color: #0000;
color: #fff;
font-family: $default-regular-font;
min-height: $min-height-paragraph;
text-align: center;
}

.caption {
@include caption-shared;
background-color: $get-caption-background-color;
}

.captionPlaceholder {
color: #ccc;
}

/*
.captionDark {
background-color: #0007;
}
*/

// expand caption container to compensate for overlay border
.captionExpandedContainer {
$width: $get-overlay-border-width;
// constrain height to gallery image height for caption scroll
max-height: $get-gallery-image-container-height;
position: absolute;
bottom: - $width;
left: - $width;
right: - $width;
padding-bottom: $width;
padding-left: $width;
padding-right: $width;
// use caption background color on container when expanded
background-color: $get-caption-background-color;
}

.captionExpanded {
@include caption-shared;
}
Loading