Skip to content

Commit b077799

Browse files
committed
Address code review feedback
1 parent 77a1da3 commit b077799

File tree

5 files changed

+28
-30
lines changed

5 files changed

+28
-30
lines changed

css/cloudinary.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

php/class-utils.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,14 +1377,14 @@ public static function get_inline_svg( $file_path, $echo = true ) {
13771377

13781378
// Check if file exists and is an SVG.
13791379
if ( ! file_exists( $file_path ) || 'svg' !== pathinfo( $file_path, PATHINFO_EXTENSION ) ) {
1380-
return $echo ? '' : '';
1380+
return '';
13811381
}
13821382

13831383
// Get the SVG content.
13841384
$svg_content = file_get_contents( $file_path ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
13851385

13861386
if ( false === $svg_content ) {
1387-
return $echo ? '' : '';
1387+
return '';
13881388
}
13891389

13901390
// Sanitize SVG content to prevent XSS attacks.

php/media/class-global-transformations.php

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -672,32 +672,21 @@ public function transformations_column_value( $column_name, $attachment_id ) {
672672
if ( ! empty( $transformations ) || ! empty( $text_overlay ) || ! empty( $image_overlay ) ) {
673673
$text = __( 'Edit Effects', 'cloudinary' );
674674
}
675+
676+
$transformation_active_class = ! empty( $transformations ) ? 'cld_transformations__icon--active' : '';
677+
$text_overlay_active_class = ! empty( $text_overlay ) ? 'cld_transformations__icon--active' : '';
678+
$image_overlay_active_class = ! empty( $image_overlay ) ? 'cld_transformations__icon--active' : '';
675679
?>
676680
<a href="<?php echo esc_url( $link ); ?>" class="cld_transformations__icons">
677-
<span class="cld_transformations__icon
678-
<?php
679-
if ( ! empty( $transformations ) ) {
680-
echo 'cld_transformations__icon--active';}
681-
?>
682-
">
681+
<span class="cld_transformations__icon <?php echo esc_attr( $transformation_active_class ); ?>">
683682
<?php Utils::get_inline_svg( 'css/images/transformation_edit.svg', true ); ?>
684683
</span>
685684

686-
<span class="cld_transformations__icon
687-
<?php
688-
if ( ! empty( $text_overlay ) ) {
689-
echo 'cld_transformations__icon--active';}
690-
?>
691-
">
685+
<span class="cld_transformations__icon <?php echo esc_attr( $text_overlay_active_class ); ?>">
692686
<?php Utils::get_inline_svg( 'css/images/text_overlay.svg', true ); ?>
693687
</span>
694688

695-
<span class="cld_transformations__icon
696-
<?php
697-
if ( ! empty( $image_overlay ) ) {
698-
echo 'cld_transformations__icon--active';}
699-
?>
700-
">
689+
<span class="cld_transformations__icon <?php echo esc_attr( $image_overlay_active_class ); ?>">
701690
<?php Utils::get_inline_svg( 'css/images/image_overlay.svg', true ); ?>
702691
</span>
703692
</a>

src/css/components/_edit_overlay.scss

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,22 @@
8888
}
8989

9090
.cld-ui-suffix {
91-
margin-left: 0;
91+
margin-inline-start: 0;
9292
}
9393

9494
.cld-ui-preview {
9595
box-sizing: border-box;
9696
}
9797
}
9898

99+
.asset-edit-preview {
100+
@media only screen and (min-width: $size-small) {
101+
position: sticky;
102+
top: 20px;
103+
align-self: flex-start;
104+
}
105+
}
106+
99107
#asset-preview-transformation-string {
100108
box-sizing: border-box;
101109
display: block;

ui-definitions/settings-pages.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -946,12 +946,13 @@
946946
'class' => array(
947947
'column-45',
948948
'cld-ui-preview',
949+
'asset-edit-preview',
949950
),
950951
array(
951-
'type' => 'panel',
952-
'title' => __( 'Preview', 'cloudinary' ),
952+
'type' => 'panel',
953+
'title' => __( 'Preview', 'cloudinary' ),
953954
array(
954-
'type' => 'row',
955+
'type' => 'row',
955956
'attributes' => array(
956957
'wrap' => array(
957958
'style' => 'display: flex; justify-content: center; align-items: center;',
@@ -984,13 +985,13 @@
984985
'type' => 'tag',
985986
'element' => 'div',
986987
'attributes' => array(
987-
'id' => 'asset-preview-success-message',
988-
'style' => 'display: none;',
988+
'id' => 'asset-preview-success-message',
989+
'style' => 'display: none;',
989990
),
990991
array(
991-
'type' => 'tag',
992-
'element' => 'p',
993-
'content' => __( 'Effects applied successfully!', 'cloudinary' ),
992+
'type' => 'tag',
993+
'element' => 'p',
994+
'content' => __( 'Effects applied successfully!', 'cloudinary' ),
994995
),
995996
),
996997
),

0 commit comments

Comments
 (0)