Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
cuileon committed May 20, 2018
1 parent 3348c3d commit d322f3f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 56 deletions.
53 changes: 1 addition & 52 deletions FontAwesome.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class FontAwesome implements IconInterface
public function __construct($type, $name, $options = [])
{
FontAwesomeAsset::register(\Yii::$app->getView());
Html::addCssClass($this->htmlOptions, ['type' => $type, 'name' => 'fa-' . $name]);
Html::addCssClass($this->htmlOptions, array_merge(['type' => $type, 'name' => 'fa-' . $name], $options['class']));
}

public function render()
Expand All @@ -29,55 +29,4 @@ public function __toString()
{
return Html::tag($this->tag, null, $this->htmlOptions);
}

public function fw()
{
Html::addCssClass($this->htmlOptions, ['fw' => 'fa-fw']);
return $this;
}

public static function spin()
{

}

public static function size()
{

}

public static function transform()
{

}

public static function mask()
{

}

public static function ul()
{

}

public static function border()
{

}

public static function pullRight()
{

}

public static function pullLeft()
{

}

public static function pulse()
{

}
}
16 changes: 12 additions & 4 deletions Icon.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace yiichina\icons;

use yii\helpers\Html;

/**
* This is just an example.
*/
Expand All @@ -14,21 +16,27 @@ public static function show($name, $options = [])

public static function fas($name, $options = [])
{
return new FontAwesome('fas', $name, $options);
FontAwesomeAsset::register(\Yii::$app->getView());
Html::addCssClass($options, ['type' =>'fas', 'name' => 'fa-' . $name]);
return Html::tag('i', null, $options) . ' ';
}

public static function far($name, $options = [])
{
return new FontAwesome('far', $name, $options);
FontAwesomeAsset::register(\Yii::$app->getView());
Html::addCssClass($options, ['type' =>'far', 'name' => 'fa-' . $name]);
return Html::tag('i', null, $options) . ' ';
}

public static function fal($name, $options = [])
{
return new FontAwesome('fal', $name, $options);
return new FontAwesome('fal', $name, $options) . ' ';
}

public static function fab($name, $options = [])
{
return new FontAwesome('fab', $name, $options);
FontAwesomeAsset::register(\Yii::$app->getView());
Html::addCssClass($options, ['type' =>'fab', 'name' => 'fa-' . $name]);
return Html::tag('i', null, $options) . ' ';
}
}

0 comments on commit d322f3f

Please sign in to comment.