-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
122 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div class="ui breadcrumb"> | ||
{!! implode($divider, $items) !!} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
|
||
namespace Laravolt\Support\Breadcrumb; | ||
|
||
use Laravolt\Support\Contracts\Breadcrumb; | ||
|
||
/** | ||
* Class SemanticUIBreadcrumb | ||
* | ||
* @package Laravolt\Support\Breadcrumb | ||
*/ | ||
class SemanticUIBreadcrumb implements Breadcrumb | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $divider; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
protected $items = []; | ||
|
||
/** | ||
* Set divider | ||
* | ||
* @param string $divider | ||
* @return mixed | ||
*/ | ||
public function divider($divider = '<div class="divider"> / </div>') | ||
{ | ||
$this->divider = $divider; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Add item for breadcrumn | ||
* | ||
* @param $name | ||
* @param string $url | ||
* @return mixed | ||
*/ | ||
public function addItem($name, $url = '') | ||
{ | ||
if (! empty($url)) { | ||
$item = sprintf('<a href="%s" class="section">%s</a>', $url, $name); | ||
} else { | ||
$item = sprintf('<div class="active section">%s</div>', $name); | ||
} | ||
|
||
array_push($this->items, $item); | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Render breadcrumb view | ||
* | ||
* @return mixed | ||
*/ | ||
public function render() | ||
{ | ||
return view('support::breadcrumb.semantic-ui', [ | ||
'divider' => $this->divider, | ||
'items' => $this->items | ||
])->render(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace Laravolt\Support\Contracts; | ||
|
||
/** | ||
* Interface Breadcrumb | ||
* | ||
* @package Laravolt\Support\Contracts | ||
*/ | ||
interface Breadcrumb | ||
{ | ||
/** | ||
* Set divider | ||
* | ||
* @param string $divider | ||
* @return mixed | ||
*/ | ||
public function divider($divider = ''); | ||
|
||
/** | ||
* Add item for breadcrumn | ||
* | ||
* @param $name | ||
* @param string $url | ||
* @return mixed | ||
*/ | ||
public function addItem($name, $url = ''); | ||
|
||
/** | ||
* Render breadcrumb view | ||
* | ||
* @return mixed | ||
*/ | ||
public function render(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters