Skip to content

Commit

Permalink
Merge pull request #9 from CottaCush/features/component-styling
Browse files Browse the repository at this point in the history
Handle empty data set form query; Fix clashing styles
  • Loading branch information
Mogbeyi authored Oct 8, 2018
2 parents 0d331cd + 405254a commit 4183023
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 57 deletions.
12 changes: 6 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 17 additions & 19 deletions src/asset-files/css/styles.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 14 additions & 13 deletions src/asset-files/less/dashboard-widgets.less
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
@white: #fff;
.cricket-wrapper {
.card {
.cricket-card {
border-radius: 4px;
box-shadow: 0 2px 0 rgba(90, 97, 105, .07),
0 4px 8px rgba(90, 97, 105, .08),
0 10px 10px rgba(90, 97, 105, .03),
0 7px 70px rgba(90, 97, 105, .08);
.card-text {
.cricket-card-text {
margin-bottom: 1.5625rem;
}
a {
Expand All @@ -14,41 +15,41 @@
}
}
}
.card-small {
.cricket-card-small {
box-shadow: 0 2px 0 rgba(90, 97, 105, .11),
0 4px 8px rgba(90, 97, 105, .12),
0 10px 10px rgba(90, 97, 105, .06),
0 7px 70px rgba(90, 97, 105, .1);
.card-body {
.cricket-card-body {
padding: 1rem 1.5rem;
}
.card-footer {
.cricket-card-footer {
padding: 1rem 1.5rem;
}
.card-header {
.cricket-card-header {
padding: 1rem 1.5rem;
}
}
.card-body {
.cricket-card-body {
> p {
&:last-child {
margin-bottom: 0;
}
}
}
.card-title {
.cricket-card-title {
font-weight: 500;
margin-bottom: .75rem;
}
.card-subtitle {
.cricket-card-subtitle {
margin-top: -1.09375rem;
}
.card-link {
& + .card-link {
.cricket-card-link {
& + .cricket-card-link {
margin-left: 1.875rem;
}
}
.card-header {
.cricket-card-header {
padding: 1.09375rem 1.875rem;
background-color: @white;
border-bottom: none;
Expand All @@ -58,7 +59,7 @@
border-radius: 4px 4px 0 0;
}
}
.card-footer {
.cricket-card-footer {
padding: 1.09375rem 1.875rem;
background-color: @white;
border-top: none;
Expand Down
7 changes: 1 addition & 6 deletions src/asset-files/less/dashboard.less
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
.cricket-wrapper {
.cricket-dashboard-view {
&__count-widget {
border-radius: 4px;
box-shadow: 0 2px 0 rgba(90,97,105,.07),
0 4px 8px rgba(90,97,105,.08),
0 10px 10px rgba(90,97,105,.03),
0 7px 70px rgba(90,97,105,.08);
background: #fff;
}

&__count-widget--data {
padding: 5px 0;
padding: 15px 0;
text-align: center;
}

Expand Down
2 changes: 1 addition & 1 deletion src/assets/DashboardsAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class DashboardsAsset extends BaseDashboardsAsset
{
public $css = [
'css/styles.css',
'css/styles.css'
];

public $depends = [
Expand Down
6 changes: 3 additions & 3 deletions src/widgets/BaseChartsJsWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ public function init()

protected function renderHeader()
{
echo $this->beginDiv('card-header border-bottom');
echo $this->beginDiv('cricket-card-header border-bottom');
echo Html::tag('span', $this->model->name, ['class' => 'h4']);
echo $this->endDiv();
}

protected function renderBody()
{
echo $this->beginDiv('card-body pt-0');
echo $this->beginDiv('cricket-card-body');

$this->renderFilter();
$this->renderChart();
Expand Down Expand Up @@ -138,7 +138,7 @@ protected function getRandomColors($count = 1, $format = 'rgb', $isRandom = fals

protected function renderFooter()
{
echo $this->beginDiv('card-footer border-top');
echo $this->beginDiv('cricket-card-footer border-top');

echo $this->beginDiv('text-right ');
echo ' ';
Expand Down
12 changes: 6 additions & 6 deletions src/widgets/BaseDashboardWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ abstract class BaseDashboardWidget extends Yii2BaseWidget
protected $queryFunction = SQLGenerator::QUERY_ALL;

public static $sizes = [
self::LOCATION_TOP => 'col-lg-2 col-md-3 col-sm-6 col-12 my-4',
self::LOCATION_MIDDLE => 'col-lg-4 col-md-6 col-12 my-4',
self::LOCATION_BOTTOM => 'col-md-6 col-sm-12 my-4',
self::LOCATION_TOP => 'col-lg-3 col-md-3 col-sm-6 col-12 form-group',
self::LOCATION_MIDDLE => 'col-lg-4 col-md-6 col-12 form-group',
self::LOCATION_BOTTOM => 'col-md-6 col-sm-12 form-group',
];

public $dbConnection;
Expand All @@ -55,7 +55,7 @@ public function init()
public function renderWidget()
{
echo $this->beginDiv($this->getSize());
echo $this->beginDiv('card card-small');
echo $this->beginDiv('cricket-card cricket-card-small equal-height');

$this->renderHeader();

Expand Down Expand Up @@ -90,7 +90,7 @@ protected function getDataColumns($data = [])

protected function renderHeader()
{
echo $this->beginDiv('card-header border-bottom');
echo $this->beginDiv('cricket-card-header border-bottom');
echo Html::tag('span', $this->model->name, ['class' => 'h4']);
echo $this->endDiv();
}
Expand All @@ -108,7 +108,7 @@ protected function renderFilter()
return;
}

echo $this->beginDiv('row border-bottom px-2 py-3 bg-light');
echo $this->beginDiv('row border-bottom bg-light');
echo '';
echo $this->endDiv();
}
Expand Down
13 changes: 11 additions & 2 deletions src/widgets/CountWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,22 @@ protected function renderHeader()
return;
}

public function init()
{
parent::init();

if (empty($this->data)) {
$this->data = 0;
}
}

protected function renderBody()
{
echo $this->beginDiv('card-body cricket-dashboard-view__count-widget equal-height');
echo $this->beginDiv('cricket-card-body cricket-dashboard-view__count-widget');
echo $this->beginDiv('cricket-dashboard-view__count-widget--data');
echo Html::tag(
'h1',
$this->getData(),
$this->data,
['class' => 'cricket-dashboard-view__count-widget--data-value']
);
echo Html::tag('span', $this->model->name, ['class' => 'cricket-dashboard-view__count-widget--data-label']);
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/DashboardListWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private function renderDashboards()
echo $this->beginDiv('cricket-dashboard-list');
echo $this->beginDiv('row');
foreach ($this->dashboards as $dashboard) {
echo $this->beginDiv('col-lg-3 col-md-3 col-sm-4 col-xs-12');
echo $this->beginDiv('col-lg-3 col-md-3 col-sm-4 col-xs-12 form-group');
echo $this->beginDiv('cricket-dashboard-list__item');
echo Html::a(
ArrayHelper::getValue($dashboard, 'name'),
Expand Down

0 comments on commit 4183023

Please sign in to comment.