Skip to content

Commit

Permalink
Merge pull request #10 from schatzopoulos/master
Browse files Browse the repository at this point in the history
Add support for extra small icons
  • Loading branch information
bigpaulie authored Apr 1, 2018
2 parents 16b18db + 935b067 commit 49a0855
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,16 @@ By default the main container has an id attribute similar to #w0, you can change
```

#### Widget button types
The widget provides to types of buttons
The widget provides three types of buttons
extra-small (small icons only)
small (icon only)
large (icon + text)


```php
echo Share::widget([
'type' => Share::TYPE_EXTRA_SMALL
```

```php
echo Share::widget([
'type' => Share::TYPE_SMALL
Expand Down
13 changes: 13 additions & 0 deletions src/Widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
* @package bigpaulie\social\share
*/
class Widget extends \yii\base\Widget {
/**
* Widget type with extra small buttons
* @var string
*/
const TYPE_EXTRA_SMALL = 'extra-small';

/**
* Widget type with small buttons
Expand Down Expand Up @@ -180,6 +185,14 @@ protected function parseTemplate($network)
$url = $this->networks[$network];

switch ($this->type) {
case self::TYPE_EXTRA_SMALL:
$button = str_replace(
'{button}',
'<a href="#" class="btn btn-sm btn-social-icon btn-{network}" onClick="sharePopup(\'' . $url . '\');">'
. '<i class="fa fa-{network}"></i></a>',
$this->template
);
break;
case self::TYPE_SMALL:
$button = str_replace(
'{button}',
Expand Down

0 comments on commit 49a0855

Please sign in to comment.