@asd20/ui 3.2.849 → 3.2.851
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/organisms/Asd20PrimaryHeader/index.vue +27 -5
- package/src/components/templates/Asd20DistrictHomeTemplate/index.stories.js +27 -2
- package/src/components/templates/Asd20DistrictHomeTemplate/index.vue +8 -9
- package/src/mixins/userProfileMixin.js +27 -14
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<div class="photostrip"></div>
|
|
4
4
|
|
|
5
5
|
<section class="asd20-primary-header" aria-label="Primary message">
|
|
6
|
+
<p v-if="userGivenName && userGivenName !== ''" class="greeting">Hi, {{ userGivenName }}.</p>
|
|
6
7
|
<asd20-messaging id="main" v-bind="firstMessage"></asd20-messaging>
|
|
7
8
|
<div class="image-container">
|
|
8
9
|
<img
|
|
@@ -38,6 +39,8 @@ export default {
|
|
|
38
39
|
fullscreen: { type: Boolean, default: false },
|
|
39
40
|
detailLink: { type: String, default: '' },
|
|
40
41
|
detailLinkLabel: { type: String, default: '' },
|
|
42
|
+
userGivenName: { type: String, default: '' },
|
|
43
|
+
userGroupsList: { type: String, default: '' },
|
|
41
44
|
},
|
|
42
45
|
computed: {
|
|
43
46
|
mq() {
|
|
@@ -93,8 +96,8 @@ export default {
|
|
|
93
96
|
display: flex;
|
|
94
97
|
flex-shrink: 0;
|
|
95
98
|
flex-direction: column;
|
|
96
|
-
justify-content:
|
|
97
|
-
align-items:
|
|
99
|
+
justify-content: flex-start;
|
|
100
|
+
align-items: flex-start;
|
|
98
101
|
background: var(--website-homepage-header__background-color)
|
|
99
102
|
var(--website-homepage-header__background-style);
|
|
100
103
|
background-size: cover;
|
|
@@ -102,10 +105,16 @@ export default {
|
|
|
102
105
|
color: var(--color__primary);
|
|
103
106
|
padding: space(3) space(1) space(3) space(1);
|
|
104
107
|
// margin-top: space(1);
|
|
105
|
-
|
|
108
|
+
.greeting {
|
|
109
|
+
font-family: var(--website-typography__font-family-headlines);
|
|
110
|
+
@include fluid-type($base-font-size * 1.2, $base-font-size * 1.4);
|
|
111
|
+
color: var(--website-homepage-header__foreground-color);
|
|
112
|
+
animation: small_slide_left 1.25s ease-in-out 0.5s both;
|
|
113
|
+
margin: 0;
|
|
114
|
+
}
|
|
106
115
|
.asd20-messaging {
|
|
107
116
|
margin-right: 0;
|
|
108
|
-
padding-top: space(
|
|
117
|
+
padding-top: space(1);
|
|
109
118
|
color: white !important;
|
|
110
119
|
}
|
|
111
120
|
&::v-deep .asd20-messaging__heading {
|
|
@@ -192,12 +201,25 @@ export default {
|
|
|
192
201
|
}
|
|
193
202
|
}
|
|
194
203
|
|
|
204
|
+
@keyframes small_slide_left {
|
|
205
|
+
from {
|
|
206
|
+
opacity: 0;
|
|
207
|
+
margin-left: 100px;
|
|
208
|
+
margin-right: -100px;
|
|
209
|
+
}
|
|
210
|
+
to {
|
|
211
|
+
opacity: 1;
|
|
212
|
+
margin-left: 0;
|
|
213
|
+
margin-right: 0;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
195
217
|
@media (min-width: 1024px) {
|
|
196
218
|
.photostrip {
|
|
197
219
|
height: 40vh;
|
|
198
220
|
}
|
|
199
221
|
.asd20-primary-header {
|
|
200
|
-
flex-direction: row;
|
|
222
|
+
// flex-direction: row;
|
|
201
223
|
justify-content: space-between;
|
|
202
224
|
// background-size: auto 50%;
|
|
203
225
|
padding: space(3) space(2) space(3) space(2);
|
|
@@ -2,6 +2,8 @@ import { storiesOf } from '@storybook/vue'
|
|
|
2
2
|
import { withKnobs, boolean } from '@storybook/addon-knobs'
|
|
3
3
|
|
|
4
4
|
import mockPageMixin from '../../../mixins/mockPageMixin'
|
|
5
|
+
import userProfileMixin from '../../../mixins/userProfileMixin'
|
|
6
|
+
|
|
5
7
|
|
|
6
8
|
import Asd20DistrictHomeTemplate from '.'
|
|
7
9
|
import pageQueryResult from '../../../data/page-queries/home-page-query-result.json'
|
|
@@ -12,12 +14,33 @@ const info = {
|
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
const wrapper = {
|
|
15
|
-
mixins: [mockPageMixin],
|
|
17
|
+
mixins: [mockPageMixin, userProfileMixin],
|
|
16
18
|
components: {
|
|
17
19
|
Asd20DistrictHomeTemplate,
|
|
18
20
|
},
|
|
21
|
+
props: {
|
|
22
|
+
// Mock props for userProfile and userGroups
|
|
23
|
+
userProfile: {
|
|
24
|
+
type: Object,
|
|
25
|
+
default: () => ({
|
|
26
|
+
displayName: 'John Doe',
|
|
27
|
+
givenName: 'John',
|
|
28
|
+
jobTitle: 'Software Developer',
|
|
29
|
+
officeLocation: 'HQ',
|
|
30
|
+
}),
|
|
31
|
+
},
|
|
32
|
+
userGroups: {
|
|
33
|
+
type: Array,
|
|
34
|
+
default: () => [
|
|
35
|
+
{ displayName: 'Admin Group' },
|
|
36
|
+
{ displayName: 'Developers Group' },
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
},
|
|
19
40
|
|
|
20
|
-
data: () => ({
|
|
41
|
+
data: () => ({
|
|
42
|
+
pageQueryResult
|
|
43
|
+
}),
|
|
21
44
|
|
|
22
45
|
computed: {
|
|
23
46
|
activeNotificationsByType() {
|
|
@@ -46,6 +69,8 @@ stories.add(
|
|
|
46
69
|
v-bind="templateProps"
|
|
47
70
|
:menu-open.sync="menuOpen"
|
|
48
71
|
:search-open.sync="searchOpen"
|
|
72
|
+
:userProfile="userProfile"
|
|
73
|
+
:userGroups="userGroups"
|
|
49
74
|
|
|
50
75
|
@announcements-in-view="loadAnnouncements"
|
|
51
76
|
@stories-in-view="loadStories"
|
|
@@ -87,7 +87,12 @@
|
|
|
87
87
|
</template>
|
|
88
88
|
</section>
|
|
89
89
|
|
|
90
|
-
<asd20-primary-header
|
|
90
|
+
<asd20-primary-header
|
|
91
|
+
v-if="messages.length > 0"
|
|
92
|
+
:messages="messages"
|
|
93
|
+
:userGivenName="userGivenName"
|
|
94
|
+
:userGroupsList="userGroupsList"
|
|
95
|
+
/>
|
|
91
96
|
<asd20-secondary-header v-if="messages.length > 1" :messages="messages" />
|
|
92
97
|
<asd20-tertiary-header v-if="messages.length > 2" :messages="messages" />
|
|
93
98
|
|
|
@@ -151,18 +156,12 @@ import Asd20PrimaryHeader from '../../../components/organisms/Asd20PrimaryHeader
|
|
|
151
156
|
import Asd20SecondaryHeader from '../../../components/organisms/Asd20SecondaryHeader'
|
|
152
157
|
import Asd20TertiaryHeader from '../../../components/organisms/Asd20TertiaryHeader'
|
|
153
158
|
import Asd20LanguageTranslation from '../../molecules/Asd20LanguageTranslation'
|
|
154
|
-
|
|
159
|
+
import userProfileMixin from '../../../mixins/userProfileMixin'
|
|
155
160
|
|
|
156
161
|
export default {
|
|
157
162
|
name: 'Asd20DistrictHomeTemplate',
|
|
158
163
|
|
|
159
|
-
mixins: [
|
|
160
|
-
pageTemplateMixin,
|
|
161
|
-
// globalPropMixinFactory('isAuthenticated', {
|
|
162
|
-
// type: Boolean,
|
|
163
|
-
// default: true,
|
|
164
|
-
// }),
|
|
165
|
-
],
|
|
164
|
+
mixins: [pageTemplateMixin, userProfileMixin],
|
|
166
165
|
|
|
167
166
|
directives: { scrollTrack },
|
|
168
167
|
|
|
@@ -1,29 +1,42 @@
|
|
|
1
|
-
import
|
|
1
|
+
import globalPropMixinFactory from './globalPropMixinFactory'
|
|
2
2
|
|
|
3
|
-
// Create a mixin to access user profile
|
|
4
|
-
const userProfileMixin =
|
|
3
|
+
// Create a mixin to access user profile with default values
|
|
4
|
+
const userProfileMixin = globalPropMixinFactory('userProfile', {
|
|
5
5
|
type: Object,
|
|
6
|
-
default: () => ({
|
|
6
|
+
default: () => ({
|
|
7
|
+
displayName: '',
|
|
8
|
+
givenName: '',
|
|
9
|
+
jobTitle: '',
|
|
10
|
+
officeLocation: '',
|
|
11
|
+
}),
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
// Create a mixin to access user groups with default values
|
|
15
|
+
const userGroupsMixin = globalPropMixinFactory('userGroups', {
|
|
16
|
+
type: Array,
|
|
17
|
+
default: () => [],
|
|
7
18
|
})
|
|
8
19
|
|
|
9
|
-
// In your component
|
|
10
20
|
export default {
|
|
11
|
-
mixins: [userProfileMixin],
|
|
21
|
+
mixins: [userProfileMixin, userGroupsMixin],
|
|
12
22
|
computed: {
|
|
13
23
|
userDisplayName() {
|
|
14
|
-
return this._userProfile.displayName || ''
|
|
24
|
+
return (this._userProfile && this._userProfile.displayName) || ''
|
|
15
25
|
},
|
|
16
26
|
userGivenName() {
|
|
17
|
-
return this._userProfile.givenName || ''
|
|
27
|
+
return (this._userProfile && this._userProfile.givenName) || ''
|
|
18
28
|
},
|
|
19
29
|
userJobTitle() {
|
|
20
|
-
return this._userProfile.jobTitle || ''
|
|
30
|
+
return (this._userProfile && this._userProfile.jobTitle) || ''
|
|
21
31
|
},
|
|
22
32
|
userOfficeLocation() {
|
|
23
|
-
return this._userProfile.officeLocation || ''
|
|
33
|
+
return (this._userProfile && this._userProfile.officeLocation) || ''
|
|
34
|
+
},
|
|
35
|
+
userGroupsList() {
|
|
36
|
+
return (this._userGroups && this._userGroups.length > 0)
|
|
37
|
+
? this._userGroups.map(group => group.displayName).join(', ')
|
|
38
|
+
: 'No groups assigned'
|
|
24
39
|
},
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// console.log('User Profile:', this._userProfile)
|
|
28
|
-
// },
|
|
40
|
+
}
|
|
41
|
+
|
|
29
42
|
}
|