generated from PackagrIO/goweb-template
-
-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix horizontal overflow for glossary lookup (#445)
* Fix Overflow for Labs Glossary * Add story to glossary lookup and report labs observation
- Loading branch information
1 parent
d025251
commit c487c9f
Showing
3 changed files
with
112 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
max-height:300px; | ||
overflow-y:scroll; | ||
display: inline-block; | ||
max-width: 100%; | ||
} |
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
101 changes: 101 additions & 0 deletions
101
frontend/src/app/components/report-labs-observation/report-labs-observation.stories.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,101 @@ | ||
import type { Meta, StoryObj } from '@storybook/angular'; | ||
import { moduleMetadata } from '@storybook/angular'; | ||
import { DecoratorFunction } from '@storybook/types'; | ||
import { ReportLabsObservationComponent } from './report-labs-observation.component' | ||
import { PipesModule } from 'src/app/pipes/pipes.module'; | ||
import { NgbCollapse } from '@ng-bootstrap/ng-bootstrap'; | ||
import { ResourceFhir } from 'src/app/models/fasten/resource_fhir'; | ||
import { GlossaryLookupComponent } from '../glossary-lookup/glossary-lookup.component'; | ||
import { NgChartsModule } from 'ng2-charts'; | ||
import { HTTP_CLIENT_TOKEN } from 'src/app/dependency-injection'; | ||
import { HttpClient, HttpClientModule, HttpHandler } from '@angular/common/http'; | ||
import { RouterTestingModule } from '@angular/router/testing'; | ||
import { Observable, of } from 'rxjs'; | ||
|
||
import R4Example1Json from "../../../lib/fixtures/r4/resources/observation/example1.json"; | ||
import { Html as GlossaryLookupHtml } from '../glossary-lookup/glossary-lookup.stories'; | ||
|
||
|
||
const withHttpClientProvider: DecoratorFunction<any> = (storyFunc, context) => { | ||
const { httpClientResp } = context.parameters; | ||
|
||
class MockHttpClient extends HttpClient { | ||
|
||
get(): Observable<any> { | ||
return of(httpClientResp) | ||
} | ||
} | ||
|
||
return moduleMetadata({ providers: [{ provide: HTTP_CLIENT_TOKEN, useClass: MockHttpClient }] })( | ||
storyFunc, | ||
context | ||
); | ||
}; | ||
|
||
// More on how to set up stories at: https://storybook.js.org/docs/angular/writing-stories/introduction | ||
const meta: Meta<ReportLabsObservationComponent> = { | ||
title: 'Components/ReportLabsObservation', | ||
component: ReportLabsObservationComponent, | ||
decorators: [ | ||
withHttpClientProvider, | ||
moduleMetadata({ | ||
imports: [PipesModule, GlossaryLookupComponent, NgChartsModule, RouterTestingModule, HttpClientModule], | ||
declarations: [NgbCollapse], | ||
providers: [], | ||
}) | ||
], | ||
tags: ['autodocs'], | ||
render: (args: ReportLabsObservationComponent) => ({ | ||
props: { | ||
backgroundColor: null, | ||
...args, | ||
}, | ||
}), | ||
argTypes: { | ||
observations: { | ||
control: 'array' | ||
}, | ||
observationCode: { | ||
control: 'string' | ||
}, | ||
observationTitle: { | ||
control: 'string' | ||
}, | ||
}, | ||
}; | ||
|
||
|
||
export default meta; | ||
type Story = StoryObj<ReportLabsObservationComponent>; | ||
|
||
const observation: ResourceFhir = { | ||
source_id: '', | ||
source_resource_id: '', | ||
source_resource_type: 'Observation', | ||
fhir_version: '4', | ||
sort_title: 'sort', | ||
sort_date: new Date(), | ||
resource_raw: R4Example1Json, | ||
}; | ||
|
||
const observation2: ResourceFhir = { | ||
source_id: '', | ||
source_resource_id: '', | ||
source_resource_type: 'Observation', | ||
fhir_version: '4', | ||
sort_title: 'sort', | ||
sort_date: new Date(), | ||
resource_raw: R4Example1Json, | ||
}; | ||
|
||
// More on writing stories with args: https://storybook.js.org/docs/angular/writing-stories/args | ||
export const Entry: Story = { | ||
args: { | ||
observations: [observation, observation2], | ||
observationCode: '788-0', | ||
observationTitle: 'Erythrocyte distribution width [Ratio] by Automated count', | ||
}, | ||
parameters: { | ||
...GlossaryLookupHtml.parameters | ||
} | ||
}; |