diff --git a/app/Admin/Widgets/InfoBox.php b/app/Admin/Widgets/InfoBox.php new file mode 100644 index 00000000..32cc3db9 --- /dev/null +++ b/app/Admin/Widgets/InfoBox.php @@ -0,0 +1,110 @@ +title($title); + $this->content($content); + $this->icon($icon); + } + + /** + * Info Box 图标 + * + * @param string $icon + * @return $this + */ + public function icon(string $icon = null) + { + $this->icon = $icon; + + return $this; + } + + /** + * Info Box 内容 + * + * @param string $content + * @return $this + */ + public function content($content) + { + $this->content = $content; + + return $this; + } + + /** + * Info Box 标题 + * + * @param string $title + * @return $this + */ + public function title($title) + { + $this->title = $title; + + return $this; + } + + /** + * Add style. + * + * @param string $style + * @return $this + */ + public function style($style = 'info') + { + $this->style = $style; + + return $this; + } + + /** + * Variables in view. + * + * @return array + */ + public function defaultVariables() + { + $this->class('info-box'); + + return [ + 'title' => $this->title, + 'content' => $this->content, + 'icon' => $this->icon, + 'style' => $this->style, + 'attributes' => $this->formatHtmlAttributes(), + ]; + } +} diff --git a/resources/views/vendor/admin/widgets/info-box.blade.php b/resources/views/vendor/admin/widgets/info-box.blade.php new file mode 100644 index 00000000..639dbe5b --- /dev/null +++ b/resources/views/vendor/admin/widgets/info-box.blade.php @@ -0,0 +1,31 @@ + + +
+ @if($icon) + + + + @endif + +
+ {{ $title }} + {!! $content !!} +
+