Skip to content

Commit be5e6de

Browse files
[UXP-205] port glam styles
1 parent 68c1c2a commit be5e6de

4 files changed

Lines changed: 125 additions & 46 deletions

File tree

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,31 @@
1-
<div class="grid-container">
2-
<div style="grid-area: title" class="bg-light p-5 border border-dark position-relative">
3-
<p class="mb-3 text-muted main-content-badge">{{maincontentBadge}}</p>
4-
<h1 class="text-muted main-content-title">
5-
{{maincontentTitle}}
6-
</h1>
7-
<h1 class="text-dark main-content-subtitle">
8-
{{maincontentSubtitle}}
9-
</h1>
10-
<p class="mt-3 pl-0 text-muted col-8">
11-
{{maincontentAbstract}}
12-
</p>
13-
<button type="button" (click)="goToMainContentLink()" class="btn btn-dark position-absolute m-5">{{'explore.grid-section.seeAll' | translate}}</button>
1+
<div class="grid-container py-5">
2+
<div class="cris-section-element-background path-title">
3+
<div class="inner-container d-flex flex-column justify-content-center gap-3 h-100">
4+
<div class="main-content-badge mb-3">{{maincontentBadge | translate}}</div>
5+
<h2>
6+
<div class="main-content-title-1">
7+
{{ maincontentTitle | translate }}
8+
</div>
9+
<div class="main-content-title-2">
10+
{{ maincontentSubtitle | translate }}
11+
</div>
12+
</h2>
13+
<p class="main-content-text text-muted">
14+
{{ maincontentAbstract | translate }}
15+
</p>
16+
<div class="align-self-end">
17+
<button type="button" class="btn btn-dark" (click)="goToMainContentLink()">
18+
{{'explore.grid-section.seeAll' | translate}}
19+
</button>
20+
</div>
21+
</div>
1422
</div>
15-
<div class="bg-light text-center position-relative border border-dark d-flex flex-column
16-
justify-content-between align-items-center"
23+
<div class="cris-section-element-background text-center position-relative d-flex flex-column
24+
justify-content-between align-items-center path-item"
1725
[dsBackgroundImage]="(itemToImageHrefMap$ | async).get(item.indexableObject?.uuid)"
1826
*ngFor="let item of searchResults | slice:0:8; index as i">
19-
<h5 class="text-dark text-truncate position-absolute py-3 px-1">{{item.indexableObject?.firstMetadataValue('dc.title')}}</h5>
27+
<a [routerLink]="[getItemPageRoute(item.indexableObject)]" class="mw-100 p-3">
28+
<p class="text-center m-0 text-truncate">{{item.indexableObject?.firstMetadataValue('dc.title')}}</p>
29+
</a>
2030
</div>
2131
</div>
Lines changed: 88 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,102 @@
1+
.main-content {
2+
&-title, &-subtitle {
3+
font-weight: var(--ds-home-page-title-size);
4+
}
5+
6+
&-text {
7+
overflow: hidden; // TODO find better solution
8+
font-size: 1.15rem;
9+
}
10+
11+
&-badge {
12+
font-size: 1.2rem;
13+
}
14+
15+
&-title-1 {
16+
color: var(--bs-headings-color)
17+
}
18+
19+
&-title-2 {
20+
color: var(--bs-body-color)
21+
}
22+
23+
&-badge, &-title-1, &-title-2 {
24+
font-weight: 900;
25+
}
26+
27+
}
28+
129
.grid-container {
230
width: 100%;
331
display: grid;
4-
grid-gap: 1em;
5-
6-
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
7-
grid-template-rows: repeat(6, 1fr);
8-
grid-template-areas:
9-
"title title"
10-
"title title"
11-
"item-0 item-1"
12-
"item-2 item-3"
13-
"item-4 item-5"
14-
"item-6 item-7";
15-
16-
@include media-breakpoint-up(lg) {
17-
grid-template-columns: repeat(4, minmax(0, 1fr));
18-
grid-template-rows: repeat(3, 1fr);
19-
grid-template-areas:
20-
"title title item-0 item-1"
21-
"title title item-2 item-3"
22-
"item-4 item-5 item-6 item-7";
32+
grid-gap: 24px;
33+
34+
.path-title {
35+
border: 1px solid var(--bs-link-hover-color) !important;
36+
padding: 4rem;
37+
}
38+
39+
@include media-breakpoint-up(xl) {
40+
grid-template-columns: repeat(4, minmax(240px, 1fr));
41+
.path-title, .path-item {
42+
aspect-ratio: 1;
43+
}
44+
.path-title {
45+
grid-row-end: span 2;
46+
grid-column-end: span 2;
47+
}
48+
}
49+
50+
@include media-breakpoint-between(md, lg) {
51+
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
52+
.path-title, .path-item {
53+
aspect-ratio: 1;
54+
}
55+
.path-title {
56+
grid-row-end: span 2;
57+
grid-column-end: span 2;
58+
}
59+
}
60+
61+
@include media-breakpoint-down(sm) {
62+
grid-template-columns: 1fr;
63+
.path-title {
64+
aspect-ratio: unset;
65+
}
66+
.path-item {
67+
aspect-ratio: 1;
68+
}
69+
}
70+
71+
@media (min-width: 4000px) {
72+
// when the screen is zoomed out to 25%
73+
grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
74+
75+
.path-title {
76+
aspect-ratio: 0;
77+
}
78+
79+
.path-title {
80+
grid-row-end: span 1;
81+
grid-column-end: span 1;
82+
}
2383
}
2484
}
2585

26-
h5 {
86+
a {
87+
position: absolute;
2788
bottom: 0.5em;
28-
background-color: white;
2989
width: 90%;
90+
background-color: rgba(255, 255, 255, .7);
91+
padding: .6em;
92+
border-radius: $border-radius;
93+
z-index: 2;
3094
}
3195

32-
.main-content-badge, .main-content-title, .main-content-subtitle {
96+
.main-content-badge, .main-content-title-1, .main-content-title-2 {
3397
font-weight: 900;
3498
}
3599

36-
button {
37-
bottom: 0;
38-
right: 0;
100+
.main-content-title-1, .main-content-title-2 {
101+
font-size: var(--ds-cris-path-section-title-font-size);
39102
}

src/app/shared/explore/section-component/grid-section/grid-section.component.spec.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ describe('GridSectionComponent', () => {
4343
});
4444

4545
const firstSearchResult = Object.assign(new SearchResult(), {
46-
_embedded: {
4746
indexableObject: Object.assign(new DSpaceObject(), {
4847
id: 'd317835d-7b06-4219-91e2-1191900cb897',
4948
uuid: 'd317835d-7b06-4219-91e2-1191900cb897',
@@ -57,11 +56,9 @@ describe('GridSectionComponent', () => {
5756
return '';
5857
},
5958
})
60-
}
6159
});
6260

6361
const secondSearchResult = Object.assign(new SearchResult(), {
64-
_embedded: {
6562
indexableObject: Object.assign(new DSpaceObject(), {
6663
id: '0c34d491-b5ed-4a78-8b29-83d0bad80e5a',
6764
uuid: '0c34d491-b5ed-4a78-8b29-83d0bad80e5a',
@@ -70,7 +67,6 @@ describe('GridSectionComponent', () => {
7067
return '';
7168
},
7269
})
73-
}
7470
});
7571

7672
beforeEach(waitForAsync(() => {

src/app/shared/explore/section-component/grid-section/grid-section.component.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { Item } from 'src/app/core/shared/item.model';
2222
import { Bitstream } from 'src/app/core/shared/bitstream.model';
2323
import { BitstreamFormat } from 'src/app/core/shared/bitstream-format.model';
2424
import { hasValue } from 'src/app/shared/empty.util';
25+
import { getItemPageRoute } from 'src/app/item-page/item-page-routing-paths';
2526

2627
/**
2728
* Component representing the Grid component section.
@@ -80,7 +81,7 @@ export class GridSectionComponent implements OnInit {
8081
this.paginatedSearchOptions = new PaginatedSearchOptions({
8182
configuration: this.gridSection.discoveryConfigurationName,
8283
pagination: pagination,
83-
sort: new SortOptions('dc.title', SortDirection.ASC)
84+
//sort: new SortOptions('dc.title', SortDirection.ASC)
8485
});
8586

8687
this.getMainBoxResults();
@@ -159,6 +160,15 @@ export class GridSectionComponent implements OnInit {
159160
}
160161

161162

163+
/**
164+
* to get the route of the item
165+
* @param item
166+
* @returns route to the item as a string
167+
*/
168+
getItemPageRoute(item: DSpaceObject) {
169+
return getItemPageRoute(item as Item);
170+
}
171+
162172
goToMainContentLink() {
163173
this.router.navigateByUrl(this.maincontentLink);
164174
}

0 commit comments

Comments
 (0)