Skip to content

Commit 9b37889

Browse files
committed
person details component
1 parent f8736e2 commit 9b37889

File tree

3 files changed

+173
-0
lines changed

3 files changed

+173
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/**
2+
* Person Details Component
3+
*
4+
* @memberOf riccardo
5+
* @description
6+
* Person Details Component.
7+
*/
8+
9+
(function () {
10+
'use strict';
11+
12+
angular.module('riccardo').component('person', {
13+
bindings: {},
14+
controller: PersonDetailsCmptCtrl,
15+
templateUrl: 'app/components/person-details/riccardo-person-details.html'
16+
});
17+
18+
PersonDetailsCmptCtrl.$inject = ['$rootScope', '$state', '$stateParams', 'peopleService'];
19+
20+
/**
21+
* @name PersonDetailsCmptCtrl
22+
* @function PersonDetailsCmptCtrl
23+
* @memberOf riccardo.PersonDetailsCmptCtrl
24+
* @param $rootScope
25+
* @param $state
26+
* @param $stateParams
27+
* @param peopleService
28+
* @description
29+
* Person Details component controller.
30+
*/
31+
function PersonDetailsCmptCtrl($rootScope, $state, $stateParams, peopleService) {
32+
var $ctrl = this;
33+
34+
if (!!$stateParams.person) {
35+
$ctrl.person = $stateParams.person;
36+
} else {
37+
$state.go('riccardo-exercise', {}, {
38+
inherit: false,
39+
location: true,
40+
reload: true,
41+
notify: true
42+
});
43+
}
44+
}
45+
}());
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<section class="personDetailsContainer">
2+
<div class="personDetails clearfix">
3+
<h2 class="personName heading2">{{ $ctrl.person.name }}</h2>
4+
5+
<div class="clearfix">
6+
<div class="personImageContainer">
7+
<img class="personImage" ng-src="{{ $ctrl.person.img }}" alt="{{ $ctrl.person.name }}">
8+
</div>
9+
10+
<div class="personDescriptionContainer">
11+
{{ $ctrl.person.Description }}
12+
13+
<div class="personRatingContainer">
14+
<h3 class="heading4">Rating</h3>
15+
<div star-rating ng-model="$ctrl.person.rating" max="5" readonly="true"></div>
16+
</div>
17+
</div>
18+
</div>
19+
20+
<div class="preferences clearfix">
21+
<div class="pageLeftColumn">
22+
<h3 class="heading4">Likes</h3>
23+
<ul>
24+
<li ng-repeat="like in $ctrl.person.Likes">
25+
{{ like }}
26+
</li>
27+
</ul>
28+
</div>
29+
30+
<div class="pageRightColumn">
31+
<h3 class="heading4">Dislikes</h3>
32+
<ul>
33+
<li ng-repeat="dislike in $ctrl.person.Dislikes">
34+
{{ dislike }}
35+
</li>
36+
</ul>
37+
</div>
38+
</div>
39+
</div>
40+
</section>
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
// Person Details
2+
3+
.personDetailsContainer {
4+
background-color: $whiteF8;
5+
}
6+
7+
.personDetails {
8+
@include box-shadow-defined($android-box-shadow-bottom);
9+
background-color: $white;
10+
border-radius: $border-radius;
11+
padding: rem(16);
12+
13+
> .heading2 {
14+
margin-bottom: rem(20);
15+
}
16+
}
17+
18+
.personName {
19+
&.heading2 {
20+
font-size: rem(30);
21+
}
22+
}
23+
24+
.personImageContainer,
25+
.personDescriptionContainer {
26+
@extend %grid__item;
27+
}
28+
29+
.personImageContainer {
30+
@extend %one-whole;
31+
@extend %xsmall-outwards--one-half;
32+
@extend %medium--one-quarter;
33+
@extend %large-outwards--one-sixth;
34+
padding: rem(10) 0;
35+
text-align: center;
36+
}
37+
38+
.personImage {
39+
background-color: $greyEE;
40+
border-radius: 50%;
41+
min-height: rem(64);
42+
width: 100%;
43+
}
44+
45+
.personDescriptionContainer {
46+
@extend %one-whole;
47+
@extend %xsmall-outwards--one-half;
48+
@extend %medium--three-quarters;
49+
@extend %large-outwards--five-sixths;
50+
padding: rem(10) 0;
51+
}
52+
53+
.preferences {
54+
> .pageLeftColumn,
55+
> .pageRightColumn {
56+
@extend %xsmall-outwards--one-half;
57+
margin: rem(16) 0;
58+
}
59+
}
60+
61+
@include grid-media-query("xsmall-outwards") {
62+
.personImageContainer {
63+
padding: rem(10) rem(20) rem(10) 0;
64+
}
65+
66+
.preferences {
67+
> .pageLeftColumn,
68+
> .pageRightColumn {
69+
margin: 0;
70+
}
71+
72+
> .pageLeftColumn {
73+
padding-right: rem(20);
74+
}
75+
}
76+
}
77+
78+
@include grid-media-query("medium-outwards") {
79+
.personName {
80+
&.heading2 {
81+
font-size: rem(22);
82+
}
83+
}
84+
85+
.personDetails {
86+
padding: rem(32);
87+
}
88+
}

0 commit comments

Comments
 (0)