|
@ -1,9 +1,13 @@ |
|
|
import { CommonModule } from '@angular/common'; |
|
|
import { CommonModule } from '@angular/common'; |
|
|
import { HttpClient, HttpClientModule } from '@angular/common/http'; |
|
|
import { HttpClient, HttpClientModule } from '@angular/common/http'; |
|
|
import { importProvidersFrom } from '@angular/core'; |
|
|
import { |
|
|
import { DataSource } from '@prisma/client'; |
|
|
applicationConfig, |
|
|
import { applicationConfig, Meta, StoryObj } from '@storybook/angular'; |
|
|
Meta, |
|
|
|
|
|
moduleMetadata, |
|
|
|
|
|
StoryObj |
|
|
|
|
|
} from '@storybook/angular'; |
|
|
|
|
|
|
|
|
|
|
|
import { GfLogoComponent } from '../logo/logo.component'; |
|
|
import { HttpClientMock } from '../mocks/httpClient.mock'; |
|
|
import { HttpClientMock } from '../mocks/httpClient.mock'; |
|
|
import { GfEntityLogoComponent } from './entity-logo.component'; |
|
|
import { GfEntityLogoComponent } from './entity-logo.component'; |
|
|
|
|
|
|
|
@ -11,49 +15,69 @@ export default { |
|
|
title: 'Entity Logo', |
|
|
title: 'Entity Logo', |
|
|
component: GfEntityLogoComponent, |
|
|
component: GfEntityLogoComponent, |
|
|
decorators: [ |
|
|
decorators: [ |
|
|
|
|
|
moduleMetadata({ |
|
|
|
|
|
imports: [CommonModule, HttpClientModule, GfLogoComponent] |
|
|
|
|
|
}), |
|
|
applicationConfig({ |
|
|
applicationConfig({ |
|
|
providers: [ |
|
|
providers: [ |
|
|
importProvidersFrom(CommonModule, HttpClientModule), |
|
|
|
|
|
{ |
|
|
{ |
|
|
provide: HttpClient, |
|
|
provide: HttpClient, |
|
|
useValue: new HttpClientMock( |
|
|
useValue: new HttpClientMock( |
|
|
new Map([ |
|
|
new Map<string, any>([ |
|
|
[ |
|
|
|
|
|
'../api/v1/logo/MANUAL/GHOST', |
|
|
|
|
|
{ |
|
|
|
|
|
logoUrl: '/assets/ghost.svg' |
|
|
|
|
|
} |
|
|
|
|
|
], |
|
|
|
|
|
[ |
|
|
[ |
|
|
'../api/v1/logo?url=https://ghostfol.io', |
|
|
'../api/v1/logo?url=https://ghostfol.io', |
|
|
{ |
|
|
{ logoUrl: '/assets/ghost.svg' } |
|
|
logoUrl: '/assets/ghost.svg' |
|
|
|
|
|
} |
|
|
|
|
|
] |
|
|
] |
|
|
]) |
|
|
]) |
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|
] |
|
|
] |
|
|
}) |
|
|
}) |
|
|
] |
|
|
], |
|
|
|
|
|
parameters: { |
|
|
|
|
|
backgrounds: { |
|
|
|
|
|
default: 'light' |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
argTypes: { |
|
|
|
|
|
size: { |
|
|
|
|
|
control: 'select', |
|
|
|
|
|
options: ['large', 'medium'], |
|
|
|
|
|
description: 'Size of the logo' |
|
|
|
|
|
}, |
|
|
|
|
|
tooltip: { |
|
|
|
|
|
control: 'text', |
|
|
|
|
|
description: 'Tooltip text for the logo' |
|
|
|
|
|
}, |
|
|
|
|
|
url: { |
|
|
|
|
|
control: 'text', |
|
|
|
|
|
description: 'URL for the logo' |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} as Meta<GfEntityLogoComponent>; |
|
|
} as Meta<GfEntityLogoComponent>; |
|
|
|
|
|
|
|
|
type Story = StoryObj<GfEntityLogoComponent>; |
|
|
type Story = StoryObj<GfEntityLogoComponent>; |
|
|
|
|
|
|
|
|
export const Default: Story = { |
|
|
export const Default: Story = { |
|
|
args: { |
|
|
|
|
|
dataSource: DataSource.MANUAL, |
|
|
|
|
|
symbol: 'GHOST', |
|
|
|
|
|
useLogo: true, |
|
|
|
|
|
size: 'large' |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
export const WithUrl: Story = { |
|
|
|
|
|
args: { |
|
|
args: { |
|
|
size: 'large', |
|
|
size: 'large', |
|
|
tooltip: 'Ghostfolio', |
|
|
tooltip: 'Ghostfolio', |
|
|
url: 'https://ghostfol.io', |
|
|
url: 'https://ghostfol.io' |
|
|
useLogo: true |
|
|
}, |
|
|
} |
|
|
parameters: { |
|
|
|
|
|
docs: { |
|
|
|
|
|
description: { |
|
|
|
|
|
story: |
|
|
|
|
|
'Entity logo component with size ("large"), tooltip ("Ghostfolio") and url ("https://ghostfol.io") inputs.' |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
render: (args) => ({ |
|
|
|
|
|
props: args, |
|
|
|
|
|
template: ` |
|
|
|
|
|
<div> |
|
|
|
|
|
<gf-logo [showLabel]="true" [size]="size"></gf-logo> |
|
|
|
|
|
</div> |
|
|
|
|
|
` |
|
|
|
|
|
}) |
|
|
}; |
|
|
}; |
|
|