Skip to content

Commit

Permalink
feat(editor): adjustements to the record table, add story
Browse files Browse the repository at this point in the history
  • Loading branch information
jahow committed Sep 10, 2023
1 parent 4d7654a commit 19a5b34
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
mat-icon {
font-variation-settings: 'FILL' 1;
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import { TranslateModule } from '@ngx-translate/core'
import {
componentWrapperDecorator,
Meta,
moduleMetadata,
StoryObj,
} from '@storybook/angular'
import { Meta, moduleMetadata, StoryObj } from '@storybook/angular'
import {
TRANSLATE_DEFAULT_CONFIG,
UtilI18nModule,
} from '@geonetwork-ui/util/i18n'
import { UiInputsModule, ButtonComponent } from '@geonetwork-ui/ui/inputs'
import { ButtonComponent } from '@geonetwork-ui/ui/inputs'
import { PaginationButtonsComponent } from './pagination-buttons.component'
import { FormsModule } from '@angular/forms'
import { action } from '@storybook/addon-actions'
Expand Down
6 changes: 0 additions & 6 deletions libs/ui/inputs/src/lib/star-toggle/star-toggle.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ mat-icon {
width: 1em;
height: 1em;
font-size: 1.5em;
margin-top: -0.1em;
font-variation-settings: 'opsz' 40;
}

.star-filled {
font-variation-settings: 'FILL' 1;
}

.star-toggle-overlay {
Expand Down
18 changes: 9 additions & 9 deletions libs/ui/search/src/lib/record-table/record-table.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
>
<span translate>record.metadata.title</span>
<mat-icon
class="text-base leading-tight"
class="material-symbols-outlined"
*ngIf="isSortedBy('resourceTitleObject.default.keyword', 'desc')"
>
expand_more</mat-icon
>
<mat-icon
class="text-base leading-tight"
class="material-symbols-outlined"
*ngIf="isSortedBy('resourceTitleObject.default.keyword', 'asc')"
>
expand_less</mat-icon
Expand All @@ -47,13 +47,13 @@
>
<span translate>record.metadata.author</span>
<mat-icon
class="text-base leading-tight"
class="material-symbols-outlined"
*ngIf="isSortedBy('recordOwner', 'desc')"
>
expand_more</mat-icon
>
<mat-icon
class="text-base leading-tight"
class="material-symbols-outlined"
*ngIf="isSortedBy('recordOwner', 'asc')"
>
expand_less</mat-icon
Expand All @@ -66,15 +66,15 @@
extraClass="px-3 py-2 space-x-1"
(buttonClick)="setSortBy('changeDate')"
>
<span translate>record.metadata.completion</span>
<span translate>record.metadata.updatedOn</span>
<mat-icon
class="text-base leading-tight"
class="material-symbols-outlined"
*ngIf="isSortedBy('changeDate', 'desc')"
>
expand_more</mat-icon
>
<mat-icon
class="text-base leading-tight"
class="material-symbols-outlined"
*ngIf="isSortedBy('changeDate', 'asc')"
>
expand_less</mat-icon
Expand All @@ -89,13 +89,13 @@
>
<span translate>record.metadata.createdOn</span>
<mat-icon
class="text-base leading-tight"
class="material-symbols-outlined"
*ngIf="isSortedBy('createDate', 'desc')"
>
expand_more</mat-icon
>
<mat-icon
class="text-base leading-tight"
class="material-symbols-outlined"
*ngIf="isSortedBy('createDate', 'asc')"
>
expand_less</mat-icon
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import type { Meta, StoryObj } from '@storybook/angular'
import { moduleMetadata } from '@storybook/angular'
import { RecordTableComponent } from './record-table.component'
import { DATASET_RECORDS } from '@geonetwork-ui/common/fixtures'
import { action } from '@storybook/addon-actions'
import { MatIconModule } from '@angular/material/icon'
import { UiInputsModule } from '@geonetwork-ui/ui/inputs'

const meta: Meta<RecordTableComponent> = {
component: RecordTableComponent,
title: 'Search/RecordTableComponent',
decorators: [
moduleMetadata({
declarations: [RecordTableComponent],
imports: [UiInputsModule, MatIconModule],
}),
],
render: (args: RecordTableComponent) => ({
props: {
...args,
recordSelect: action('recordSelect'),
sortByChange: action('sortByChange'),
},
}),
}
export default meta
type Story = StoryObj<RecordTableComponent>

export const Primary: Story = {
args: {
records: DATASET_RECORDS.concat(DATASET_RECORDS, DATASET_RECORDS),
totalHits: 1234,
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export class RecordTableComponent {
newOrder = 'asc'
}
this.sortByChange.emit([newOrder, col])
this.sortBy = [newOrder, col]
}

isSortedBy(col: string, order: 'asc' | 'desc'): boolean {
Expand Down

0 comments on commit 19a5b34

Please sign in to comment.