-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1803 from CSCfi/search-pages-2
Beta of new publication search
- Loading branch information
Showing
46 changed files
with
5,375 additions
and
261 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import { defineConfig, devices } from '@playwright/test'; | ||
|
||
/** | ||
* Read environment variables from file. | ||
* https://github.com/motdotla/dotenv | ||
*/ | ||
// require('dotenv').config(); | ||
|
||
/** | ||
* See https://playwright.dev/docs/test-configuration. | ||
*/ | ||
export default defineConfig({ | ||
testDir: './tests', | ||
/* Run tests in files in parallel */ | ||
fullyParallel: true, | ||
/* Fail the build on CI if you accidentally left test.only in the source code. */ | ||
forbidOnly: !!process.env.CI, | ||
/* Retry on CI only */ | ||
retries: process.env.CI ? 2 : 0, | ||
/* Opt out of parallel tests on CI. */ | ||
workers: process.env.CI ? 1 : undefined, | ||
/* Reporter to use. See https://playwright.dev/docs/test-reporters */ | ||
reporter: 'html', | ||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ | ||
use: { | ||
/* Base URL to use in actions like `await page.goto('/')`. */ | ||
// baseURL: 'http://127.0.0.1:3000', | ||
|
||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ | ||
trace: 'on-first-retry', | ||
}, | ||
|
||
/* Configure projects for major browsers */ | ||
projects: [ | ||
{ | ||
name: 'chromium', | ||
use: { ...devices['Desktop Chrome'] }, | ||
}, | ||
|
||
{ | ||
name: 'firefox', | ||
use: { ...devices['Desktop Firefox'] }, | ||
}, | ||
|
||
{ | ||
name: 'webkit', | ||
use: { ...devices['Desktop Safari'] }, | ||
}, | ||
|
||
/* Test against mobile viewports. */ | ||
// { | ||
// name: 'Mobile Chrome', | ||
// use: { ...devices['Pixel 5'] }, | ||
// }, | ||
// { | ||
// name: 'Mobile Safari', | ||
// use: { ...devices['iPhone 12'] }, | ||
// }, | ||
|
||
/* Test against branded browsers. */ | ||
// { | ||
// name: 'Microsoft Edge', | ||
// use: { ...devices['Desktop Edge'], channel: 'msedge' }, | ||
// }, | ||
// { | ||
// name: 'Google Chrome', | ||
// use: { ...devices['Desktop Chrome'], channel: 'chrome' }, | ||
// }, | ||
], | ||
|
||
/* Run your local dev server before starting the tests */ | ||
// webServer: { | ||
// command: 'npm run start', | ||
// url: 'http://127.0.0.1:3000', | ||
// reuseExistingServer: !process.env.CI, | ||
// }, | ||
}); |
37 changes: 37 additions & 0 deletions
37
src/app/portal/components/collapsible/collapsible.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<ng-template #tooltipElement> | ||
<div> | ||
<ng-content select="[tooltip]"></ng-content> | ||
</div> | ||
</ng-template> | ||
|
||
<div class="collapsible-container"> | ||
<div class='collapsible-label' (click)="toggle()"> | ||
<div style='display: flex; flex-wrap: wrap'> | ||
<ng-container *ngIf='decoration === "plus" && isOpen'> | ||
<div style='margin-right: 10px'>-</div> | ||
</ng-container> | ||
|
||
<ng-container *ngIf='decoration === "plus" && !isOpen'> | ||
<div style='margin-right: 10px'>+</div> | ||
</ng-container> | ||
|
||
<div> | ||
{{label}} | ||
|
||
<ng-container *ngIf='hasTooltip'> | ||
<div style='display: inline-block; margin-left: 10px; color: rgb(69, 70, 185)'> | ||
<i class="fa fa-info-circle" [tooltip]='tooltipElement'></i> | ||
</div> | ||
</ng-container> | ||
</div> | ||
</div> | ||
|
||
<span> | ||
<i style='margin: 0 4px' class="fa fa-chevron-down" [ngClass]='{"icon-collapsed": !isOpen, "icon-expanded": isOpen}'></i> | ||
</span> | ||
</div> | ||
|
||
<div [@expandCollapse]="isOpen ? 'expanded' : 'collapsed'"> | ||
<ng-content></ng-content> | ||
</div> | ||
</div> |
39 changes: 39 additions & 0 deletions
39
src/app/portal/components/collapsible/collapsible.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
.collapsible-container { | ||
background-color: rgb(247, 247, 251); | ||
} | ||
|
||
.collapsible-label { | ||
font-size: 1.1rem; | ||
font-weight: bolder; | ||
|
||
padding: 11px 16px; | ||
border-radius: 4px; | ||
|
||
user-select: none; | ||
cursor: pointer; | ||
|
||
display: flex; | ||
justify-content: space-between; | ||
} | ||
|
||
.icon-collapsed { | ||
transition: transform 0.25s linear; | ||
transform: rotate(0deg); | ||
} | ||
|
||
.icon-expanded { | ||
transition: transform 0.25s ease-out; | ||
transform: rotate(180deg); | ||
} | ||
|
||
.collapsible-content { | ||
transition: max-height 0.4s ease-out; | ||
overflow: hidden; | ||
|
||
max-height: 1000px; | ||
} | ||
|
||
.collapsed { | ||
// transition: 0.2s linear; | ||
max-height: 0; | ||
} |
39 changes: 39 additions & 0 deletions
39
src/app/portal/components/collapsible/collapsible.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { Component, EventEmitter, Input, Output } from '@angular/core'; | ||
import { NgClass, NgIf } from '@angular/common'; | ||
import { MatIconModule } from '@angular/material/icon'; | ||
import { animate, state, style, transition, trigger } from '@angular/animations'; | ||
import { TooltipModule } from 'ngx-bootstrap/tooltip'; | ||
|
||
@Component({ | ||
selector: 'app-collapsible', | ||
templateUrl: './collapsible.component.html', | ||
styleUrls: ['./collapsible.component.scss'], | ||
imports: [ | ||
NgIf, | ||
MatIconModule, | ||
NgClass, | ||
TooltipModule | ||
], | ||
standalone: true, | ||
animations: [ | ||
trigger('expandCollapse', [ | ||
state('collapsed', style({ height: '0px', overflow: 'hidden' })), | ||
state('expanded', style({ height: '*', overflow: 'hidden' })), | ||
transition('expanded <=> collapsed', animate('0.1s ease-out')) | ||
]) | ||
] | ||
}) | ||
export class CollapsibleComponent { | ||
@Input() label = ''; | ||
@Input() decoration = "none"; | ||
|
||
@Input() isOpen = false; | ||
@Output() isOpenChange = new EventEmitter<boolean>(); | ||
|
||
@Input() hasTooltip = false; | ||
|
||
toggle() { | ||
this.isOpen = !this.isOpen; | ||
this.isOpenChange.emit(this.isOpen); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/app/portal/components/filter-limit-button/filter-limit-button.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<ng-template #buttonContent> | ||
<ng-content></ng-content> | ||
</ng-template> | ||
|
||
<ng-container *ngIf="step > 0"> | ||
<button class='limit-button' mat-button [disabled]='value >= max' (click)='valueChange.emit(clamp(value + step))'> | ||
<ng-container *ngTemplateOutlet="buttonContent"></ng-container> | ||
</button> | ||
</ng-container> | ||
|
||
<ng-container *ngIf="step < 0"> | ||
<button class='limit-button' mat-button [disabled]='value <= min' (click)='valueChange.emit(clamp(value + step))'> | ||
<ng-container *ngTemplateOutlet="buttonContent"></ng-container> | ||
</button> | ||
</ng-container> | ||
|
7 changes: 7 additions & 0 deletions
7
src/app/portal/components/filter-limit-button/filter-limit-button.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.limit-button { | ||
height: 3rem; | ||
} | ||
|
||
.limit-button:enabled { | ||
color: #4546b9; | ||
} |
23 changes: 23 additions & 0 deletions
23
src/app/portal/components/filter-limit-button/filter-limit-button.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { FilterLimitButtonComponent } from './filter-limit-button.component'; | ||
|
||
describe('FilterLimitButtonComponent', () => { | ||
let component: FilterLimitButtonComponent; | ||
let fixture: ComponentFixture<FilterLimitButtonComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [ FilterLimitButtonComponent ] | ||
}) | ||
.compileComponents(); | ||
|
||
fixture = TestBed.createComponent(FilterLimitButtonComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
23 changes: 23 additions & 0 deletions
23
src/app/portal/components/filter-limit-button/filter-limit-button.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { MatButtonModule } from '@angular/material/button'; | ||
|
||
@Component({ | ||
selector: 'app-filter-limit-button', | ||
standalone: true, | ||
imports: [CommonModule, MatButtonModule], | ||
templateUrl: './filter-limit-button.component.html', | ||
styleUrls: ['./filter-limit-button.component.scss'] | ||
}) | ||
export class FilterLimitButtonComponent { | ||
@Input() value = 0; | ||
@Output() valueChange = new EventEmitter<number>(); | ||
|
||
@Input() step = 0; | ||
@Input() min = 0; | ||
@Input() max = 0; | ||
|
||
clamp(value: number) { | ||
return Math.min(Math.max(value, this.min), this.max); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/app/portal/components/filter-option/filter-option.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<div class='filter-option-layout focus-me' (click)='toggleValue()' matRipple tabindex='0'> | ||
<div style='display: flex; justify-content: center; align-items: center'> | ||
|
||
<!-- Position mat-checkbox to appear vertically and horizontally centered using pixels --> | ||
<div style='width: 24px; height: 20px; margin: 5px 20px 5px 2px; position: relative'> | ||
<mat-checkbox style='position: absolute; top: -5px; left: 2px; width: 10px; height: 10px' [ngModel]='value'></mat-checkbox> | ||
</div> | ||
|
||
</div> | ||
|
||
<div style='display: flex; flex-grow: 1; justify-content: space-between'> | ||
<div style='display: flex; justify-content: center; font-size: 1.1rem;'> | ||
{{label}} | ||
</div> | ||
|
||
<div style='display: flex; justify-content: center; align-items: center; font-size: 14px; color: grey'> | ||
{{count}} | ||
</div> | ||
</div> | ||
</div> |
20 changes: 20 additions & 0 deletions
20
src/app/portal/components/filter-option/filter-option.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.label-text { | ||
text-overflow: ellipsis; | ||
flex-shrink: 1; | ||
} | ||
|
||
.filter-option-layout { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
|
||
// padding: 16px 12px; | ||
padding: 8px; | ||
|
||
cursor: pointer; | ||
user-select: none; | ||
|
||
&:hover { | ||
background-color: rgba(0, 0, 0, 0.04); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/app/portal/components/filter-option/filter-option.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Component, EventEmitter, Input, Output } from '@angular/core'; | ||
import { FormsModule } from '@angular/forms'; | ||
import { MatRippleModule } from '@angular/material/core'; | ||
import { MatCheckboxModule } from '@angular/material/checkbox'; | ||
|
||
@Component({ | ||
selector: 'app-filter-option', | ||
templateUrl: './filter-option.component.html', | ||
styleUrls: ['./filter-option.component.scss'], | ||
imports: [ | ||
FormsModule, | ||
MatRippleModule, | ||
MatCheckboxModule | ||
], | ||
standalone: true | ||
}) | ||
export class FilterOptionComponent { | ||
@Input() label = ""; | ||
@Input() count = 0; | ||
|
||
@Input() value: boolean = false; | ||
@Output() valueChange = new EventEmitter<boolean>(); | ||
|
||
toggleValue() { | ||
this.value = !this.value; | ||
this.valueChange.emit(this.value); | ||
} | ||
} |
Oops, something went wrong.