Skip to content

Commit

Permalink
after review
Browse files Browse the repository at this point in the history
  • Loading branch information
nuritsha committed Dec 25, 2024
1 parent c635cc7 commit 618c076
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 22 deletions.
37 changes: 20 additions & 17 deletions modules/content/assets/scss/hello-plus-zigzag.scss
Original file line number Diff line number Diff line change
Expand Up @@ -135,29 +135,32 @@
}
}

&.has-direction-start {
.ehp-zigzag__item-wrapper:nth-child(odd) {
.ehp-zigzag__item-container{
flex-direction: row;
&.has-direction {
&-start {
.ehp-zigzag__item-wrapper:nth-child(odd) {
.ehp-zigzag__item-container {
flex-direction: row;
}
}
}

.ehp-zigzag__item-wrapper:nth-child(even) {
.ehp-zigzag__item-container {
flex-direction: row-reverse;
.ehp-zigzag__item-wrapper:nth-child(even) {
.ehp-zigzag__item-container {
flex-direction: row-reverse;
}
}
}
}

&.has-direction-end {
.ehp-zigzag__item-wrapper:nth-child(odd) {
.ehp-zigzag__item-container {
flex-direction: row-reverse;
&-end {
.ehp-zigzag__item-wrapper:nth-child(odd) {
.ehp-zigzag__item-container {
flex-direction: row-reverse;
}
}
}
.ehp-zigzag__item-wrapper:nth-child(even) {
.ehp-zigzag__item-container{
flex-direction: row;

.ehp-zigzag__item-wrapper:nth-child(even) {
.ehp-zigzag__item-container {
flex-direction: row;
}
}
}
}
Expand Down
12 changes: 7 additions & 5 deletions modules/content/classes/render/widget-zig-zag-render.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@ public function __construct( Zig_Zag $widget ) {
}

public function render(): void {
$layout_classnames = self::LAYOUT_CLASSNAME;
$first_zigzag_direction = $this->settings['first_zigzag_direction'];
$has_alternate_icon_color = $this->settings['has_alternate_icon_color'];

$layout_classnames .= ' has-direction-' . $first_zigzag_direction;
$layout_classnames = [
self::LAYOUT_CLASSNAME,
'has-direction-' . $first_zigzag_direction,
];

if ( 'yes' === $has_alternate_icon_color ) {
$layout_classnames .= ' has-alternate-icon-color';
$layout_classnames[] = 'has-alternate-icon-color';
}

$this->widget->add_render_attribute( 'layout', [
Expand All @@ -47,9 +50,8 @@ public function render(): void {
$repeater = 'image' === $graphic_element ? $this->settings['image_zigzag_items'] : $this->settings['icon_zigzag_items'];

foreach ( $repeater as $key => $item ) {
$item_class = self::ITEM_CLASSNAME;
$this->widget->add_render_attribute( 'zigzag-item-' . $key, [
'class' => $item_class,
'class' => self::ITEM_CLASSNAME,
] );
?>
<div class="ehp-zigzag__item-wrapper">
Expand Down

0 comments on commit 618c076

Please sign in to comment.