File tree Expand file tree Collapse file tree 3 files changed +81
-0
lines changed
Expand file tree Collapse file tree 3 files changed +81
-0
lines changed Original file line number Diff line number Diff line change 1+ export interface ModelPackDetails {
2+ name : string ;
3+ path : string ;
4+ }
Original file line number Diff line number Diff line change 1+ import type { Meta , StoryFn } from "@storybook/react" ;
2+
3+ import { ModelPacks as ModelPacksComponent } from "../../view/model-alerts/ModelPacks" ;
4+
5+ export default {
6+ title : "Model Alerts/Model Packs" ,
7+ component : ModelPacksComponent ,
8+ argTypes : {
9+ openModelPackClick : {
10+ action : "open-model-pack-clicked" ,
11+ table : {
12+ disable : true ,
13+ } ,
14+ } ,
15+ } ,
16+ } as Meta < typeof ModelPacksComponent > ;
17+
18+ const Template : StoryFn < typeof ModelPacksComponent > = ( args ) => (
19+ < ModelPacksComponent { ...args } />
20+ ) ;
21+
22+ export const ModelPacks = Template . bind ( { } ) ;
23+ ModelPacks . args = {
24+ modelPacks : [
25+ {
26+ name : "Model pack 1" ,
27+ path : "/path/to/model-pack-1" ,
28+ } ,
29+ {
30+ name : "Model pack 2" ,
31+ path : "/path/to/model-pack-2" ,
32+ } ,
33+ ] ,
34+ } ;
Original file line number Diff line number Diff line change 1+ import { styled } from "styled-components" ;
2+ import { LinkIconButton } from "../common/LinkIconButton" ;
3+ import type { ModelPackDetails } from "../../common/model-pack-details" ;
4+
5+ const Title = styled . h3 `
6+ font-size: medium;
7+ font-weight: 500;
8+ margin: 0;
9+ ` ;
10+
11+ const List = styled . ul `
12+ list-style: none;
13+ padding: 0;
14+ margin-top: 5px;
15+ ` ;
16+
17+ export const ModelPacks = ( {
18+ modelPacks,
19+ openModelPackClick,
20+ } : {
21+ modelPacks : ModelPackDetails [ ] ;
22+ openModelPackClick : ( path : string ) => void ;
23+ } ) : React . JSX . Element => {
24+ if ( modelPacks . length <= 0 ) {
25+ return < > </ > ;
26+ }
27+
28+ return (
29+ < >
30+ < Title > Model packs</ Title >
31+ < List >
32+ { modelPacks . map ( ( modelPack ) => (
33+ < li key = { modelPack . path } >
34+ < LinkIconButton onClick = { ( ) => openModelPackClick ( modelPack . path ) } >
35+ < span slot = "start" className = "codicon codicon-file-code" > </ span >
36+ { modelPack . name }
37+ </ LinkIconButton >
38+ </ li >
39+ ) ) }
40+ </ List >
41+ </ >
42+ ) ;
43+ } ;
You can’t perform that action at this time.
0 commit comments