-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c2b7db5
commit d3adefd
Showing
4 changed files
with
133 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
106 changes: 106 additions & 0 deletions
106
src/interface/src/styleguide/notes-sidebar/notes-sidebar.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,106 @@ | ||
import { | ||
Meta, | ||
StoryObj, | ||
moduleMetadata, | ||
argsToTemplate, | ||
} from '@storybook/angular'; | ||
import { NotesSidebarComponent } from './notes-sidebar.component'; | ||
import { | ||
MatDialogModule, | ||
MAT_DIALOG_DATA, | ||
MatDialogRef, | ||
} from '@angular/material/dialog'; | ||
import { MatSnackBarModule } from '@angular/material/snack-bar'; | ||
|
||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; | ||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; | ||
import { HttpClientModule } from '@angular/common/http'; // Add this import | ||
import { BaseNotesService, ProjectAreaNotesService } from '@services'; | ||
|
||
const meta: Meta<NotesSidebarComponent> = { | ||
title: 'Components/Notes Sidebar', | ||
component: NotesSidebarComponent, | ||
tags: ['autodocs'], | ||
decorators: [ | ||
moduleMetadata({ | ||
imports: [ | ||
HttpClientModule, | ||
MatDialogModule, | ||
BrowserAnimationsModule, | ||
MatProgressSpinnerModule, | ||
NotesSidebarComponent, | ||
MatSnackBarModule, | ||
], | ||
providers: [ | ||
{ provide: MAT_DIALOG_DATA, useValue: {} }, | ||
{ provide: MatDialogRef, useValue: {} }, | ||
{ provide: BaseNotesService, useValue: ProjectAreaNotesService }, | ||
], | ||
}), | ||
], | ||
render: ({ ...args }) => ({ | ||
props: args, | ||
template: `<div style="width:300px;border:1px black solid;"><sg-notes-sidebar ${argsToTemplate(args)}> | ||
</sg-notes-sidebar></div>`, | ||
}), | ||
}; | ||
|
||
export default meta; | ||
|
||
const exampleNotes = [ | ||
{ | ||
id: 1, | ||
user_id: 10, | ||
user_name: 'Larry Larrington', | ||
content: 'Here is some content', | ||
created_at: '2024-01-01', | ||
can_delete: true, | ||
}, | ||
{ | ||
id: 2, | ||
user_id: 11, | ||
user_name: 'Someone Else', | ||
content: 'Here is some content', | ||
created_at: '2024-02-01', | ||
can_delete: false, | ||
}, | ||
|
||
{ | ||
id: 3, | ||
user_id: 10, | ||
user_name: 'Larry Larrington', | ||
content: | ||
'Here is some additional content.' + | ||
' Here is some additional content. Here is some additional content. ' + | ||
'Here is some additional content. Here is some additional content. ' + | ||
'Here is some additional content. ', | ||
created_at: '2024-05-01', | ||
can_delete: true, | ||
}, | ||
]; | ||
|
||
type Story = StoryObj<NotesSidebarComponent>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
showHeader: false, | ||
notesModel: 'planning_area', | ||
objectId: 1, | ||
notes: exampleNotes, | ||
noNotesTitleText: 'No Notes Yet', | ||
noNotesDetailText: | ||
'Start adding notes to help your team learn more about this section.', | ||
}, | ||
}; | ||
|
||
export const NoNotes: Story = { | ||
args: { | ||
showHeader: false, | ||
notesModel: 'planning_area', | ||
objectId: 1, | ||
notes: [], | ||
noNotesTitleText: 'No Notes Yet', | ||
noNotesDetailText: | ||
'Start adding notes to help your team learn more about this section.', | ||
}, | ||
}; |