Skip to content

Commit 35869df

Browse files
committed
fix(story):image should be displayed on login page
1 parent 8a64944 commit 35869df

File tree

6 files changed

+174
-228
lines changed

6 files changed

+174
-228
lines changed

projects/arc-lib/.storybook/main.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const config: StorybookConfig = {
77
'@storybook/addon-essentials',
88
'@storybook/addon-interactions',
99
],
10-
10+
staticDirs: ['../src/lib/assets'],
1111
framework: {
1212
name: '@storybook/angular',
1313
options: {},
@@ -17,6 +17,3 @@ const config: StorybookConfig = {
1717
},
1818
};
1919
export default config;
20-
21-
22-

projects/arc-lib/documentation.json

Lines changed: 92 additions & 168 deletions
Large diffs are not rendered by default.

projects/arc-lib/src/lib/components/auth/auth.module.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@ import {ThemeModule} from '@project-lib/theme/theme.module';
1111
import {AuthRoutingModule} from './auth-routing.module';
1212
import {AuthComponent} from './auth.component';
1313
import {LoginComponent} from './login/login.component';
14-
import { HomePageComponent } from './home-page/home-page.component';
15-
import { LoginPageComponent } from './login-page/login-page.component';
1614

1715
@NgModule({
18-
declarations: [LoginComponent, AuthComponent, HomePageComponent, LoginPageComponent],
16+
declarations: [LoginComponent, AuthComponent],
1917
schemas: [CUSTOM_ELEMENTS_SCHEMA],
2018
imports: [
2119
CommonModule,

projects/arc-lib/src/lib/components/auth/login/login.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<nb-card class="h-100">
22
<nb-card-body>
33
<div class="align-center logo">
4-
<img width="20%" src= "{{image}}" alt="logo" draggable="false"
4+
<img width="20%" [src]= "imageUrl" [alt]="altText" draggable="false"
55
height="126px" width="120px" />
66

77
<!-- src="baseHref + 'images/auth/angular.png'" -->

projects/arc-lib/src/lib/components/auth/login/login.component.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ import {ActivatedRoute} from '@angular/router';
44
import {AuthService} from '@project-lib/core/auth';
55
import {RouteComponentBaseDirective} from '@project-lib/core/route-component-base';
66

7-
// import { APP_BASE_HREF } from '@angular/common';
8-
97
@Component({
10-
selector: 'login',
8+
selector: 'app-login',
119
templateUrl: './login.component.html',
1210
styleUrls: ['./login.component.scss'],
1311
})
@@ -16,14 +14,11 @@ export class LoginComponent extends RouteComponentBaseDirective {
1614
override readonly route: ActivatedRoute,
1715
override readonly location: Location,
1816
private readonly authService: AuthService,
19-
// @Inject(APP_BASE_HREF)
20-
// private baseHref: string
2117
) {
2218
super(route, location);
2319
}
24-
image="../../../assets/images/auth/angular.png"
25-
// ""
26-
// projects/arc-lib/src/lib/assets/images/auth/angular.png
20+
imageUrl = '../../../assets/images/auth/angular.png';
21+
altText = 'logo';
2722
loginViaGoogle() {
2823
this.authService.loginViaGoogle();
2924
}
Lines changed: 76 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,79 @@
1-
import { moduleMetadata } from '@storybook/angular';
2-
3-
import { AuthService } from '@project-lib/core/auth';
4-
import { LoginComponent } from '@project-lib/components/index';
5-
import { ActivatedRoute } from '@angular/router';
6-
import { ThemeModule } from '@project-lib/theme/theme.module';
7-
import { NbThemeModule } from '@nebular/theme';
8-
9-
10-
export default {
11-
title: 'Components/Login',
12-
component: LoginComponent,
13-
decorators: [
14-
moduleMetadata({
15-
imports:[ThemeModule,
16-
NbThemeModule.forRoot()],
17-
providers: [
18-
{
19-
provide: ActivatedRoute,
20-
useValue: {
21-
/* Mock ActivatedRoute data here if needed */
22-
},
1+
import {Meta, StoryObj, moduleMetadata} from '@storybook/angular';
2+
import {AuthService} from '@project-lib/core/auth';
3+
import {LoginComponent} from '@project-lib/components/index';
4+
import {ActivatedRoute} from '@angular/router';
5+
import {ThemeModule} from '@project-lib/theme/theme.module';
6+
import {NbThemeModule} from '@nebular/theme';
7+
8+
const meta = {
9+
title: 'Components/Login',
10+
component: LoginComponent,
11+
decorators: [
12+
moduleMetadata({
13+
imports: [ThemeModule, NbThemeModule.forRoot()],
14+
providers: [
15+
{
16+
provide: ActivatedRoute,
17+
useValue: {
18+
/* Mock ActivatedRoute data here if needed */
2319
},
24-
{
25-
provide: Location,
26-
useValue: {
27-
/* Mock Location methods here if needed */
28-
},
20+
},
21+
{
22+
provide: Location,
23+
useValue: {
24+
/* Mock Location methods here if needed */
2925
},
30-
{
31-
provide: AuthService,
32-
useValue: {
33-
/* Mock AuthService methods here if needed */
34-
},
26+
},
27+
{
28+
provide: AuthService,
29+
useValue: {
30+
/* Mock AuthService methods here if needed */
3531
},
36-
],
37-
}),
38-
],
39-
};
40-
41-
const Template = (args: LoginComponent) => ({
42-
component: LoginComponent,
43-
props: args,
44-
});
45-
46-
export const Default = Template.bind({});
47-
Default.args = {};
32+
},
33+
],
34+
}),
35+
],
36+
} as Meta;
37+
export default meta;
38+
39+
// // const Template: Story<LoginComponent> = (args: LoginComponent) => ({
40+
// // component: LoginComponent,
41+
// // props: args,
42+
// // // template: `<app-login [image]="${image}"></app-login>`,
43+
// // });
44+
45+
// // export const Default = Template.bind({});
46+
// // Default.args = {
47+
// // image: '../../lib/assets/images/auth/angular.png',
48+
// // //image: '../assets/angular.png',
49+
// // };
50+
51+
// const meta: Meta<LoginComponent> = {
52+
// component: LoginComponent,
53+
// };
54+
55+
// export default meta;
56+
// type Story = StoryObj<typeof meta>;
57+
58+
// // Assume image.png is located in the "public" directory.
59+
// export const WithAnImage: Story = {
60+
// render: () => ({
61+
// props: {
62+
// src: '/images/auth/angular.png',
63+
// alt: 'my image',
64+
// },
65+
// }),
66+
// };
67+
68+
/// from official docs
69+
type Story = StoryObj<typeof meta>;
70+
71+
//append the path of image relative to the staticdir in main.ts
72+
export const WithAnImage: Story = {
73+
render: () => ({
74+
props: {
75+
imageUrl: '/images/auth/angular.png',
76+
altText: 'my image',
77+
},
78+
}),
79+
};

0 commit comments

Comments
 (0)