Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
style(button): disabled and standalone componenent
Browse files Browse the repository at this point in the history
mmohadIGN committed Jan 28, 2025
1 parent 49474aa commit c3d50fa
Showing 5 changed files with 33 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ import {
import { DatasetServiceDistribution } from '@geonetwork-ui/common/domain/model/record'
import {
FeatureRecordModule,
GpfApiDlComponent,
MdViewFacade,
} from '@geonetwork-ui/feature/record'
import { CarouselComponent } from '@geonetwork-ui/ui/layout'
@@ -36,6 +37,7 @@ import { TranslateModule } from '@ngx-translate/core'
NgIcon,
TranslateModule,
FeatureRecordModule,
GpfApiDlComponent,
],
viewProviders: [
provideIcons({
4 changes: 1 addition & 3 deletions libs/feature/record/src/lib/feature-record.module.ts
Original file line number Diff line number Diff line change
@@ -13,7 +13,6 @@ import {
reducer,
} from './state/mdview.reducer'
import { GpfApiDlComponent } from './gpf-api-dl/gpf-api-dl.component'
import { GpfApiDlListItemComponent } from './gpf-api-dl-list-item/gpf-api-dl-list-item.component'
import { MatTabsModule } from '@angular/material/tabs'
import { UiWidgetsModule } from '@geonetwork-ui/ui/widgets'
import { TranslateModule } from '@ngx-translate/core'
@@ -23,7 +22,6 @@ import { NgIconsModule, provideNgIconsConfig } from '@ng-icons/core'
import { DropdownSelectorComponent } from '@geonetwork-ui/ui/inputs'

@NgModule({
declarations: [GpfApiDlComponent, GpfApiDlListItemComponent],
imports: [
CommonModule,
StoreModule.forFeature(METADATA_VIEW_FEATURE_STATE_KEY, reducer),
@@ -39,13 +37,13 @@ import { DropdownSelectorComponent } from '@geonetwork-ui/ui/inputs'
TableComponent,
NgIconsModule,
DropdownSelectorComponent,
GpfApiDlComponent,
],
providers: [
MdViewFacade,
provideNgIconsConfig({
size: '1.5em',
}),
],
exports: [GpfApiDlComponent],
})
export class FeatureRecordModule {}
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import { CommonModule } from '@angular/common'
import { HttpClient } from '@angular/common/http'
import { Component, Input, OnInit } from '@angular/core'
import { NgIconsModule } from '@ng-icons/core'
import { TranslateModule } from '@ngx-translate/core'
import { Observable, map, mergeMap } from 'rxjs'

@Component({
selector: 'gn-ui-gpf-api-dl-list-item',
templateUrl: './gpf-api-dl-list-item.component.html',
styleUrls: ['./gpf-api-dl-list-item.component.css'],
standalone: true,
imports: [CommonModule, TranslateModule, NgIconsModule],
})
export class GpfApiDlListItemComponent implements OnInit {
@Input() link
21 changes: 14 additions & 7 deletions libs/feature/record/src/lib/gpf-api-dl/gpf-api-dl.component.html
Original file line number Diff line number Diff line change
@@ -93,9 +93,13 @@
<!-- Pagination Section -->
<div class="flex items-center justify-between">
<button
*ngIf="page$.value > 1"
(click)="lessResult()"
class="bg-primary-opacity-50 px-4 py-2 text-white rounded hover:bg-primary transition"
[class]="
'px-4 py-2 text-white rounded transition ' +
((page$ | async) <= 1
? 'bg-gray-400 cursor-not-allowed '
: 'bg-primary-opacity-50 hover:bg-primary')
"
[attr.title]="'record.metadata.api.form.previousPageTooltip' | translate"
[attr.aria-label]="
'record.metadata.api.form.previousPageTooltip' | translate
@@ -104,18 +108,21 @@
<span translate>record.metadata.api.form.previousPage</span>
</button>
<div
*ngIf="(pageMax$ | async) !== 1"
class="font-semibold"
class="font-semibold place-content-center"
[attr.aria-label]="
'record.metadata.api.form.paginationDescription' | translate
"
>
{{ page$.value }}/{{ pageMax$ | async }}
{{ page$ | async }}/{{ pageMax$ | async }}
</div>
<button
*ngIf="page$.value < (pageMax$ | async)"
(click)="moreResult()"
class="bg-primary-opacity-50 px-4 py-2 text-white rounded hover:bg-primary transition"
[class]="
'bg-primary-opacity-50 px-4 py-2 text-white rounded transition ' +
((page$ | async) >= (pageMax$ | async)
? 'bg-gray-400 cursor-not-allowed '
: 'bg-primary-opacity-50 hover:bg-primary')
"
[attr.title]="'record.metadata.api.form.nextPageTooltip' | translate"
[attr.aria-label]="'record.metadata.api.form.nextPageTooltip' | translate"
>
12 changes: 11 additions & 1 deletion libs/feature/record/src/lib/gpf-api-dl/gpf-api-dl.component.ts
Original file line number Diff line number Diff line change
@@ -7,8 +7,11 @@ import {
import { DatasetServiceDistribution } from '@geonetwork-ui/common/domain/model/record'
import { BehaviorSubject, Observable, combineLatest, map, mergeMap } from 'rxjs'
import { HttpClient } from '@angular/common/http'
import { Choice } from '@geonetwork-ui/ui/inputs'
import { Choice, DropdownSelectorComponent } from '@geonetwork-ui/ui/inputs'
import axios from 'axios'
import { CommonModule } from '@angular/common'
import { TranslateModule } from '@ngx-translate/core'
import { GpfApiDlListItemComponent } from '../gpf-api-dl-list-item/gpf-api-dl-list-item.component'

export interface Label {
label: string
@@ -51,6 +54,13 @@ export interface Field {
templateUrl: './gpf-api-dl.component.html',
styleUrls: ['./gpf-api-dl.component.css'],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [
CommonModule,
TranslateModule,
DropdownSelectorComponent,
GpfApiDlListItemComponent,
],
})
export class GpfApiDlComponent implements OnInit {
isOpen = false

0 comments on commit c3d50fa

Please sign in to comment.