Skip to content

Commit 179d157

Browse files
AllenBWcdcabrera
authored andcommitted
fix(pfInfoStatusCard): Tweak infoStatusCard as per UX guidance (#632)
1 parent 4a1ecb9 commit 179d157

File tree

3 files changed

+58
-51
lines changed

3 files changed

+58
-51
lines changed

src/card/card.less

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,25 @@
7777

7878
.card-pf-info-status {
7979
display: flex;
80-
.info-image-container {
80+
margin: 0 10px;
81+
.card-pf-info-image {
8182
display: flex;
8283
align-items: center;
8384
justify-content: center;
8485
flex-direction:column;
85-
margin-right: 10px;
86+
margin-right: 15px;
8687
.info-icon {
8788
font-size: 50px;
8889
}
8990
.info-img {
9091
max-height: 50px;
9192
}
9293
}
94+
.card-pf-info-content {
95+
margin: 10px 0;
96+
.card-pf-title{
97+
margin-top: 10px;
98+
margin-bottom: 15px;
99+
}
100+
}
93101
}
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
<div class="card-pf card-pf-info-status"
22
ng-class="{'card-pf-accented': $ctrl.shouldShowTopBorder}">
3-
<div class="info-image-container">
3+
<div class="card-pf-info-image">
44
<img ng-if="$ctrl.status.iconImage" ng-src="{{$ctrl.status.iconImage}}" alt=""
55
class="info-img"/>
66
<span class="info-icon {{$ctrl.status.iconClass}}"></span>
77
</div>
8-
<div>
8+
<div class="card-pf-info-content">
99
<h2 class="card-pf-title" ng-if="$ctrl.status.title">
1010
<a href="{{$ctrl.status.href}}" ng-if="$ctrl.status.href">
1111
<span class="">{{$ctrl.status.title}}</span>
1212
</a>
1313
<span ng-if="!$ctrl.status.href">
14-
<span class="">{{$ctrl.status.title}}</span>
15-
</span>
14+
<span class="">{{$ctrl.status.title}}</span>
15+
</span>
1616
</h2>
17-
<p ng-if="$ctrl.shouldShowHtmlContent" ng-bind-html="$ctrl.trustAsHtml(item)"
18-
ng-repeat="item in $ctrl.status.info track by $index"></p>
19-
<p ng-if="!$ctrl.shouldShowHtmlContent" ng-bind="item"
20-
ng-repeat="item in $ctrl.status.info track by $index"></p>
17+
<div ng-if="$ctrl.shouldShowHtmlContent" class="card-pf-info-item" ng-bind-html="$ctrl.trustAsHtml(item)"
18+
ng-repeat="item in $ctrl.status.info track by $index"></div>
19+
<div ng-if="!$ctrl.shouldShowHtmlContent" class="card-pf-info-item" ng-bind="item"
20+
ng-repeat="item in $ctrl.status.info track by $index"></div>
2121
</div>
2222
</div>
Lines changed: 40 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
describe('Component: pfInfoStatusCard', function () {
2-
var $scope, $compile, element, cardClass
2+
var $scope, $compile, element, cardClass;
33

4-
beforeEach(module('patternfly.card', 'card/info-status/info-status-card.html'))
4+
beforeEach(module('patternfly.card', 'card/info-status/info-status-card.html'));
55

66
beforeEach(inject(function (_$compile_, _$rootScope_) {
7-
$compile = _$compile_
8-
$scope = _$rootScope_
9-
}))
7+
$compile = _$compile_;
8+
$scope = _$rootScope_;
9+
}));
1010

1111
describe('Page with pf-info-status-card component', function () {
1212

1313
var compileCard = function (markup, scope) {
14-
var el = $compile(markup)(scope)
15-
scope.$digest()
16-
return el
17-
}
14+
var el = $compile(markup)(scope);
15+
scope.$digest();
16+
return el;
17+
};
1818

1919
it('should set the title link, and icons class', function () {
2020

@@ -25,20 +25,20 @@ describe('Component: pfInfoStatusCard', function () {
2525
'info': [
2626
'VM Name: aapdemo002'
2727
]
28-
}
28+
};
2929

30-
element = compileCard('<pf-info-status-card status="status"></pf-info-status-card>', $scope)
30+
element = compileCard('<pf-info-status-card status="status"></pf-info-status-card>', $scope);
3131

3232
//Make sure a link renders in the title
33-
expect(angular.element(element).find('.card-pf-title').find('a').length).toBe(1)
33+
expect(angular.element(element).find('.card-pf-title').find('a').length).toBe(1);
3434

3535
//Make sure the class is getting set for the title icon
36-
expect(angular.element(element).find('.fa').hasClass('fa-shield')).toBeTruthy()
36+
expect(angular.element(element).find('.fa').hasClass('fa-shield')).toBeTruthy();
3737

3838
// By default, showTopBorder if not defined, should be false, resulting in hiding the top
3939
// border, ie. having a .card-pf class
40-
cardClass = angular.element(element).find('.card-pf').hasClass('card-pf-accented')
41-
expect(cardClass).toBeFalsy()
40+
cardClass = angular.element(element).find('.card-pf').hasClass('card-pf-accented');
41+
expect(cardClass).toBeFalsy();
4242
})
4343

4444
it('No link should be present in the title', function () {
@@ -49,13 +49,13 @@ describe('Component: pfInfoStatusCard', function () {
4949
'info': [
5050
'VM Name: aapdemo002'
5151
]
52-
}
52+
};
5353

54-
element = compileCard('<pf-info-status-card status="status"></pf-info-status-card>', $scope)
54+
element = compileCard('<pf-info-status-card status="status"></pf-info-status-card>', $scope);
5555

5656
//Make sure a link renders in the title
57-
expect(angular.element(element).find('.card-pf-title').find('a').length).toBe(0)
58-
})
57+
expect(angular.element(element).find('.card-pf-title').find('a').length).toBe(0);
58+
});
5959

