This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Product Gallery: Add crop, zoom and full-screen settings
- Loading branch information
1 parent
54d195b
commit 7de1f0f
Showing
5 changed files
with
134 additions
and
19 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,74 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { InspectorControls } from '@wordpress/block-editor'; | ||
import { PanelBody, ToggleControl } from '@wordpress/components'; | ||
import { __ } from '@wordpress/i18n'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import type { ProductGallerySettingsProps } from '../types'; | ||
|
||
export const ProductGalleryBlockSettings = ( { | ||
attributes, | ||
setAttributes, | ||
}: ProductGallerySettingsProps ) => { | ||
const { cropImages, hoverZoom, fullScreenOnClick } = attributes; | ||
return ( | ||
<InspectorControls> | ||
<PanelBody | ||
title={ __( 'Media Settings', 'woo-gutenberg-products-block' ) } | ||
> | ||
<ToggleControl | ||
label={ __( | ||
'Crop images to fit', | ||
'woo-gutenberg-products-block' | ||
) } | ||
help={ __( | ||
'Images will be cropped to fit within a square space.', | ||
'woo-gutenberg-products-block' | ||
) } | ||
checked={ cropImages } | ||
onChange={ () => | ||
setAttributes( { | ||
cropImages: ! cropImages, | ||
} ) | ||
} | ||
/> | ||
<ToggleControl | ||
label={ __( | ||
'Zoom while hovering', | ||
'woo-gutenberg-products-block' | ||
) } | ||
help={ __( | ||
'While hovering the large image will zoom in by 30%.', | ||
'woo-gutenberg-products-block' | ||
) } | ||
checked={ hoverZoom } | ||
onChange={ () => | ||
setAttributes( { | ||
hoverZoom: ! hoverZoom, | ||
} ) | ||
} | ||
/> | ||
<ToggleControl | ||
label={ __( | ||
'Full-screen when clicked', | ||
'woo-gutenberg-products-block' | ||
) } | ||
help={ __( | ||
'Clicking on the large image will open a full-screen gallery experience.', | ||
'woo-gutenberg-products-block' | ||
) } | ||
checked={ fullScreenOnClick } | ||
onChange={ () => | ||
setAttributes( { | ||
fullScreenOnClick: ! fullScreenOnClick, | ||
} ) | ||
} | ||
/> | ||
</PanelBody> | ||
</InspectorControls> | ||
); | ||
}; |
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