diff --git a/zin/wg/cell/v1.php b/zin/wg/cell/v1.php index f353156473..fd6721e0f2 100644 --- a/zin/wg/cell/v1.php +++ b/zin/wg/cell/v1.php @@ -8,15 +8,6 @@ class cell extends wg { static $defineProps = 'order,grow,shrink,width,align,flex'; - public function onAddChild($child) - { - if($child instanceof wg) { - $this->addToBlock('inner', $child); - return false; - } - return null; - } - protected function build() { $basis = empty($this->prop('width')) ? 'auto' : $this->prop('width'); @@ -32,9 +23,11 @@ class cell extends wg if(!empty($this->prop('width'))) $style['flex-basis'] = $this->prop('width'); if(!empty($this->prop('align'))) $style['align-self'] = $this->prop('align'); if(!empty($this->prop('flex'))) $style['flex'] = $this->prop('flex'); + return div( setStyle($style), - $this->block('inner'), + set($this->props->skip(array_keys(static::getDefinedProps()))), + $this->children() ); } } diff --git a/zin/wg/center/v1.php b/zin/wg/center/v1.php index 33920e0e67..d9de5522fc 100644 --- a/zin/wg/center/v1.php +++ b/zin/wg/center/v1.php @@ -4,20 +4,12 @@ namespace zin; class center extends wg { - public function onAddChild($child) - { - if($child instanceof wg) { - $this->addToBlock('inner', $child); - return false; - } - return null; - } - protected function build() { return div( setClass("flex justify-center items-center"), - $this->block('inner'), + set($this->props->skip(array_keys(static::getDefinedProps()))), + $this->children() ); } } diff --git a/zin/wg/column/v1.php b/zin/wg/column/v1.php index f144633de4..f53712386c 100644 --- a/zin/wg/column/v1.php +++ b/zin/wg/column/v1.php @@ -6,22 +6,15 @@ class column extends wg { static $defineProps = 'justify,align'; - public function onAddChild($child) - { - if($child instanceof wg) { - $this->addToBlock('inner', $child); - return false; - } - return null; - } - protected function build() { $justify = empty($this->prop('justify')) ? 'start' : $this->prop('justify'); $align = empty($this->prop('align')) ? 'start' : $this->prop('align'); + return div( setClass("col justify-$justify items-$align"), - $this->block('inner'), + set($this->props->skip(array_keys(static::getDefinedProps()))), + $this->children() ); } } diff --git a/zin/wg/label/v1.php b/zin/wg/label/v1.php index 017fe4c4c4..c012f6fa44 100644 --- a/zin/wg/label/v1.php +++ b/zin/wg/label/v1.php @@ -6,24 +6,12 @@ class label extends wg { static $defineProps = 'text'; - public function onAddChild($child) - { - if(is_string($child) && !$this->props->has('text')) - { - $this->props->set('text', $child); - return false; - } - return null; - } - public function build() { return span( - $this->prop('text'), - setClass(array( - 'label', - $this->props->class->toStr(), - )), + setClass('label'), + set($this->props->skip(array_keys(static::getDefinedProps()))), + $this->children() ); } } diff --git a/zin/wg/pagemain/v1.php b/zin/wg/pagemain/v1.php index 27fc300529..9c5de1c8ca 100644 --- a/zin/wg/pagemain/v1.php +++ b/zin/wg/pagemain/v1.php @@ -3,21 +3,13 @@ namespace zin; class pagemain extends wg { - public function onAddChild($child) - { - if($child instanceof wg) { - $this->addToBlock('inner', $child); - return false; - } - return null; - } - protected function build() { - $pagemain = h::div( - h::div( + $pagemain = div( + div( setClass('container'), - $this->block('inner'), + set($this->props->skip(array_keys(static::getDefinedProps()))), + $this->children() ) ); $pagemain->setDefaultProps(array('id' => 'main')); diff --git a/zin/wg/row/v1.php b/zin/wg/row/v1.php index 67cf4b0415..d702e2362a 100644 --- a/zin/wg/row/v1.php +++ b/zin/wg/row/v1.php @@ -6,22 +6,15 @@ class row extends wg { static $defineProps = 'justify,align'; - public function onAddChild($child) - { - if($child instanceof wg) { - $this->addToBlock('inner', $child); - return false; - } - return null; - } - protected function build() { $justify = empty($this->prop('justify')) ? 'start' : $this->prop('justify'); $align = empty($this->prop('align')) ? 'start' : $this->prop('align'); + return div( setClass("row justify-$justify items-$align"), - $this->block('inner'), + set($this->props->skip(array_keys(static::getDefinedProps()))), + $this->children() ); } }