Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix search header layout #410

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[attr.manual]="manualBreadcrumbs"
></p-breadcrumb>
</ng-container>
<div class="title-bar flex flex-row md:justify-content-between p-2 md:p-3">
<div class="title-bar flex flex-row md:justify-content-between p-3">
<div class="title-wrap">
<div class="figure flex h-2rem w-2rem md:h-3rem md:w-3rem" *ngIf="showFigure">
<div #previewImage class="figure-image absolute top-0 left-0 right-0 bottom-0">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
:host(.p-button-label) {
font-weight: 400;
}
:host ::ng-deep .action-button {
padding: 0.5rem 0.5rem;
font-weight: 400;
}
.onecx-page-header {
display: flex;
flex-flow: column;
Expand Down Expand Up @@ -76,9 +72,6 @@
gap: 0.5rem;
align-items: center;
justify-content: space-between;
button {
padding: 0.5rem;
}
}
}
.object-panel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,35 @@
<ng-template #additionalToolbarContent>
<ng-container *ngIf="_additionalToolbarContent" [ngTemplateOutlet]="_additionalToolbarContent"></ng-container>
</ng-template>
<div class="search-criteria-container">
<div #searchParameterFields>
<ng-content></ng-content>
<div class="search-criteria-buttons">
<p-button
id="resetButton"
*ngIf="resetted.observed"
(onClick)="onResetClicked()"
label="{{ 'OCX_SEARCH_HEADER.RESET_BUTTON.TEXT' | translate }}"
icon="pi pi-eraser"
[attr.aria-label]="'OCX_SEARCH_HEADER.RESET_BUTTON.DETAIL' | translate"
title="{{ 'OCX_SEARCH_HEADER.RESET_BUTTON.DETAIL' | translate }}"
[disabled]="resetButtonDisabled"
>
</p-button>

<p-button
id="searchButton"
(onClick)="onSearchClicked()"
label="{{ 'OCX_SEARCH_HEADER.SEARCH_BUTTON.TEXT' | translate }}"
icon="pi pi-search"
[attr.aria-label]="'OCX_SEARCH_HEADER.SEARCH_BUTTON.DETAIL' | translate"
title="{{ 'OCX_SEARCH_HEADER.SEARCH_BUTTON.DETAIL' | translate }}"
[disabled]="searchButtonDisabled"
>
</p-button>
<div class="flex row-gap-3 column-gap-6 flex-wrap align-items-center">
<div>
<div #searchParameterFields>
<ng-content></ng-content>
</div>
</div>
<div class="flex flex-wrap gap-2">
<p-button
id="resetButton"
*ngIf="resetted.observed"
(onClick)="onResetClicked()"
label="{{ 'OCX_SEARCH_HEADER.RESET_BUTTON.TEXT' | translate }}"
icon="pi pi-eraser"
[attr.aria-label]="'OCX_SEARCH_HEADER.RESET_BUTTON.DETAIL' | translate"
title="{{ 'OCX_SEARCH_HEADER.RESET_BUTTON.DETAIL' | translate }}"
[disabled]="resetButtonDisabled"
>
</p-button>

<p-button
id="searchButton"
(onClick)="onSearchClicked()"
label="{{ 'OCX_SEARCH_HEADER.SEARCH_BUTTON.TEXT' | translate }}"
icon="pi pi-search"
[attr.aria-label]="'OCX_SEARCH_HEADER.SEARCH_BUTTON.DETAIL' | translate"
title="{{ 'OCX_SEARCH_HEADER.SEARCH_BUTTON.DETAIL' | translate }}"
[disabled]="searchButtonDisabled"
>
</p-button>
</div>
</div>
</ocx-page-header>

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { SearchConfigInfo } from '../../model/search-config-info'
@Component({
selector: 'ocx-search-header',
templateUrl: './search-header.component.html',
styleUrls: ['./search-header.component.scss'],
})
export class SearchHeaderComponent implements AfterViewInit {
@Input() searchConfigs: SearchConfigInfo[] | undefined
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
import { importProvidersFrom } from '@angular/core'
import { ReactiveFormsModule } from '@angular/forms'
import { BrowserModule } from '@angular/platform-browser'
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'
import { RouterModule } from '@angular/router'
import { Meta, StoryFn, applicationConfig, moduleMetadata } from '@storybook/angular'
import { BreadcrumbModule } from 'primeng/breadcrumb'
import { ButtonModule } from 'primeng/button'
import { DropdownModule } from 'primeng/dropdown'
import { InputTextModule } from 'primeng/inputtext'
import { MenuModule } from 'primeng/menu'
import { SkeletonModule } from 'primeng/skeleton'
import { DynamicPipe } from '../../pipes/dynamic.pipe'
import { StorybookTranslateModule } from '../../storybook-translate.module'
import { PageHeaderComponent } from '../page-header/page-header.component'
import { SearchConfigComponent } from '../search-config/search-config.component'
import { StorybookBreadcrumbModule } from './../../storybook-breadcrumb.module'
import { SearchHeaderComponent } from './search-header.component'

export default {
title: 'SearchHeaderComponent',
component: SearchHeaderComponent,
decorators: [
applicationConfig({
providers: [
importProvidersFrom(BrowserModule),
importProvidersFrom(BrowserAnimationsModule),
importProvidersFrom(RouterModule.forRoot([], { useHash: true })),
],
}),
moduleMetadata({
declarations: [SearchHeaderComponent, DynamicPipe, PageHeaderComponent, SearchConfigComponent],
imports: [
MenuModule,
InputTextModule,
BreadcrumbModule,
ButtonModule,
DropdownModule,
ReactiveFormsModule,
SkeletonModule,
StorybookTranslateModule,
StorybookBreadcrumbModule.init([
{ label: 'Level 1', routerLink: ['/something'] },
{ label: 'Level 2', url: '/' },
]),
],
}),
],
} as Meta<SearchHeaderComponent>

const Template: StoryFn<SearchHeaderComponent> = (args) => ({
props: args,
})

export const Basic = {
render: Template,

args: {
header: 'My title',
},
}

const BasicSearchHeader: StoryFn<SearchHeaderComponent> = (args) => ({
props: args,
template: `
<ocx-search-header [header]="header" (resetted)="resetted">
<form>
<div class="flex flex-wrap gap-3">
<span class="p-float-label">
<input
id="name"
pInputText
type="text"
class="w-18rem"
[pTooltip]="'Name'"
tooltipPosition="top"
tooltipEvent="hover"
/>
<label for="name" style="white-space: nowrap">
Name
</label>
</span>
<span class="p-float-label">
<input
id="name"
pInputText
type="text"
class="w-18rem"
[pTooltip]="'Name'"
tooltipPosition="top"
tooltipEvent="hover"
/>
<label for="name" style="white-space: nowrap">
Name
</label>
</span>
<span class="p-float-label">
<input
id="name"
pInputText
type="text"
class="w-18rem"
[pTooltip]="'Name'"
tooltipPosition="top"
tooltipEvent="hover"
/>
<label for="name" style="white-space: nowrap">
Name
</label>
</span>
</div>
</form>
</ocx-search-header>
`,
})

export const WithCustomTemplates = {
render: BasicSearchHeader,
argTypes: {
resetted: { action: 'resetted' },
},
args: {
header: 'My title',
resetted: ($event: any) => console.log($event),
},
}
Loading