6060
it('should set the info', function () {
6161

@@ -69,32 +69,31 @@ describe('Component: pfInfoStatusCard', function () {
6969
'IP Address: 10.9.62.100',
7070
'Power status: on'
7171
]
72-
}
72+
};
7373

74-
element = compileCard('<pf-info-status-card status="status"></pf-info-status-card>', $scope)
74+
element = compileCard('<pf-info-status-card status="status"></pf-info-status-card>', $scope);
7575

76-
info = angular.element(element).find('p')
76+
info = angular.element(element).find('.card-pf-info-item');
7777

7878
//Make sure four info blocks render
79-
expect(info.length).toBe(4)
80-
})
79+
expect(info.length).toBe(4);
80+
});
8181

8282
it('should show the top border', function () {
83-
element = compileCard('<pf-info-status-card show-top-border="true"></pf-info-status-card>', $scope)
83+
element = compileCard('<pf-info-status-card show-top-border="true"></pf-info-status-card>', $scope);
8484

8585
// showTopBorder set to true, results in having the .card-pf-accented class
86-
cardClass = angular.element(element).find('.card-pf').hasClass('card-pf-accented')
87-
expect(cardClass).toBeTruthy()
88-
89-
})
86+
cardClass = angular.element(element).find('.card-pf').hasClass('card-pf-accented');
87+
expect(cardClass).toBeTruthy();
88+
});
9089

9190
it('should hide the top border', function () {
92-
element = compileCard('<pf-info-status-card show-top-border="false"></pf-info-status-card>', $scope)
91+
element = compileCard('<pf-info-status-card show-top-border="false"></pf-info-status-card>', $scope);
9392

9493
// showTopBorder set to false, results in not having the .card-pf-accented class
95-
cardClass = angular.element(element).find('.card-pf').hasClass('card-pf-accented')
96-
expect(cardClass).toBeFalsy()
97-
})
94+
cardClass = angular.element(element).find('.card-pf').hasClass('card-pf-accented');
95+
expect(cardClass).toBeFalsy();
96+
});
9897

9998
it('should set of the iconImage value', function () {
10099

@@ -106,14 +105,14 @@ describe('Component: pfInfoStatusCard', function () {
106105
'12 Snapshots',
107106
'Drift History: 1'
108107
]
109-
}
108+
};
110109

111-
element = compileCard('<pf-info-status-card status="status"></pf-info-status-card>', $scope)
110+
element = compileCard('<pf-info-status-card status="status"></pf-info-status-card>', $scope);
112111

113112
// should have the images
114-
imageElements = angular.element(element).find('.info-img')
115-
expect(imageElements.length).toBe(1)
116-
expect(angular.element(imageElements[0]).attr('src')).toBe('img/OpenShift-logo.svg')
117-
})
118-
})
119-
})
113+
imageElements = angular.element(element).find('.info-img');
114+
expect(imageElements.length).toBe(1);
115+
expect(angular.element(imageElements[0]).attr('src')).toBe('img/OpenShift-logo.svg');
116+
});
117+
});
118+
});

0 commit comments

Comments
 (0)