-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
[Bug]: Storybook Angular sample components are not marked standalone? #22453
Comments
I believe this is important. I wanted to start using Storybook in my company, but it just adds errors since the basic examples, which is very frustrating. Even doing the improvements mentioned above, in the page component you need to update to: import Header from './header.component';
import { CommonModule } from '@angular/common';
@Component({
selector: 'storybook-page',
standalone: true,
imports: [Header, CommonModule], And for the page.stories.ts file: decorators: [
moduleMetadata({
imports: [CommonModule, Button, Header],
}),
], |
@do-diegoortiz, @fireflysemantics Would one of you like to work on this? Implementing the changes should be easy. I can assist if needed :) |
Greetings to all, Should you wish to employ standalone components within a shared Nx Mono Repository Library, you may encounter the necessity for manual configurations. I am pleased to present to you a provisional, albeit effective, workaround. In this particular instance, the Login component serves as a standalone entity. Best of luck and continued success in your endeavors. import { HttpClient, HttpClientModule } from '@angular/common/http';
import { APP_INITIALIZER } from '@angular/core';
import { ReactiveFormsModule } from '@angular/forms';
import { CustomFormlyModule } from '@app-shared-libs/formly';
import { CustomMaterialModule } from '@app-shared-libs/material';
import {
TranslateLoader,
TranslateModule,
TranslateService,
} from '@ngx-translate/core';
import { Meta, Story, moduleMetadata } from '@storybook/angular';
import { APP_LANGUAGES } from '../../config';
import { LoginComponent } from './login.component';
import { HttpLoaderFactory, appInitializerFactory } from '../../useFactory';
export default {
title: 'LoginComponent',
component: LoginComponent,
decorators: [
moduleMetadata({
imports: [
CustomFormlyModule,
CustomMaterialModule,
ReactiveFormsModule,
HttpClientModule,
TranslateModule.forRoot({
defaultLanguage: APP_LANGUAGES.DE,
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,
deps: [HttpClient],
},
}),
],
providers: [
{
provide: APP_INITIALIZER,
useFactory: appInitializerFactory,
deps: [TranslateService],
multi: true,
},
],
}),
],
} as Meta;
export const Primary: Story<LoginComponent> = (args: LoginComponent) => ({
component: LoginComponent,
props: args,
}); |
I hope this gets more attention. In new projection standalone components are the go-to method for component creation. |
Describe the bug
I think the markup for the annotation in the Angular components is meant to include
standalone:true
like this:This resolves some linting errors when the project is openend.
Also for the button demo the
primary
input is documented as:And I think the intention is to have something like:
Also the
primary
property on the button is set like this in the heading story (It's actually set twice):Which creates the linting error:
It should proxy with a `setter as described in this article.
Alternatively the
primary
property could just have typeany
and that resolves the linting errors ...The heading component should be declared like this (Currently missing
standalone
andimports
:And the
User
type is missing thename
property, and this also creates linting errors. It should be declared like this:To Reproduce
No response
System
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: