65 lines
1.2 KiB
PHP
65 lines
1.2 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
namespace Builder\View\Components\Widgets;
|
|
use Builder\View\Components\Component;
|
|
class Card extends Component
|
|
{
|
|
protected $componentName = "Card";
|
|
protected $header;
|
|
protected $bodyStyle;
|
|
protected $shadow = "never";
|
|
|
|
protected $content;
|
|
|
|
public static function make()
|
|
{
|
|
return new Card();
|
|
}
|
|
|
|
/**
|
|
* 设置 header
|
|
* @param string|\Closure $header
|
|
* @return $this
|
|
*/
|
|
public function header($header)
|
|
{
|
|
$this->header = instance_content($header);
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* 设置 body 的样式
|
|
* @param string|array $bodyStyle
|
|
* @return $this
|
|
*/
|
|
public function bodyStyle($bodyStyle)
|
|
{
|
|
$this->bodyStyle = $bodyStyle;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* 设置阴影显示时机
|
|
* always / hover / never
|
|
* @param string $shadow
|
|
* @return $this
|
|
*/
|
|
public function shadow(string $shadow)
|
|
{
|
|
$this->shadow = $shadow;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* 设置内容组件
|
|
* @param $content
|
|
* @return $this
|
|
*/
|
|
public function content($content)
|
|
{
|
|
$this->content = instance_content($content);
|
|
return $this;
|
|
}
|
|
|
|
}
|