Skip to content

Commit

Permalink
prime: add usefull styles
Browse files Browse the repository at this point in the history
Co-Authored-by: Johnny Mariéthoz <[email protected]>
  • Loading branch information
jma and jma committed Nov 21, 2024
1 parent eb9b804 commit 9f2cb5f
Show file tree
Hide file tree
Showing 19 changed files with 303 additions and 198 deletions.
2 changes: 1 addition & 1 deletion projects/ng-core-tester/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<app-menu />
</div>
<div class="flex flex-auto justify-content-end">
<app-search-bar class="w-full" viewcode="sonar"></app-search-bar>
<app-search-bar class="w-full" viewcode="global"/>
</div>
</div>
<router-outlet></router-outlet>
Expand Down
5 changes: 5 additions & 0 deletions projects/ng-core-tester/src/app/routes/documents-route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,17 @@ export class DocumentsRoute implements RouteInterface {
aggregationsOrder: [
'document_type',
'author',
'year',
'acquisition',
'library',
'organisation',
'language',
'subject',
'status'
],
listHeaders: {
Accept: 'application/rero+json, application/json'
},
aggregationsExpand: ['document_type'],
aggregationsBucketSize: 5,
preprocessRecordEditor: (record: any): any => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@
[recordTypes]="recordTypes"
scrollHeight="400px"
(onSelect)="onSelect($event)"
(onSearch)="onSearch($event)"
inputStyleClass="text-lg"
[value]="value"
/>
31 changes: 19 additions & 12 deletions projects/ng-core-tester/src/app/search-bar/search-bar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,27 @@ export class SearchBarComponent implements OnInit {
this.recordTypes = [
{
index: 'documents',
field: 'title',
field: 'autocomplete_title',
groupLabel: this.translateService.instant('Documents'),
processSuggestions: (data: any, query: string) => this.processDocuments(data, query),
preFilters: this.viewcode() ? { view: this.viewcode() } : {}
},
{
index: 'organisations',
field: 'name',
groupLabel: this.translateService.instant('Organisations'),
processSuggestions: (data: any) => this.processOrganisations(data),
index: 'entities',
field: 'autocomplete_name',
groupLabel: this.translateService.instant('Entities'),
processSuggestions: (data: any) => this.processEntities(data),
preFilters: this.viewcode() ? { view: this.viewcode() } : {}
}
];
}
onSearch(query) {
this.router.navigate(['/record', 'search', 'documents'], {
queryParams: {
q: query
}
});
}

onSelect(event: IAutoComplete) {
const label = event.originalLabel ? event.originalLabel : event.label;
Expand All @@ -73,11 +80,11 @@ export class SearchBarComponent implements OnInit {
});
this.router.navigate(['/record', 'search', 'documents', 'detail', event.value]);
break;
case 'organisations':
case 'entities':
this.messageService.add({
severity: 'success',
summary: 'ORGANISATIONS',
detail: 'navigate to organisation: ' + event.value,
summary: 'ENTITIES',
detail: 'navigate to entity: ' + event.value,
life: CONFIG.MESSAGE_LIFE
});
break;
Expand All @@ -100,14 +107,14 @@ export class SearchBarComponent implements OnInit {
return values;
}

private processOrganisations(data: Record): any {
private processEntities(data: Record): any {
const values: IAutoComplete[] = [];
data.hits.hits.map((hit: any) => {
values.push({
iconClass: 'fa fa-industry',
iconClass: 'fa fa-user',
id: hit.metadata.pid,
index: 'organisations',
label: hit.metadata.name,
index: 'entities',
label: hit.metadata.authorized_access_point_en,
value: hit.metadata.pid,
});
});
Expand Down
16 changes: 7 additions & 9 deletions projects/rero/ng-core/assets/scss/_editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

@layer ng-core {
ng-core-editor-formly-field-textarea,
ng-core-formly-field-primeng-input,
ng-core-tree-select,
ng-core-multi-select,
ng-core-primeng-select,
ng-core-date-picker {
@extend .w-full;
}
ng-core-editor-formly-field-textarea,
ng-core-formly-field-primeng-input,
ng-core-tree-select,
ng-core-multi-select,
ng-core-primeng-select,
ng-core-date-picker {
@extend .w-full;
}
73 changes: 33 additions & 40 deletions projects/rero/ng-core/assets/scss/_theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,50 +15,43 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

@layer ng-core {
:root {
font-family: -apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Helvetica, Arial,
sans-serif;
--font-family: -apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Helvetica, Arial,
sans-serif;
a {
@extend .text-blue-500, .no-underline;
}

@extend .text-sm;
a:hover {
@extend .text-blue-600, .underline;
}

a {
@extend .text-blue-500, .no-underline;
}
.p-submenu-list {
z-index: 1000;
}

a:hover {
@extend .text-blue-600, .underline;
}
.p-menuitem {
a {
@extend .text-color;
}
a:hover {
@extend .no-underline;
}
}

.p-submenu-list {
z-index: 1000;
}
dl.metadata {
@extend .grid, .my-0, .w-full;
dt {
@extend .font-bold, .col-12, .py-0;
@include styleclass('md:col-4');
}
dd {
@extend .col-12, .py-0, .m-0;
@include styleclass('md:col-8');
}
}

.p-menuitem {
a {
@extend .text-color;
}
a:hover {
@extend .no-underline;
}
}
.p-menubar {
@extend .mb-0, .border-none, .bg-white;
}

dl.metadata {
@extend .grid, .my-0, .w-full;
dt {
@extend .font-bold, .col-12, .py-0;
@include styleclass('md:col-4');
}
dd {
@extend .col-12, .py-0;
@include styleclass('md:col-8');
margin-inline-start: 0;
}
}
.p-menubar {
@extend .mb-0, .border-none, .bg-white;
}
}
label {
@extend .m-0;
}
Loading

0 comments on commit 9f2cb5f

Please sign in to comment.